diff --git a/Gemfile.lock b/Gemfile.lock index d3180cd..79dd206 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - boxroom (0.0.3) + boxroom (0.0.4) acts_as_tree (~> 2.7) bulma-rails (~> 0.6.2) cells-erb (~> 0.1.0) @@ -114,7 +114,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - loofah (2.2.0) + loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.0) @@ -154,8 +154,8 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) railties (5.1.5) actionpack (= 5.1.5) activesupport (= 5.1.5) @@ -198,20 +198,20 @@ GEM trailblazer-macro (>= 2.1.0.beta2, < 2.2.0) trailblazer-macro-contract (>= 2.1.0.beta2, < 2.2.0) trailblazer-operation (>= 0.2.4, < 0.3.0) - trailblazer-activity (0.5.1) + trailblazer-activity (0.5.2) hirb trailblazer-context trailblazer-cells (0.0.3) cells (>= 4.1.0.rc1, < 5.0.0) trailblazer-context (0.1.2) trailblazer-loader (0.1.2) - trailblazer-macro (2.1.0.beta3) - trailblazer-macro-contract (2.1.0.beta2) + trailblazer-macro (2.1.0.beta4) + trailblazer-macro-contract (2.1.0.beta3) declarative reform (>= 2.2.0, < 3.0.0) trailblazer-operation (>= 0.2.4, < 0.3.0) - trailblazer-operation (0.2.4) - trailblazer-activity (>= 0.5.1, < 0.7.0) + trailblazer-operation (0.2.5) + trailblazer-activity (>= 0.5.2, < 0.7.0) trailblazer-context (>= 0.1.1, < 0.3.0) trailblazer-rails (2.1.0) reform-rails (>= 0.1.4, < 0.2.0) diff --git a/README.md b/README.md index 635bc9a..bd87334 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ sharing files in a web browser. It lets users - share files - search folders and files - sort files and folders +- notify by email when files in specific folders are created, updated or removed Admins can: - manage users @@ -44,6 +45,7 @@ Boxroom.configure do |config| config.show_settings = true config.show_shared_files = true config.show_search = true + config.enable_notifications = true # notify by email when files in specific folders are created, updated or removed end ``` @@ -71,9 +73,83 @@ end ``` - if you modify your users without callbacks in any place you should also take care of `boxroom_users` table yourself. -## Contributing +## Mail settings + +Boxroom sends email on the following occasions: + + * When inviting new users + * On a reset password request + * When a file is shared + +For the application to be able to send email, a few things have to be set up. Depending on the environment +you're working in, either open `config/environments/development.rb` or `config/environments/production.rb`. +Uncomment the following lines and fill in the correct settings of your mail server: + +```ruby +config.action_mailer.delivery_method = :smtp +config.action_mailer.smtp_settings = { + address: 'mailhost', + port: 587, + user_name: 'user_name', + password: 'password', + authentication: 'plain' +} +``` + +Also uncomment the following and replace `localhost:3000` with the host name the app will be running under: + +```ruby +config.action_mailer.default_url_options = { host: 'localhost:3000' } +``` + +Lastly, you have to choose the address emails will be sent from. You can do +this by uncommenting and adjusting the following: + +```ruby +ActionMailer::Base.default from: 'Boxroom ' +``` + + +## Languages + +Thanks to [Rob Halff](https://github.com/rhalff), [Marcus Ilgner](https://github.com/milgner), +[Jessica Marcon](https://github.com/marcontwm), [Arnaud Sellenet](https://github.com/demental), +[Burnaby John](https://github.com/john-coding) and [marcosantoniocaro](https://github.com/marcosantoniocaro) +Boxroom is now available in Dutch, German, Italian, French, Simplified Chinese and Spanish. + +English is the default. To change the language, open `config/application.rb` and set the language you desire: + +```ruby +config.i18n.default_locale = :en # English +config.i18n.default_locale = :nl # Dutch +config.i18n.default_locale = :de # German +config.i18n.default_locale = :it # Italian +config.i18n.default_locale = :fr # French +config.i18n.default_locale = :'zh-CN' # Simplified Chinese +config.i18n.default_locale = :es # Spanish +``` + +It would be great to have many more languages. I am waiting for your pull requests. + +## Contributing and Development Please feel free to leave an issue or PR. +- Use `docker-compose up -d` to launch mailcatcher on [http://localhost:1080](http://localhost:1080) +- Update mail settings in `config/environments/development.rb` +```ruby +config.action_mailer.raise_delivery_errors = true +config.action_mailer.perform_caching = false +config.action_mailer.perform_deliveries = true +config.action_mailer.delivery_method = :smtp +config.action_mailer.smtp_settings = { + address: 'localhost', + port: 1025 +} +config.action_mailer.default_url_options = { :host => 'localhost:3000' } + +ActionMailer::Base.default from: 'Boxroom ' +``` + ## Testing - run migrations `bin/rails db:migrate RAILS_ENV=test` - run tests `bin/rails test` @@ -82,6 +158,7 @@ Please feel free to leave an issue or PR. The engine is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). ## Roadmap: +- tests for notifications - support s3 - batch actions - tag files diff --git a/app/concepts/boxroom/folder/view/show.erb b/app/concepts/boxroom/folder/view/show.erb index 0dab693..ff7275c 100644 --- a/app/concepts/boxroom/folder/view/show.erb +++ b/app/concepts/boxroom/folder/view/show.erb @@ -57,7 +57,7 @@ <%= link_to '', {controller: :clipboard, action: :create, id: file.id, type: 'file', folder_id: file.folder, authenticity_token: form_authenticity_token}, method: :post, title: t(:add_to_clipboard) - %>  + %> <% if Boxroom.configuration.show_shared_files %> <%= link_to '', new_file_share_link_path(file), title: t(:share) %> <% end %> diff --git a/app/concepts/boxroom/user_file/contract/notify.rb b/app/concepts/boxroom/user_file/contract/notify.rb new file mode 100644 index 0000000..fd74112 --- /dev/null +++ b/app/concepts/boxroom/user_file/contract/notify.rb @@ -0,0 +1,7 @@ +module Boxroom::UserFile::Contract + class Notify < Reform::Form + property :id, virtual: true + + validates :id, presence: true + end +end \ No newline at end of file diff --git a/app/concepts/boxroom/user_file/operations/notify_create.rb b/app/concepts/boxroom/user_file/operations/notify_create.rb new file mode 100644 index 0000000..0b36b9d --- /dev/null +++ b/app/concepts/boxroom/user_file/operations/notify_create.rb @@ -0,0 +1,27 @@ +module Boxroom + class UserFile < ActiveRecord::Base + class NotifyCreate < ::Trailblazer::Operation + step Trailblazer::Operation::Contract::Build(constant: Boxroom::UserFile::Contract::Notify) + step Trailblazer::Operation::Contract::Validate() + step :model! + step :check + step :notify + + def model!(options, params:, **) + options['model'] = UserFile.find(params[:id]) + end + + def check(options, params:, **) + return false unless Boxroom.configuration.enable_notifications + return false unless options['model'].folder.notify_create + true + end + + def notify(options, params:, **) + options['model'].folder.notify_emails.gsub(',', ' ').split.each do |email| + UserFileMailer.notify_create(options['model'], email).deliver_later + end + end + end + end +end diff --git a/app/concepts/boxroom/user_file/operations/notify_remove.rb b/app/concepts/boxroom/user_file/operations/notify_remove.rb new file mode 100644 index 0000000..a822097 --- /dev/null +++ b/app/concepts/boxroom/user_file/operations/notify_remove.rb @@ -0,0 +1,27 @@ +module Boxroom + class UserFile < ActiveRecord::Base + class NotifyRemove < ::Trailblazer::Operation + step Trailblazer::Operation::Contract::Build(constant: Boxroom::UserFile::Contract::Notify) + step Trailblazer::Operation::Contract::Validate() + step :model! + step :check + step :notify + + def model!(options, params:, **) + options['model'] = UserFile.find(params[:id]) + end + + def check(options, params:, **) + return false unless Boxroom.configuration.enable_notifications + return false unless options['model'].folder.notify_remove + true + end + + def notify(options, params:, **) + options['model'].folder.notify_emails.gsub(',', ' ').split.each do |email| + UserFileMailer.notify_remove(options['model'].attachment_file_name, options['model'].folder, email).deliver_later + end + end + end + end +end diff --git a/app/concepts/boxroom/user_file/operations/notify_update.rb b/app/concepts/boxroom/user_file/operations/notify_update.rb new file mode 100644 index 0000000..090860d --- /dev/null +++ b/app/concepts/boxroom/user_file/operations/notify_update.rb @@ -0,0 +1,27 @@ +module Boxroom + class UserFile < ActiveRecord::Base + class NotifyUpdate < ::Trailblazer::Operation + step Trailblazer::Operation::Contract::Build(constant: Boxroom::UserFile::Contract::Notify) + step Trailblazer::Operation::Contract::Validate() + step :model! + step :check + step :notify + + def model!(options, params:, **) + options['model'] = UserFile.find(params[:id]) + end + + def check(options, params:, **) + return false unless Boxroom.configuration.enable_notifications + return false unless options['model'].folder.notify_update + true + end + + def notify(options, params:, **) + options['model'].folder.notify_emails.gsub(',', ' ').split.each do |email| + UserFileMailer.notify_update(options['model'], email).deliver_later + end + end + end + end +end diff --git a/app/controllers/boxroom/files_controller.rb b/app/controllers/boxroom/files_controller.rb index 8cbd41e..941f8d1 100644 --- a/app/controllers/boxroom/files_controller.rb +++ b/app/controllers/boxroom/files_controller.rb @@ -34,6 +34,7 @@ def create File.open("#{Rails.root}/#{Boxroom.configuration.uploads_path}/#{Rails.env}/#{existing_file.id}/original/#{existing_file.id}", "ab") {|f| f.write(permitted_params.user_file["attachment"].read)} else @file = @target_folder.user_files.create(permitted_params.user_file) + UserFile::NotifyCreate.(params: {id: @file.id}) end head :ok @@ -46,6 +47,7 @@ def edit # @file and @folder are set in require_existing_file def update if @file.update_attributes(permitted_params.user_file) + UserFile::NotifyUpdate.(params: {id: @file.id}) redirect_to edit_file_url(@file), :notice => t(:your_changes_were_saved) else render :action => 'edit' @@ -54,6 +56,7 @@ def update # @file and @folder are set in require_existing_file def destroy + UserFile::NotifyRemove.(params: {id: @file.id}) @file.destroy redirect_to @folder end diff --git a/app/controllers/boxroom/folders_controller.rb b/app/controllers/boxroom/folders_controller.rb index f0681e7..f5c6059 100644 --- a/app/controllers/boxroom/folders_controller.rb +++ b/app/controllers/boxroom/folders_controller.rb @@ -2,14 +2,14 @@ module Boxroom class FoldersController < Boxroom::ApplicationController include Boxroom::BaseController - before_action :require_existing_folder, :only => [:show, :edit, :update, :destroy] - before_action :require_existing_target_folder, :only => [:new, :create] - before_action :require_folder_isnt_root_folder, :only => [:edit, :update, :destroy] + before_action :require_existing_folder, only: [:show, :edit, :update, :destroy] + before_action :require_existing_target_folder, only: [:new, :create] + before_action :require_folder_isnt_root_folder, only: [:edit, :update, :destroy] - before_action :require_create_permission, :only => [:new, :create] - before_action :require_read_permission, :only => :show - before_action :require_update_permission, :only => [:edit, :update] - before_action :require_delete_permission, :only => :destroy + before_action :require_create_permission, only: [:new, :create] + before_action :require_read_permission, only: :show + before_action :require_update_permission, only: [:edit, :update] + before_action :require_delete_permission, only: :destroy def index redirect_to Folder.root diff --git a/app/mailers/boxroom/user_file_mailer.rb b/app/mailers/boxroom/user_file_mailer.rb new file mode 100644 index 0000000..dbeadd6 --- /dev/null +++ b/app/mailers/boxroom/user_file_mailer.rb @@ -0,0 +1,19 @@ +module Boxroom + class UserFileMailer < ActionMailer::Base + def notify_create(user_file, email) + @user_file = user_file + mail(to: email, subject: t(:file_added)) + end + + def notify_update(user_file, email) + @user_file = user_file + mail(to: email, subject: t(:file_updated)) + end + + def notify_remove(file_name, folder, email) + @file_name = file_name + @folder = folder + mail(to: email, subject: t(:file_removed)) + end + end +end \ No newline at end of file diff --git a/app/models/boxroom/permitted_params.rb b/app/models/boxroom/permitted_params.rb index 0643796..9d0fd63 100644 --- a/app/models/boxroom/permitted_params.rb +++ b/app/models/boxroom/permitted_params.rb @@ -7,7 +7,7 @@ class PermittedParams < Struct.new(:params, :current_user) end def folder_attributes - [:name] + [:name, :notify_emails, :notify_create, :notify_update, :notify_remove] end def group_attributes diff --git a/app/models/boxroom/user_file.rb b/app/models/boxroom/user_file.rb index 7aa2f2f..6a0c0fa 100644 --- a/app/models/boxroom/user_file.rb +++ b/app/models/boxroom/user_file.rb @@ -1,15 +1,15 @@ module Boxroom class UserFile < ActiveRecord::Base - has_attached_file :attachment, :path => ":rails_root/#{Boxroom.configuration.uploads_path}/:rails_env/:id/:style/:id", :restricted_characters => Boxroom::RESTRICTED_CHARACTERS + has_attached_file :attachment, path: ":rails_root/#{Boxroom.configuration.uploads_path}/:rails_env/:id/:style/:id", restricted_characters: Boxroom::RESTRICTED_CHARACTERS do_not_validate_attachment_file_type :attachment belongs_to :folder - has_many :share_links, :dependent => :destroy + has_many :share_links, dependent: :destroy - validates_attachment_presence :attachment, :message => I18n.t(:blank, :scope => [:activerecord, :errors, :messages]) + validates_attachment_presence :attachment, message: I18n.t(:blank, scope: [:activerecord, :errors, :messages]) validates_presence_of :folder_id - validates_uniqueness_of :attachment_file_name, :scope => 'folder_id', :message => I18n.t(:exists_already, :scope => [:activerecord, :errors, :messages]) - validates_format_of :attachment_file_name, :with => /\A[^\/\\\?\*:|"<>]+\z/, :message => I18n.t(:invalid_characters, :scope => [:activerecord, :errors, :messages]) + validates_uniqueness_of :attachment_file_name, scope: 'folder_id', message: I18n.t(:exists_already, scope: [:activerecord, :errors, :messages]) + validates_format_of :attachment_file_name, with: /\A[^\/\\\?\*:|"<>]+\z/, message: I18n.t(:invalid_characters, scope: [:activerecord, :errors, :messages]) def copy(target_folder) new_file = self.dup diff --git a/app/views/boxroom/folders/_form.html.erb b/app/views/boxroom/folders/_form.html.erb index 3569ad4..35783a1 100644 --- a/app/views/boxroom/folders/_form.html.erb +++ b/app/views/boxroom/folders/_form.html.erb @@ -8,6 +8,34 @@
<%= f.text_field :name, class: 'input' %>
+ <% if Boxroom.configuration.enable_notifications %> +
+

<%= t :edit_notifications %>

+ <%= f.label :notify_emails, class: 'label' %> +
+ <%= f.text_field :notify_emails, placeholder: t(:notify_emails_list), class: 'input' %> +
+ +
+ +
+
+ +
+
+ +
+
+ <% end %>
diff --git a/app/views/boxroom/folders/show.html.erb b/app/views/boxroom/folders/show.html.erb index f1f8972..ae2a185 100644 --- a/app/views/boxroom/folders/show.html.erb +++ b/app/views/boxroom/folders/show.html.erb @@ -40,6 +40,14 @@ <%= t(:clipboard) %> + <% if boxroom_current_user.can_update(@folder) -%> +
  • + + + <%= t(:edit) %> + +
  • + <% end -%>
    diff --git a/app/views/boxroom/user_file_mailer/notify_create.text.erb b/app/views/boxroom/user_file_mailer/notify_create.text.erb new file mode 100644 index 0000000..51c968c --- /dev/null +++ b/app/views/boxroom/user_file_mailer/notify_create.text.erb @@ -0,0 +1,2 @@ +<%= t 'activerecord.models.folder' %>: <%= @user_file.folder.name %> | <%= folder_url(@user_file.folder) %> +<%= t 'activerecord.models.user_file' %>: <%= @user_file.attachment_file_name %> | <%= file_url(@user_file) %> diff --git a/app/views/boxroom/user_file_mailer/notify_remove.text.erb b/app/views/boxroom/user_file_mailer/notify_remove.text.erb new file mode 100644 index 0000000..1174153 --- /dev/null +++ b/app/views/boxroom/user_file_mailer/notify_remove.text.erb @@ -0,0 +1,2 @@ +<%= t 'activerecord.models.folder' %>: <%= @folder.name %> | <%= folder_url(@folder) %> +<%= t 'activerecord.models.user_file' %>: <%= @file_name %> diff --git a/app/views/boxroom/user_file_mailer/notify_update.text.erb b/app/views/boxroom/user_file_mailer/notify_update.text.erb new file mode 100644 index 0000000..51c968c --- /dev/null +++ b/app/views/boxroom/user_file_mailer/notify_update.text.erb @@ -0,0 +1,2 @@ +<%= t 'activerecord.models.folder' %>: <%= @user_file.folder.name %> | <%= folder_url(@user_file.folder) %> +<%= t 'activerecord.models.user_file' %>: <%= @user_file.attachment_file_name %> | <%= file_url(@user_file) %> diff --git a/app/views/boxroom/user_mailer/reset_password_email.de.text.erb b/app/views/boxroom/user_mailer/reset_password_email.de.text.erb index fea58f9..fd8d3a4 100644 --- a/app/views/boxroom/user_mailer/reset_password_email.de.text.erb +++ b/app/views/boxroom/user_mailer/reset_password_email.de.text.erb @@ -15,4 +15,3 @@ Ihr altes Kennwort ist weiterhin gültig. -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/reset_password_email.en.text.erb b/app/views/boxroom/user_mailer/reset_password_email.en.text.erb index 42c7f35..926f691 100644 --- a/app/views/boxroom/user_mailer/reset_password_email.en.text.erb +++ b/app/views/boxroom/user_mailer/reset_password_email.en.text.erb @@ -14,4 +14,3 @@ Your current password is still valid. -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/reset_password_email.es.text.erb b/app/views/boxroom/user_mailer/reset_password_email.es.text.erb index 150d808..bbde9c1 100644 --- a/app/views/boxroom/user_mailer/reset_password_email.es.text.erb +++ b/app/views/boxroom/user_mailer/reset_password_email.es.text.erb @@ -14,4 +14,3 @@ Sus credenciales seguirán siendo validas. -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/reset_password_email.fr.text.erb b/app/views/boxroom/user_mailer/reset_password_email.fr.text.erb index 296d357..7f59b16 100644 --- a/app/views/boxroom/user_mailer/reset_password_email.fr.text.erb +++ b/app/views/boxroom/user_mailer/reset_password_email.fr.text.erb @@ -14,4 +14,3 @@ Votre mot de passe actuel reste inchangé. -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/reset_password_email.it.text.erb b/app/views/boxroom/user_mailer/reset_password_email.it.text.erb index a22edd5..9d65d64 100644 --- a/app/views/boxroom/user_mailer/reset_password_email.it.text.erb +++ b/app/views/boxroom/user_mailer/reset_password_email.it.text.erb @@ -14,4 +14,3 @@ La password corrente continuerà ad essere valida. -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/reset_password_email.nl.text.erb b/app/views/boxroom/user_mailer/reset_password_email.nl.text.erb index 2003859..fcf632c 100644 --- a/app/views/boxroom/user_mailer/reset_password_email.nl.text.erb +++ b/app/views/boxroom/user_mailer/reset_password_email.nl.text.erb @@ -14,4 +14,3 @@ Uw huidige wachtwoord is nog steeds geldig. -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/reset_password_email.zh-CN.text.erb b/app/views/boxroom/user_mailer/reset_password_email.zh-CN.text.erb index 911d82d..50e8208 100644 --- a/app/views/boxroom/user_mailer/reset_password_email.zh-CN.text.erb +++ b/app/views/boxroom/user_mailer/reset_password_email.zh-CN.text.erb @@ -13,4 +13,3 @@ -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/share_link_email.de.text.erb b/app/views/boxroom/user_mailer/share_link_email.de.text.erb index 2eca673..b00ae69 100644 --- a/app/views/boxroom/user_mailer/share_link_email.de.text.erb +++ b/app/views/boxroom/user_mailer/share_link_email.de.text.erb @@ -17,4 +17,3 @@ Diese URL wird am <%= l @share_link.link_expires_at, :format => :long %> ablaufe -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/share_link_email.en.text.erb b/app/views/boxroom/user_mailer/share_link_email.en.text.erb index 1223d9b..3334e0a 100644 --- a/app/views/boxroom/user_mailer/share_link_email.en.text.erb +++ b/app/views/boxroom/user_mailer/share_link_email.en.text.erb @@ -17,4 +17,3 @@ The URL above will expire at <%= l @share_link.link_expires_at, :format => :time -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/share_link_email.es.text.erb b/app/views/boxroom/user_mailer/share_link_email.es.text.erb index e13eb18..7a9f1e6 100644 --- a/app/views/boxroom/user_mailer/share_link_email.es.text.erb +++ b/app/views/boxroom/user_mailer/share_link_email.es.text.erb @@ -17,4 +17,3 @@ La URL expirará a las <%= l @share_link.link_expires_at, :format => :time_only -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/share_link_email.fr.text.erb b/app/views/boxroom/user_mailer/share_link_email.fr.text.erb index 9b88fa1..934fae1 100644 --- a/app/views/boxroom/user_mailer/share_link_email.fr.text.erb +++ b/app/views/boxroom/user_mailer/share_link_email.fr.text.erb @@ -17,4 +17,3 @@ Le lien ci-dessus expirera à <%= l @share_link.link_expires_at, :format => :tim -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/share_link_email.it.text.erb b/app/views/boxroom/user_mailer/share_link_email.it.text.erb index 0373042..c1fa698 100644 --- a/app/views/boxroom/user_mailer/share_link_email.it.text.erb +++ b/app/views/boxroom/user_mailer/share_link_email.it.text.erb @@ -17,4 +17,3 @@ L'URL indicato sopra scadrà <%= l @share_link.link_expires_at, :format => :long -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/share_link_email.nl.text.erb b/app/views/boxroom/user_mailer/share_link_email.nl.text.erb index 942221f..9e6e00b 100644 --- a/app/views/boxroom/user_mailer/share_link_email.nl.text.erb +++ b/app/views/boxroom/user_mailer/share_link_email.nl.text.erb @@ -17,4 +17,3 @@ De vervaldatum van bovenstaande URL is <%= l @share_link.link_expires_at, :forma -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/share_link_email.zh-CN.text.erb b/app/views/boxroom/user_mailer/share_link_email.zh-CN.text.erb index 84e8728..29b60b0 100644 --- a/app/views/boxroom/user_mailer/share_link_email.zh-CN.text.erb +++ b/app/views/boxroom/user_mailer/share_link_email.zh-CN.text.erb @@ -17,4 +17,3 @@ -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/signup_email.de.text.erb b/app/views/boxroom/user_mailer/signup_email.de.text.erb index 2e1bf07..09f5833 100644 --- a/app/views/boxroom/user_mailer/signup_email.de.text.erb +++ b/app/views/boxroom/user_mailer/signup_email.de.text.erb @@ -6,4 +6,3 @@ This is an invitation to sign up for Boxroom. Please use the following URL to si -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/signup_email.en.text.erb b/app/views/boxroom/user_mailer/signup_email.en.text.erb index 2e1bf07..09f5833 100644 --- a/app/views/boxroom/user_mailer/signup_email.en.text.erb +++ b/app/views/boxroom/user_mailer/signup_email.en.text.erb @@ -6,4 +6,3 @@ This is an invitation to sign up for Boxroom. Please use the following URL to si -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/signup_email.es.text.erb b/app/views/boxroom/user_mailer/signup_email.es.text.erb index 1f4c701..6892b57 100644 --- a/app/views/boxroom/user_mailer/signup_email.es.text.erb +++ b/app/views/boxroom/user_mailer/signup_email.es.text.erb @@ -6,4 +6,3 @@ Esta es una invitacion para activar su cuenta Boxroom. Por favor use la siguient -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/signup_email.fr.text.erb b/app/views/boxroom/user_mailer/signup_email.fr.text.erb index eb2bedf..bde9a6a 100644 --- a/app/views/boxroom/user_mailer/signup_email.fr.text.erb +++ b/app/views/boxroom/user_mailer/signup_email.fr.text.erb @@ -6,4 +6,3 @@ Ceci est un mail d'invitation à Boxroom. Pour vous inscrire, veuillez utiliser -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/signup_email.it.text.erb b/app/views/boxroom/user_mailer/signup_email.it.text.erb index 2e1bf07..09f5833 100644 --- a/app/views/boxroom/user_mailer/signup_email.it.text.erb +++ b/app/views/boxroom/user_mailer/signup_email.it.text.erb @@ -6,4 +6,3 @@ This is an invitation to sign up for Boxroom. Please use the following URL to si -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/signup_email.nl.text.erb b/app/views/boxroom/user_mailer/signup_email.nl.text.erb index 3f5f9d9..e0eb372 100644 --- a/app/views/boxroom/user_mailer/signup_email.nl.text.erb +++ b/app/views/boxroom/user_mailer/signup_email.nl.text.erb @@ -7,4 +7,3 @@ Gebruik onderstaande URL om uw account aan te maken: -- Boxroom -http://boxroomapp.com/ diff --git a/app/views/boxroom/user_mailer/signup_email.zh-CN.text.erb b/app/views/boxroom/user_mailer/signup_email.zh-CN.text.erb index 151e25a..dcf0b61 100644 --- a/app/views/boxroom/user_mailer/signup_email.zh-CN.text.erb +++ b/app/views/boxroom/user_mailer/signup_email.zh-CN.text.erb @@ -5,4 +5,3 @@ <%= edit_signup_url(@user.signup_token) %> -- Boxroom -http://boxroomapp.com/ diff --git a/config/locales/de.yml b/config/locales/de.yml index ebe206d..e95e315 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -265,6 +265,12 @@ de: #folders/edit rename_folder: Ordner umbenennen + edit_notifications: Benachrichtigungen bearbeiten + notify_emails_list: Liste der durch Komma getrennten E-Mails + notify_create: Benachrichtigen Sie Erstellen + notify_update: Aktualisierung benachrichtigen + notify_remove: Benachrichtigen Entfernen + #folders/new new_folder: Neuen Ordner anlegen @@ -281,7 +287,7 @@ de: add_to_clipboard: Zur Zwischenablage hinzufügen download: Herunterladen share: Freigeben - search: Search files and folders inside current folder... Press Enter to search + search: Suchen Sie Dateien und Ordner im aktuellen Ordner ... Drücken Sie die Eingabetaste, um zu suchen #groups/edit rename_group: Gruppe umbenennen @@ -412,3 +418,8 @@ de: signup_email_subject: '[Boxroom] Sign up invitation' reset_password_email_subject: '[Boxroom] Anleitung zum Ändern Ihres Kennworts' share_link_email_subject: '[Boxroom] %{email} möchte Ihnen eine Datei freigeben' + + # mailers/user_file_mailer + file_added: '[Boxroom] Neue Datei wurde zum Ordner hinzugefügt' + file_updated: '[Boxroom] Die Datei wurde im Ordner aktualisiert' + file_removed: '[Boxroom] Die Datei wurde aus dem Ordner entfernt' \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 3147de2..3df2669 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -258,6 +258,11 @@ #folders/edit rename_folder: Rename folder + edit_notifications: Edit Notifications + notify_emails_list: List of comma separated emails + notify_create: Notify Create + notify_update: Notify Update + notify_remove: Notify Remove #folders/new new_folder: New folder @@ -405,3 +410,8 @@ signup_email_subject: '[Boxroom] Sign up invitation' reset_password_email_subject: '[Boxroom] Password reset instructions' share_link_email_subject: '[Boxroom] %{email} shared a file with you' + + # mailers/user_file_mailer + file_added: '[Boxroom] New file was added to folder' + file_updated: '[Boxroom] File was updated in folder' + file_removed: '[Boxroom] File was removed from folder' diff --git a/config/locales/es.yml b/config/locales/es.yml index 22cd7cc..371daea 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -257,6 +257,11 @@ #folders/edit rename_folder: Renombrar Carpeta + edit_notifications: Editar notificaciones + notify_emails_list: Lista de correos electrónicos separados por comas + notify_create: Notificar Crear + notify_update: Notificar actualización + notify_remove: Notificar Eliminar #folders/new new_folder: Nueva Carpeta @@ -273,7 +278,7 @@ add_to_clipboard: Agregar al portapapeles download: Descargar share: Compartir - search: Search files and folders inside current folder... Press Enter to search + search: Buscar archivos y carpetas dentro de la carpeta actual ... Presione Entrar para buscar #groups/edit rename_group: Renombrar grupo @@ -401,3 +406,8 @@ signup_email_subject: 'Invitación al Sistema de Gestión de Archivos' reset_password_email_subject: 'Gestión de Archivos: cambio de claves' share_link_email_subject: 'Gestión de Archivos: se le ha compartido un enlace' + + # mailers/user_file_mailer + file_added: '[Boxroom] Nuevo archivo fue agregado a la carpeta' + file_updated: '[Boxroom] El archivo se actualizó en la carpeta' + file_removed: '[Boxroom] El archivo fue eliminado de la carpeta' \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 8b0c7ea..01a1d37 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -254,6 +254,11 @@ #folders/edit rename_folder: Renommer dossier + edit_notifications: Modifier les notifications + notify_emails_list: Liste des courriels séparés par des virgules + notify_create: Notifier Créer + notify_update: Avertir mise à + notify_remove: Notifier Supprimer #folders/new new_folder: Nouveau dossier @@ -270,7 +275,7 @@ add_to_clipboard: Ajouter au presse-papier download: Télécharger share: Partager - search: Search files and folders inside current folder... Press Enter to search + search: Rechercher des fichiers et des dossiers dans le dossier actuel ... Appuyez sur Entrée pour rechercher #groups/edit rename_group: Renommer groupe @@ -401,3 +406,8 @@ signup_email_subject: '[Boxroom] Invitiation à créer un compte' reset_password_email_subject: '[Boxroom] Instructions de réinitialisation mot de passe' share_link_email_subject: "[Boxroom] %{email} a partagé un fichier avec vous" + + # mailers/user_file_mailer + file_added: '[Boxroom] Nouveau fichier a été ajouté au dossier' + file_updated: '[Boxroom] Le fichier a été mis à jour dans le dossier' + file_removed: '[Boxroom] Le fichier a été supprimé du dossier' \ No newline at end of file diff --git a/config/locales/it.yml b/config/locales/it.yml index 8111c92..c66e733 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -265,6 +265,11 @@ #folders/edit rename_folder: Rinomina cartella + edit_notifications: Modifica notifiche + notify_emails_list: Elenco di e-mail separate da virgole + notify_create: Notifica Crea + notify_update: Notifica aggiornamento + notify_remove: Notifica Rimuovi #folders/new new_folder: Nuova cartella @@ -281,7 +286,7 @@ add_to_clipboard: Copia negli appunti download: Scarica share: Condividi - search: Search files and folders inside current folder... Press Enter to search + search: Cerca file e cartelle all'interno della cartella corrente ... Premi Invio per cercare #groups/edit rename_group: Rinomina gruppo @@ -412,3 +417,8 @@ signup_email_subject: '[Boxroom] Sign up invitation' share_link_email_subject: '[Boxroom] %{email} ha condiviso un file con te' reset_password_email_subject: '[Boxroom] Istruzioni per modificare la password' + + # mailers/user_file_mailer + file_added: '[Boxroom] Nuovo file è stato aggiunto alla cartella' + file_updated: '[Boxroom] Il file è stato aggiornato nella cartella' + file_removed: '[Boxroom] Il file è stato rimosso dalla cartella' \ No newline at end of file diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 8f07cfd..b56b44e 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -259,6 +259,11 @@ nl: #folders/edit rename_folder: Mapnaam wijzigen + edit_notifications: Bewerk meldingen + notify_emails_list: Lijst met door komma's gescheiden e-mails + notify_create: Notificeer Create + notify_update: Breng update op de hoogte + notify_remove: Verwittig Verwijderen #folders/new new_folder: Nieuwe map @@ -275,7 +280,7 @@ nl: add_to_clipboard: Op klembord plaatsen download: Download share: Delen - search: Search files and folders inside current folder... Press Enter to search + search: Zoek bestanden en mappen in de huidige map ... Druk op Enter om te zoeken #groups/edit rename_group: Groepnaam wijzigen @@ -406,3 +411,8 @@ nl: signup_email_subject: '[Boxroom] Uitnodiging om aan te melden' reset_password_email_subject: '[Boxroom] Instructies om uw wachtwoord te resetten' share_link_email_subject: '[Boxroom] %{email} heeft een bestand met u gedeeld' + + # mailers/user_file_mailer + file_added: '[Boxroom] Nieuw bestand toegevoegd aan map' + file_updated: '[Boxroom] Bestand is in map bijgewerk' + file_removed: '[Boxroom] Bestand is uit de map verwijderd' \ No newline at end of file diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 2e23d87..a12a273 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -257,6 +257,11 @@ #folders/edit rename_folder: 重新命名文件夹 + edit_notifications: 编辑通知 + notify_emails_list: 用逗号分隔的电子邮件列表 + notify_create: 通知创建 + notify_update: 通知更新 + notify_remove: 通知删除 #folders/new new_folder: 新文件夹 @@ -273,7 +278,7 @@ add_to_clipboard: 加到剪贴板 download: 下载 share: 共享 - search: Search files and folders inside current folder... Press Enter to search + search: 搜索当前文件夹内的文件和文件夹...按Enter键搜索 #groups/edit rename_group: 群组重新命名 @@ -404,3 +409,8 @@ signup_email_subject: '[Boxroom] 注册邀请' reset_password_email_subject: '[Boxroom] 重设密码的步骤' share_link_email_subject: '[Boxroom] %{email}与您共享了文件' + + # mailers/user_file_mailer + file_added: '[Boxroom] 新文件已添加到文件夹' + file_updated: '[Boxroom] 文件已在文件夹中更新' + file_removed: '[Boxroom] 文件已从文件夹中删除' \ No newline at end of file diff --git a/db/migrate/20180309104530_add_original_id_to_users.rb b/db/migrate/20180309104530_boxroom_add_original_id_to_users.rb similarity index 54% rename from db/migrate/20180309104530_add_original_id_to_users.rb rename to db/migrate/20180309104530_boxroom_add_original_id_to_users.rb index aa8da54..f12618c 100644 --- a/db/migrate/20180309104530_add_original_id_to_users.rb +++ b/db/migrate/20180309104530_boxroom_add_original_id_to_users.rb @@ -1,4 +1,4 @@ -class AddOriginalIdToUsers < ActiveRecord::Migration[5.1] +class BoxroomAddOriginalIdToUsers < ActiveRecord::Migration[5.1] def change add_column :boxroom_users, :original_id, :integer end diff --git a/db/migrate/20180323134701_boxroom_add_notifications_to_folders.rb b/db/migrate/20180323134701_boxroom_add_notifications_to_folders.rb new file mode 100644 index 0000000..d297597 --- /dev/null +++ b/db/migrate/20180323134701_boxroom_add_notifications_to_folders.rb @@ -0,0 +1,10 @@ +class BoxroomAddNotificationsToFolders < ActiveRecord::Migration[5.1] + def change + change_table :boxroom_folders do |t| + t.string :notify_emails + t.boolean :notify_create + t.boolean :notify_update + t.boolean :notify_remove + end + end +end diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..444ff4d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.4' + +services: + mailcatcher: + image: schickling/mailcatcher + ports: + - '1080:1080' + - '1025:1025' \ No newline at end of file diff --git a/lib/boxroom/configuration.rb b/lib/boxroom/configuration.rb index 91e6537..b905530 100644 --- a/lib/boxroom/configuration.rb +++ b/lib/boxroom/configuration.rb @@ -8,6 +8,7 @@ class Configuration :show_settings, :show_shared_files, :show_search, + :enable_notifications, :uploads_path, :current_user_method, :sign_in_path, @@ -15,15 +16,16 @@ class Configuration :parent_controller def initialize - @site_name = 'Boxroom' - @logo = 'boxroom/logo.png' - @show_footer = true - @show_users = true - @show_groups = true - @show_settings = true - @show_shared_files = true - @show_search = true - @uploads_path = 'uploads' + @site_name = 'Boxroom' + @logo = 'boxroom/logo.png' + @show_footer = true + @show_users = true + @show_groups = true + @show_settings = true + @show_shared_files = true + @show_search = true + @enable_notifications = true + @uploads_path = 'uploads' # Integrate with existing user model @current_user_method = nil diff --git a/lib/boxroom/version.rb b/lib/boxroom/version.rb index fb3fc6f..ecc920e 100644 --- a/lib/boxroom/version.rb +++ b/lib/boxroom/version.rb @@ -1,3 +1,3 @@ module Boxroom - VERSION = '0.0.4' + VERSION = '0.0.5' end