diff --git a/after_init.rb b/after_init.rb index 7b963d7e..a868864e 100644 --- a/after_init.rb +++ b/after_init.rb @@ -29,62 +29,62 @@ ActiveSupport::Dependencies.autoload_paths << File.join(File.dirname(__FILE__), def dmsf_init # Administration menu extension Redmine::MenuManager.map :admin_menu do |menu| - menu.push :dmsf_approvalworkflows, :dmsf_workflows_path, :caption => :label_dmsf_workflow_plural, - :html => { :class => 'icon icon-approvalworkflows' }, :if => Proc.new { |_| User.current.admin? } + menu.push :dmsf_approvalworkflows, :dmsf_workflows_path, caption: :label_dmsf_workflow_plural, + html: { class: 'icon icon-approvalworkflows' }, if: Proc.new { |_| User.current.admin? } end Redmine::MenuManager.map :project_menu do |menu| - menu.push :dmsf, { :controller => 'dmsf', :action => 'show' }, :caption => :menu_dmsf, :before => :documents, - :param => :id + menu.push :dmsf, { controller: 'dmsf', action: 'show' }, caption: :menu_dmsf, before: :documents, + param: :id end # Permissions Redmine::AccessControl.map do |map| map.project_module :dmsf do |pmap| pmap.permission :view_dmsf_file_revision_accesses, - :read => true + read: true pmap.permission :view_dmsf_file_revisions, - :read => true + read: true pmap.permission :view_dmsf_folders, - {:dmsf => [:show]}, - :read => true + { dmsf: [:show] }, + read: true pmap.permission :user_preferences, { dmsf_state: [:user_pref_save] } pmap.permission :view_dmsf_files, - {:dmsf => [:entries_operation, :entries_email, :download_email_entries, :tag_changed, :add_email, + { dmsf: [:entries_operation, :entries_email, :download_email_entries, :tag_changed, :add_email, :append_email, :autocomplete_for_user], - :dmsf_files => [:show, :view, :thumbnail], - :dmsf_workflows => [:log]}, - :read => true + dmsf_files: [:show, :view, :thumbnail], + dmsf_workflows: [:log] }, + read: true pmap.permission :email_documents, - {:dmsf_public_urls => [:create]} + { dmsf_public_urls: [:create] } pmap.permission :folder_manipulation, { dmsf: [:new, :create, :delete, :edit, :save, :edit_root, :save_root, :lock, :unlock, :notify_activate, :notify_deactivate, :restore, :drop], - :dmsf_folder_permissions => [:new, :append, :autocomplete_for_user], - :dmsf_folders_copy => [:new, :copy, :move], - :dmsf_context_menus => [:dmsf]} + dmsf_folder_permissions: [:new, :append, :autocomplete_for_user], + dmsf_folders_copy: [:new, :copy, :move], + dmsf_context_menus: [:dmsf] } pmap.permission :file_manipulation, - {:dmsf_files => [:create_revision, :lock, :unlock, :delete_revision, :obsolete_revision, + { dmsf_files: [:create_revision, :lock, :unlock, :delete_revision, :obsolete_revision, :notify_activate, :notify_deactivate, :restore], - :dmsf_upload => [:upload_files, :upload_file, :upload, :commit_files, :commit, + dmsf_upload: [:upload_files, :upload_file, :upload, :commit_files, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment, :multi_upload], - :dmsf_links => [:new, :create, :destroy, :restore, :autocomplete_for_project, + dmsf_links: [:new, :create, :destroy, :restore, :autocomplete_for_project, :autocomplete_for_folder], - :dmsf_files_copy => [:new, :copy, :move], - :dmsf_context_menus => [:dmsf]} + dmsf_files_copy: [:new, :copy, :move], + dmsf_context_menus: [:dmsf]} pmap.permission :file_delete, - {:dmsf => [:trash, :delete_entries], - :dmsf_files => [:delete], - :dmsf_trash_context_menus => [:trash]} + { dmsf: [:trash, :delete_entries], + dmsf_files: [:delete], + dmsf_trash_context_menus: [:trash] } pmap.permission :force_file_unlock, {} pmap.permission :file_approval, - {:dmsf_workflows => [:action, :new_action, :autocomplete_for_user, :start, :assign, :assignment]} + { dmsf_workflows: [:action, :new_action, :autocomplete_for_user, :start, :assign, :assignment] } pmap.permission :manage_workflows, - {:dmsf_workflows => [:index, :new, :create, :destroy, :show, :new_step, :add_step, :remove_step, - :reorder_steps, :update, :update_step, :delete_step, :edit]} + { dmsf_workflows: [:index, :new, :create, :destroy, :show, :new_step, :add_step, :remove_step, + :reorder_steps, :update, :update_step, :delete_step, :edit] } pmap.permission :display_system_folders, - :read => true + read: true end end end @@ -96,8 +96,8 @@ if Redmine::Plugin.installed?(:easy_extensions) require File.expand_path('../app/models/easy_page_modules/easy_dms/epm_dmsf_locked_documents', __FILE__) require File.expand_path('../app/models/easy_page_modules/easy_dms/epm_dmsf_open_approvals', __FILE__) - EpmDmsfLockedDocuments.register_to_scope(:user, :plugin => :redmine_dmsf) - EpmDmsfOpenApprovals.register_to_scope(:user, :plugin => :redmine_dmsf) + EpmDmsfLockedDocuments.register_to_scope(:user, plugin: :redmine_dmsf) + EpmDmsfOpenApprovals.register_to_scope(:user, plugin: :redmine_dmsf) end else dmsf_init @@ -108,15 +108,15 @@ RedmineExtensions::Reloader.to_prepare do Zip.unicode_names = true # DMS custom fields - CustomFieldsHelper::CUSTOM_FIELDS_TABS << { :name => 'DmsfFileRevisionCustomField', :partial => 'custom_fields/index', - :label => :dmsf } + CustomFieldsHelper::CUSTOM_FIELDS_TABS << { name: 'DmsfFileRevisionCustomField', partial: 'custom_fields/index', + label: :dmsf } Redmine::Search.map do |search| search.register :dmsf_files search.register :dmsf_folders end - Redmine::Activity.register :dmsf_file_revision_accesses, :default => false + Redmine::Activity.register :dmsf_file_revision_accesses, default: false Redmine::Activity.register :dmsf_file_revisions # Uncomment to remove the original Documents from searching and project's modules (replaced with DMSF) diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 11b43b6f..4352d76c 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -25,15 +25,13 @@ class DmsfController < ApplicationController include RedmineDmsf::DmsfZip before_action :find_project - before_action :authorize, :except => [:expand_folder, :exp_folder] - before_action :find_folder, :except => [:new, :create, :edit_root, :save_root, :add_email, :append_email, + before_action :authorize, except: [:expand_folder] + before_action :find_folder, except: [:new, :create, :edit_root, :save_root, :add_email, :append_email, :autocomplete_for_user] - before_action :find_parent, :only => [:new, :create] - before_action :tree_view, :only => [:delete, :show] + before_action :find_parent, only: [:new, :create] before_action :permissions - # also try to lookup folder by title if this is API call - before_action :find_folder_by_title, :only => [:show], :if => :api_request? + before_action :find_folder_by_title, only: [:show] accept_api_auth :show, :create, :save, :delete @@ -48,16 +46,6 @@ class DmsfController < ApplicationController end def expand_folder - @tree_view = true - get_display_params - @idnt = params[:idnt].present? ? params[:idnt].to_i + 1 : 0 - @pos = params[:pos].present? ? params[:pos].to_f : 0.0 - respond_to do |format| - format.js { render :action => 'dmsf_rows' } - end - end - - def exp_folder @idnt = params[:idnt].present? ? params[:idnt].to_i + 1 : 0 @query = retrieve_query(DmsfQuery, true) @query.dmsf_folder_id = @folder.id @@ -89,11 +77,7 @@ class DmsfController < ApplicationController } format.api format.csv { - filename = @project.name - filename << "_#{@folder.title}" if @folder - filename << DateTime.current.strftime('_%Y%m%d%H%M%S.csv') - send_data(DmsfHelper.dmsf_to_csv(@folder ? @folder : @project, params[:settings][:dmsf_columns]), - type: 'text/csv; header=present', filename: filename) + send_data query_to_csv(@query.dmsf_nodes, @query), type: 'text/csv; header=present', filename: 'dmsf.csv' } end end @@ -202,13 +186,13 @@ class DmsfController < ApplicationController File.delete(params[:email][:zipped_content]) flash[:notice] = l(:notice_email_sent, params[:email][:to]) end - redirect_to dmsf_folder_path(:id => @project, :folder_id => @folder) + redirect_to dmsf_folder_path(id: @project, folder_id: @folder) end def new @folder = DmsfFolder.new @pathfolder = @parent - render :action => 'edit' + render action: 'edit' end def edit @@ -279,10 +263,10 @@ class DmsfController < ApplicationController end respond_to do |format| format.html do - if commit || @tree_view + if commit redirect_to :back else - redirect_to dmsf_folder_path(:id => @project, :folder_id => @folder.dmsf_folder) + redirect_to dmsf_folder_path(id: @project, folder_id: @folder.dmsf_folder) end end format.api { result ? render_api_ok : render_validation_errors(@folder) } @@ -310,7 +294,7 @@ class DmsfController < ApplicationController flash[:error] = @project.errors.full_messages.to_sentence end end - redirect_to dmsf_folder_path(:id => @project) + redirect_to dmsf_folder_path(id: @project) end def notify_activate @@ -405,13 +389,13 @@ class DmsfController < ApplicationController when 'folder' dmsf_folder = DmsfFolder.find_by(id: id) if dmsf_folder - dmsf_folder.dmsf_folder_id = $1; + dmsf_folder.dmsf_folder_id = $1 result = dmsf_folder.save end when 'file-link', 'folder-link', 'url-link' dmsf_link = DmsfLink.find_by(id: id) if dmsf_link - dmsf_link.dmsf_folder_id = $1; + dmsf_link.dmsf_folder_id = $1 result = dmsf_link.save end end @@ -453,15 +437,15 @@ class DmsfController < ApplicationController end @email_params = { - :zipped_content => zipped_content, - :folders => selected_folders, - :files => selected_files, - :subject => "#{@project.name} #{l(:label_dmsf_file_plural).downcase}", - :from => Setting.plugin_redmine_dmsf['dmsf_documents_email_from'].presence || + zipped_content: zipped_content, + folders: selected_folders, + files: selected_files, + subject: "#{@project.name} #{l(:label_dmsf_file_plural).downcase}", + from: Setting.plugin_redmine_dmsf['dmsf_documents_email_from'].presence || "#{User.current.name} <#{User.current.mail}>", - :reply_to => Setting.plugin_redmine_dmsf['dmsf_documents_email_reply_to'] + reply_to: Setting.plugin_redmine_dmsf['dmsf_documents_email_reply_to'] } - render :action => 'email_entries' + render action: 'email_entries' rescue Exception raise ensure @@ -479,9 +463,9 @@ class DmsfController < ApplicationController audit.save! end send_file(zip.finish, - :filename => filename_for_content_disposition("#{@project.name}-#{DateTime.current.strftime('%y%m%d%H%M%S')}.zip"), - :type => 'application/zip', - :disposition => 'attachment') + filename: filename_for_content_disposition("#{@project.name}-#{DateTime.current.strftime('%y%m%d%H%M%S')}.zip"), + type: 'application/zip', + disposition: 'attachment') rescue StandardError raise ensure @@ -589,7 +573,7 @@ class DmsfController < ApplicationController if recipients.any? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, :to => to) + flash[:warning] = l(:warning_email_notifications, to: to) end end rescue => e @@ -597,7 +581,8 @@ class DmsfController < ApplicationController end end unless not_deleted_files.empty? - flash[:warning] = l(:warning_some_entries_were_not_deleted, :entries => not_deleted_files.map{|e| e.title}.join(', ')) + flash[:warning] = l(:warning_some_entries_were_not_deleted, entries: not_deleted_files.map{ |f| f.title }. + join(', ')) end # Links selected_dir_links.each do |id| @@ -624,7 +609,7 @@ class DmsfController < ApplicationController end def find_folder_by_title - if !@folder && params[:folder_title].present? + if api_request? && !@folder && params[:folder_title].present? @folder = DmsfFolder.find_by(title: params[:folder_title], project_id: @project.id) render_404 unless @folder end @@ -636,11 +621,6 @@ class DmsfController < ApplicationController render_404 end - def tree_view - tag = params[:custom_field_id].present? && params[:custom_value].present? - @tree_view = (User.current.pref.dmsf_tree_view == '1') && (!%w(atom xml json).include?(params[:format])) && !tag - end - def copy_folder(folder) copy = folder.clone copy.id = folder.id diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index ac62f908..5ca5f120 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -24,10 +24,9 @@ class DmsfFilesController < ApplicationController menu_item :dmsf - before_action :find_file, :except => [:delete_revision, :obsolete_revision] - before_action :find_revision, :only => [:delete_revision, :obsolete_revision] + before_action :find_file, except: [:delete_revision, :obsolete_revision] + before_action :find_revision, only: [:delete_revision, :obsolete_revision] before_action :authorize - before_action :tree_view, :only => [:delete] before_action :permissions accept_api_auth :show, :view, :delete @@ -70,9 +69,9 @@ class DmsfFilesController < ApplicationController # IE has got a tendency to cache files expires_in(0.year, 'must-revalidate' => true) send_file(@revision.disk_file, - :filename => filename_for_content_disposition(@revision.formatted_name(title_format)), - :type => @revision.detect_content_type, - :disposition => @revision.dmsf_file.disposition) + filename: filename_for_content_disposition(@revision.formatted_name(title_format)), + type: @revision.detect_content_type, + disposition: @revision.dmsf_file.disposition) rescue DmsfAccessError => e Rails.logger.error e.message render_403 @@ -94,7 +93,7 @@ class DmsfFilesController < ApplicationController respond_to do |format| format.html { - render :layout => !request.xhr? + render layout: !request.xhr? } format.api end @@ -186,7 +185,7 @@ class DmsfFilesController < ApplicationController if recipients.any? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, :to => to) + flash[:warning] = l(:warning_email_notifications, to: to) end end rescue => e @@ -216,7 +215,7 @@ class DmsfFilesController < ApplicationController if recipients.any? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, :to => to) + flash[:warning] = l(:warning_email_notifications, to: to) end end rescue => e @@ -231,11 +230,7 @@ class DmsfFilesController < ApplicationController end respond_to do |format| format.html do - if commit || (@tree_view && params[:details].blank?) - redirect_to :back - else - redirect_to dmsf_folder_path(:id => @project, :folder_id => @file.dmsf_folder) - end + redirect_to dmsf_folder_path(id: @project, folder_id: @file.dmsf_folder) end format.api { result ? render_api_ok : render_validation_errors(@file) } end @@ -332,9 +327,9 @@ class DmsfFilesController < ApplicationController if @file.image? && tbnail = @file.thumbnail(:size => params[:size]) if stale?(:etag => tbnail) send_file tbnail, - :filename => filename_for_content_disposition(@file.last_revision.disk_file), - :type => @file.last_revision.detect_content_type, - :disposition => 'inline' + filename: filename_for_content_disposition(@file.last_revision.disk_file), + type: @file.last_revision.detect_content_type, + disposition: 'inline' end else head 404 @@ -364,9 +359,4 @@ class DmsfFilesController < ApplicationController end end - def tree_view - tag = params[:custom_field_id].present? && params[:custom_value].present? - @tree_view = (User.current.pref.dmsf_tree_view == '1') && (!%w(atom xml json).include?(params[:format])) && !tag - end - end \ No newline at end of file diff --git a/app/controllers/dmsf_files_copy_controller.rb b/app/controllers/dmsf_files_copy_controller.rb index a58cc083..40ef11eb 100644 --- a/app/controllers/dmsf_files_copy_controller.rb +++ b/app/controllers/dmsf_files_copy_controller.rb @@ -27,21 +27,20 @@ class DmsfFilesCopyController < ApplicationController before_action :find_file before_action :authorize before_action :find_target_folder - before_action :check_target_folder, :only => [:copy, :move] + before_action :check_target_folder, only: [:copy, :move] def new @projects = DmsfFile.allowed_target_projects_on_copy @folders = DmsfFolder.directory_tree(@target_project, @folder) @target_folder = DmsfFolder.visible.find(params[:target_folder_id]) unless params[:target_folder_id].blank? - render :layout => !request.xhr? + render layout: !request.xhr? end def copy new_file = @file.copy_to(@target_project, @target_folder) unless new_file.errors.empty? flash[:error] = new_file.errors.full_messages.to_sentence - redirect_to :action => 'new', :id => @file, :target_project_id => @target_project, - :target_folder_id => @target_folder + redirect_to action: 'new', id: @file, target_project_id: @target_project, target_folder_id: @target_folder return end flash[:notice] = l(:notice_successful_update) @@ -51,8 +50,7 @@ class DmsfFilesCopyController < ApplicationController def move unless @file.move_to(@target_project, @target_folder) flash[:error] = @file.errors.full_messages.to_sentence - redirect_to :action => 'new', :id => @file, :target_project_id => @target_project, - :target_folder_id => @target_folder + redirect_to action: 'new', id: @file, target_project_id: @target_project, target_folder_id: @target_folder return end flash[:notice] = l(:notice_successful_update) @@ -93,8 +91,7 @@ private if (@target_folder && @target_folder == @file.dmsf_folder) || (@target_folder.nil? && @file.dmsf_folder.nil? && @target_project == @file.project) flash[:error] = l(:error_target_folder_same) - redirect_to :action => :new, :id => @file, :target_project_id => @target_project.id, - :target_folder_id => @target_folder + redirect_to action: :new, id: @file, target_project_id: @target_project.id, target_folder_id: @target_folder return end if (@target_folder && (@target_folder.locked_for_user? || !DmsfFolder.permissions?(@target_folder, false))) || diff --git a/app/controllers/dmsf_folders_copy_controller.rb b/app/controllers/dmsf_folders_copy_controller.rb index 9d54e40b..53b26b52 100644 --- a/app/controllers/dmsf_folders_copy_controller.rb +++ b/app/controllers/dmsf_folders_copy_controller.rb @@ -27,25 +27,24 @@ class DmsfFoldersCopyController < ApplicationController before_action :find_folder before_action :authorize before_action :find_target_folder - before_action :check_target_folder, :only => [:copy, :move] + before_action :check_target_folder, only: [:copy, :move] def new @projects = DmsfFolder.allowed_target_projects_on_copy @folders = DmsfFolder.directory_tree(@target_project, @folder) @target_folder = DmsfFolder.visible.find(params[:target_folder_id]) unless params[:target_folder_id].blank? - render :layout => !request.xhr? + render layout: !request.xhr? end def copy new_folder = @folder.copy_to(@target_project, @target_folder) unless new_folder.errors.empty? flash[:error] = new_folder.errors.full_messages.to_sentence - redirect_to :action => 'new', :id => @folder, :target_project_id => @target_project, - :target_folder_id => @target_folder + redirect_to action: 'new', id: @folder, target_project_id: @target_project, target_folder_id: @target_folder return end flash[:notice] = l(:notice_successful_update) - redirect_to dmsf_folder_path(:id => @target_project, :folder_id => new_folder) + redirect_to dmsf_folder_path(id: @target_project, folder_id: new_folder) end def move @@ -53,11 +52,10 @@ class DmsfFoldersCopyController < ApplicationController @folder.dmsf_folder = @target_folder if @folder.save flash[:notice] = l(:notice_successful_update) - redirect_to dmsf_folder_path(:id => @target_project, :folder_id => @folder) + redirect_to dmsf_folder_path(id: @target_project, folder_id: @folder) else flash[:error] = @folder.errors.full_messages.to_sentence - redirect_to :action => 'new', :id => @folder, :target_project_id => @target_project, - :target_folder_id => @target_folder + redirect_to action: 'new', id: @folder, target_project_id: @target_project, target_folder_id: @target_folder end end @@ -95,8 +93,7 @@ class DmsfFoldersCopyController < ApplicationController if (@target_folder && @target_folder == @folder.dmsf_folder) || (@target_folder.nil? && @folder.dmsf_folder.nil? && @target_project == @folder.project) flash[:error] = l(:error_target_folder_same) - redirect_to :action => :new, :id => @folder, :target_project_id => @target_project.id, - :target_folder_id => @target_folder + redirect_to action: :new, id: @folder, target_project_id: @target_project.id, target_folder_id: @target_folder return end if (@target_folder && (@target_folder.locked_for_user? || !DmsfFolder.permissions?(@target_folder, false))) || diff --git a/app/controllers/dmsf_links_controller.rb b/app/controllers/dmsf_links_controller.rb index 6bb20509..344f02f9 100644 --- a/app/controllers/dmsf_links_controller.rb +++ b/app/controllers/dmsf_links_controller.rb @@ -23,7 +23,7 @@ class DmsfLinksController < ApplicationController model_object DmsfLink - before_action :find_model_object, :only => [:destroy, :restore] + before_action :find_model_object, only: [:destroy, :restore] before_action :find_link_project before_action :authorize before_action :permissions @@ -150,12 +150,12 @@ class DmsfLinksController < ApplicationController respond_to do |format| format.html { if params[:dmsf_link][:type] == 'link_from' - redirect_to dmsf_folder_path(:id => @project.id, :folder_id => @dmsf_link.dmsf_folder_id) + redirect_to dmsf_folder_path(id: @project.id, folder_id: @dmsf_link.dmsf_folder_id) else if params[:dmsf_link][:dmsf_file_id].present? redirect_to dmsf_file_path(@dmsf_link.target_file) else - redirect_to edit_dmsf_path(:id => params[:dmsf_link][:project_id], :folder_id => params[:dmsf_link][:dmsf_folder_id]) + redirect_to edit_dmsf_path(id: params[:dmsf_link][:project_id], folder_id: params[:dmsf_link][:dmsf_folder_id]) end end } diff --git a/app/controllers/dmsf_public_urls_controller.rb b/app/controllers/dmsf_public_urls_controller.rb index 5a4f6244..087d6094 100644 --- a/app/controllers/dmsf_public_urls_controller.rb +++ b/app/controllers/dmsf_public_urls_controller.rb @@ -22,8 +22,8 @@ class DmsfPublicUrlsController < ApplicationController model_object DmsfPublicUrl - before_action :authorize, :only => [:create] - skip_before_action :check_if_login_required, :only => [:show] + before_action :authorize, only: [:create] + skip_before_action :check_if_login_required, only: [:show] def show dmsf_public_url = DmsfPublicUrl.where('token = ? AND expire_at >= ?', params[:token], DateTime.current).first @@ -31,11 +31,11 @@ class DmsfPublicUrlsController < ApplicationController revision = dmsf_public_url.dmsf_file.last_revision begin # IE has got a tendency to cache files - expires_in(0.year, "must-revalidate" => true) + expires_in(0.year, 'must-revalidate' => true) send_file(revision.disk_file, - :filename => filename_for_content_disposition(revision.name), - :type => revision.detect_content_type, - :disposition => dmsf_public_url.dmsf_file.disposition) + filename: filename_for_content_disposition(revision.name), + type: revision.detect_content_type, + disposition: dmsf_public_url.dmsf_file.disposition) rescue => e Rails.logger.error e.message render_404 diff --git a/app/controllers/dmsf_state_controller.rb b/app/controllers/dmsf_state_controller.rb index b8ae9d41..ba01ccad 100644 --- a/app/controllers/dmsf_state_controller.rb +++ b/app/controllers/dmsf_state_controller.rb @@ -44,7 +44,7 @@ class DmsfStateController < ApplicationController if Setting.plugin_redmine_dmsf['dmsf_act_as_attachable'] @project.update_attribute :dmsf_act_as_attachable, params[:act_as_attachable] end - redirect_to settings_project_path(@project, :tab => 'dmsf') + redirect_to settings_project_path(@project, tab: 'dmsf') end private diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index 335ac516..6049f554 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -24,11 +24,13 @@ class DmsfUploadController < ApplicationController menu_item :dmsf - before_action :find_project, :except => [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment] - before_action :authorize, :except => [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment] - before_action :authorize_global, :only => [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment] - before_action :find_folder, :except => [:upload_file, :upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment] - before_action :permissions, :except => [:upload_file, :upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment] + before_action :find_project, except: [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment] + before_action :authorize, except: [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment] + before_action :authorize_global, only: [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment] + before_action :find_folder, except: [:upload_file, :upload, :commit, :delete_dmsf_attachment, + :delete_dmsf_link_attachment] + before_action :permissions, except: [:upload_file, :upload, :commit, :delete_dmsf_attachment, + :delete_dmsf_link_attachment] helper :all helper :dmsf_workflows @@ -49,14 +51,6 @@ class DmsfUploadController < ApplicationController upload = DmsfUpload.create_from_uploaded_attachment(@project, @folder, uploaded_file) @uploads.push(upload) if upload end - else - # plupload multi upload completed - uploaded = params[:uploaded] - if uploaded - uploaded.each do |_, uploaded_file| - @uploads.push(DmsfUpload.new(@project, @folder, uploaded_file)) - end - end end if @uploads.empty? flash.now[:error] = l(:label_attachment) + ' ' + l('activerecord.errors.messages.invalid') @@ -81,7 +75,7 @@ class DmsfUploadController < ApplicationController f.write(@tempfile) end end - render :layout => false + render layout: false end # REST API and Redmine attachment form @@ -91,7 +85,7 @@ class DmsfUploadController < ApplicationController return end - @attachment = Attachment.new(:file => request.raw_post) + @attachment = Attachment.new(file: request.raw_post) @attachment.author = User.current @attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16) @attachment.content_type = params[:content_type].presence @@ -101,7 +95,7 @@ class DmsfUploadController < ApplicationController format.js format.api { if saved - render :action => 'upload', :status => :created + render action: 'upload', status: :created else render_validation_errors(@attachment) end @@ -154,7 +148,7 @@ class DmsfUploadController < ApplicationController respond_to do |format| format.js format.api { render_validation_errors(failed_uploads) unless failed_uploads.empty? } - format.html { redirect_to dmsf_folder_path(:id => @project, :folder_id => @folder) } + format.html { redirect_to dmsf_folder_path(id: @project, folder_id: @folder) } end end diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb index d47d790f..f444094c 100644 --- a/app/controllers/dmsf_workflows_controller.rb +++ b/app/controllers/dmsf_workflows_controller.rb @@ -23,11 +23,11 @@ class DmsfWorkflowsController < ApplicationController model_object DmsfWorkflow - before_action :find_model_object, :except => [:create, :new, :index, :assign, :assignment] + before_action :find_model_object, except: [:create, :new, :index, :assign, :assignment] before_action :find_project before_action :authorize_custom - before_action :permissions, :only => [:new_action, :assignment, :start] - before_action :approver_candidates, :only => [:remove_step, :show, :reorder_steps, :add_step] + before_action :permissions, only: [:new_action, :assignment, :start] + before_action :approver_candidates, only: [:remove_step, :show, :reorder_steps, :add_step] layout :workflows_layout @@ -47,7 +47,7 @@ class DmsfWorkflowsController < ApplicationController def index @status = params[:status] || 1 - @workflow_pages, @workflows = paginate DmsfWorkflow.status(@status).global.sorted, :per_page => 25 + @workflow_pages, @workflows = paginate DmsfWorkflow.status(@status).global.sorted, per_page: 25 end def action @@ -56,9 +56,9 @@ class DmsfWorkflowsController < ApplicationController def new_action if params[:commit] == l(:button_submit) action = DmsfWorkflowStepAction.new( - :dmsf_workflow_step_assignment_id => params[:dmsf_workflow_step_assignment_id], - :action => (params[:step_action].to_i >= 10) ? DmsfWorkflowStepAction::ACTION_DELEGATE : params[:step_action], - :note => params[:note]) + dmsf_workflow_step_assignment_id: params[:dmsf_workflow_step_assignment_id], + action: (params[:step_action].to_i >= 10) ? DmsfWorkflowStepAction::ACTION_DELEGATE : params[:step_action], + note: params[:note]) if request.post? if action.save revision = DmsfFileRevision.find_by(id: params[:dmsf_file_revision_id]) @@ -85,7 +85,7 @@ class DmsfWorkflowsController < ApplicationController unless recipients.blank? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, :to => to) + flash[:warning] = l(:warning_email_notifications, to: to) end end else @@ -106,7 +106,7 @@ class DmsfWorkflowsController < ApplicationController unless recipients.blank? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, :to => to) + flash[:warning] = l(:warning_email_notifications, to: to) end end end @@ -124,7 +124,7 @@ class DmsfWorkflowsController < ApplicationController :text_email_to_proceed, action.note) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - flash[:warning] = l(:warning_email_notifications, :to => delegate.name) + flash[:warning] = l(:warning_email_notifications, to: delegate.name) end end else @@ -162,7 +162,7 @@ class DmsfWorkflowsController < ApplicationController unless recipients.empty? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, :to => to) + flash[:warning] = l(:warning_email_notifications, to: to) end end end @@ -266,7 +266,7 @@ class DmsfWorkflowsController < ApplicationController @dmsf_workflow.name = names.first end - render :layout => !request.xhr? + render layout: !request.xhr? end def create @@ -285,19 +285,19 @@ class DmsfWorkflowsController < ApplicationController if request.post? && @dmsf_workflow && @dmsf_workflow.valid? flash[:notice] = l(:notice_successful_create) if @project - redirect_to settings_project_path(@project, :tab => 'dmsf_workflow') + redirect_to settings_project_path(@project, tab: 'dmsf_workflow') else redirect_to dmsf_workflows_path end else - render :action => 'new' + render action: 'new' end end def update if params[:dmsf_workflow] - res = @dmsf_workflow.update_attributes({:name => params[:dmsf_workflow][:name]}) if params[:dmsf_workflow][:name].present? - res = @dmsf_workflow.update_attributes({:status => params[:dmsf_workflow][:status]}) if params[:dmsf_workflow][:status].present? + res = @dmsf_workflow.update_attributes({ name: params[:dmsf_workflow][:name] }) if params[:dmsf_workflow][:name].present? + res = @dmsf_workflow.update_attributes({ status: params[:dmsf_workflow][:status] }) if params[:dmsf_workflow][:status].present? if res flash[:notice] = l(:notice_successful_update) if @project diff --git a/app/helpers/dmsf_helper.rb b/app/helpers/dmsf_helper.rb index 7fb83d79..3e51a0da 100644 --- a/app/helpers/dmsf_helper.rb +++ b/app/helpers/dmsf_helper.rb @@ -77,103 +77,8 @@ module DmsfHelper File.join('/plugin_assets', plugin.to_s, asset_type, source) end - def json_url - locale = I18n.locale || 'en' - ret = File.join('jquery.dataTables', 'locales', "#{locale}.json") - path = File.join('public', plugin_asset_path(:redmine_dmsf, 'javascripts', ret)) - unless File.exist?(path) - Rails.logger.warn "#{path} not found" - ret = File.join('jquery.dataTables', 'locales', 'en.json') - end - ret - end - - def js_url - locale = I18n.locale || 'en' - ret = File.join('plupload', 'js', 'i18n', "#{locale}.js") - path = File.join('public', plugin_asset_path(:redmine_dmsf, 'javascripts', ret)) - unless File.exist?(path) - Rails.logger.warn "#{path} not found" - ret = File.join('plupload', 'js', 'i18n', 'en.js') - end - ret - end - - def all_children_sorted(parent, pos, ident) - # Folders && files && links - nodes = DmsfFolder::visible_folders(parent.dmsf_folders.visible.to_a, parent.is_a?(Project) ? parent : parent.project) + - parent.dmsf_links.visible + parent.dmsf_files.visible - # Alphabetical and type sort - nodes.sort! do |x, y| - if (x.is_a?(DmsfFolder) || (x.is_a?(DmsfLink) && x.is_folder?)) && - (y.is_a?(DmsfFile) || (y.is_a?(DmsfLink) && y.is_file?)) - -1 - elsif (x.is_a?(DmsfFile) || (x.is_a?(DmsfLink) && x.is_file?)) && - (y.is_a?(DmsfFolder) || (y.is_a?(DmsfLink) && y.is_folder?)) - 1 - else - clear_title(x.title) <=> clear_title(y.title) - end - end - # Calculate position - ident = 0 unless ident - pos = (10 ** 12) unless pos - step = (10 ** 12) / (10 ** (ident * 3)) - tree = [] - i = 0 - nodes.each do |x| - if x.is_a?(DmsfFolder) || (x.is_a?(DmsfLink) && x.is_folder?) - i += 1 - tree << [x, pos + (step * i)] - else - tree << [x, pos + (step * (i + 1))] - end - end - tree - end - - def self.dmsf_to_csv(parent, columns) - CSV.generate(:force_quotes => true, :encoding => 'UTF-8') do |csv| - # Header - csv << columns.map { |c| c.capitalize } - # Lines - DmsfHelper.object_to_csv(csv, parent, columns) - end - end - - def self.object_to_csv(csv, parent, columns, level = -1) - # Folder - if level >= 0 - csv << parent.to_csv(columns, level) - end - # Sub-folders - folders = parent.dmsf_folders.visible.to_a - folders.concat(parent.folder_links.visible.to_a.map{ |l| l.folder }) - folders.compact! - folders.sort!{ |x, y| x.title <=> y.title} - folders.each do |f| - DmsfHelper.object_to_csv(csv, f, columns, level + 1) - end - # Files - files = parent.dmsf_files.visible.to_a - files.concat(parent.file_links.visible.to_a.map{ |l| l.target_file }) - files.concat(parent.url_links.visible.to_a) - files.compact! - files.sort!{ |x, y| x.title <=> y.title} - files.each do |file_or_link| - csv << file_or_link.to_csv(columns, level + 1) - end - end - def render_principals_for_new_email(users) principals_check_box_tags 'user_ids[]', users end - # Replace specifics characters with their ASCII version + 'z' in order to fix the wrong ordering - # e.g. 'č' -> 'cz' - def clear_title(title) - str = title.gsub(/[ěščřýáíéůúďťňĚŠČŘÝÁÍÉÚŮĎŤŇ]/) { |c| c + 'z' } - str.tr('ěščřýáíéůúďťňĚŠČŘÝÁÍÉÚŮĎŤŇ', 'escryaieuudtnESCRYAIEUUDTN').downcase - end - end diff --git a/app/helpers/dmsf_links_helper.rb b/app/helpers/dmsf_links_helper.rb index 938b1036..6508a395 100644 --- a/app/helpers/dmsf_links_helper.rb +++ b/app/helpers/dmsf_links_helper.rb @@ -24,7 +24,7 @@ module DmsfLinksHelper def folder_tree_options_for_select(folder_tree, options = {}) s = +'' folder_tree.each do |name, id| - tag_options = {:value => id} + tag_options = { value: id } if id == options[:selected] tag_options[:selected] = 'selected' else diff --git a/app/helpers/dmsf_upload_helper.rb b/app/helpers/dmsf_upload_helper.rb index 49237d51..b6990d98 100644 --- a/app/helpers/dmsf_upload_helper.rb +++ b/app/helpers/dmsf_upload_helper.rb @@ -148,7 +148,7 @@ module DmsfUploadHelper unless recipients.empty? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - controller.flash[:warning] = l(:warning_email_notifications, :to => to) if controller + controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller end end rescue => e diff --git a/app/helpers/dmsf_workflows_helper.rb b/app/helpers/dmsf_workflows_helper.rb index 69e000f5..4221ea18 100644 --- a/app/helpers/dmsf_workflows_helper.rb +++ b/app/helpers/dmsf_workflows_helper.rb @@ -30,22 +30,22 @@ module DmsfWorkflowsHelper # Delegation if dmsf_workflow_step_assignment_id s = content_tag('div', - content_tag('div', principals_radio_button_tags('step_action', principals), :id => 'users_for_delegate'), - :class => 'objects-selection') + content_tag('div', principals_radio_button_tags('step_action', principals), id: 'users_for_delegate'), + class: 'objects-selection') # New step else s = content_tag('div', - content_tag('div', principals_check_box_tags('user_ids[]', principals), :id => 'users'), - :class => 'objects-selection') + content_tag('div', principals_check_box_tags('user_ids[]', principals), id: 'users'), + class: 'objects-selection') end - links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) do |text, parameters, options| + links = pagination_links_full(principal_pages, principal_count, per_page_links: false) do |text, parameters, options| link_to text, - autocomplete_for_user_dmsf_workflow_path(workflow, parameters.merge(:q => params[:q], :format => 'js')), + autocomplete_for_user_dmsf_workflow_path(workflow, parameters.merge(q: params[:q], format: 'js')), remote: true end - s + content_tag('span', links, :class => 'pagination') + s + content_tag('span', links, class: 'pagination') end def dmsf_workflow_steps_options_for_select(steps) @@ -67,7 +67,7 @@ module DmsfWorkflowsHelper options << ["#{wf.name} #{l(:note_global)}", wf.id] end end - options_for_select(options, :selected => dmsf_workflow_id) + options_for_select(options, selected: dmsf_workflow_id) end def dmsf_all_workflows_for_select(dmsf_workflow_id) @@ -89,7 +89,7 @@ module DmsfWorkflowsHelper options << ["#{wf.name} #{l(:note_global)}", wf.id] end end - options_for_select(options, :selected => dmsf_workflow_id) + options_for_select(options, selected: dmsf_workflow_id) end def principals_radio_button_tags(name, principals) diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index c36245e8..611d8d9b 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -39,12 +39,12 @@ class DmsfFile < ActiveRecord::Base belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id' has_many :dmsf_file_revisions, -> { order(created_at: :desc, id: :desc) }, - :dependent => :destroy + dependent: :destroy has_many :locks, -> { where(entity_type: 0).order(updated_at: :desc) }, - :class_name => 'DmsfLock', :foreign_key => 'entity_id', :dependent => :destroy + class_name: 'DmsfLock', foreign_key: 'entity_id', :dependent => :destroy has_many :referenced_links, -> { where target_type: DmsfFile.model_name.to_s}, - :class_name => 'DmsfLink', :foreign_key => 'target_id', :dependent => :destroy - has_many :dmsf_public_urls, :dependent => :destroy + class_name: 'DmsfLink', foreign_key: 'target_id', dependent: :destroy + has_many :dmsf_public_urls, dependent: :destroy STATUS_DELETED = 1 STATUS_ACTIVE = 0 @@ -54,11 +54,11 @@ class DmsfFile < ActiveRecord::Base validates :name, presence: true, dmsf_file_name: true validates :project, presence: true - validates_uniqueness_of :name, :scope => [:dmsf_folder_id, :project_id, :deleted], + validates_uniqueness_of :name, scope: [:dmsf_folder_id, :project_id, :deleted], conditions: -> { where(deleted: STATUS_ACTIVE) } - acts_as_event :title => Proc.new { |o| o.name }, - :description => Proc.new { |o| + acts_as_event title: Proc.new { |o| o.name }, + description: Proc.new { |o| desc = Redmine::Search.cache_store.fetch("DmsfFile-#{o.id}") if desc Redmine::Search.cache_store.delete("DmsfFile-#{o.id}") @@ -70,13 +70,13 @@ class DmsfFile < ActiveRecord::Base end desc }, - :url => Proc.new { |o| {:controller => 'dmsf_files', :action => 'view', :id => o} }, - :datetime => Proc.new { |o| o.updated_at }, - :author => Proc.new { |o| o.last_revision.user } + url: Proc.new { |o| { controller: 'dmsf_files', action: 'view', id: o } }, + datetime: Proc.new { |o| o.updated_at }, + author: Proc.new { |o| o.last_revision.user } - acts_as_searchable :columns => ["#{table_name}.name", "#{DmsfFileRevision.table_name}.title", "#{DmsfFileRevision.table_name}.description", "#{DmsfFileRevision.table_name}.comment"], - :project_key => 'project_id', - :date_column => "#{table_name}.updated_at" + acts_as_searchable columns: ["#{table_name}.name", "#{DmsfFileRevision.table_name}.title", "#{DmsfFileRevision.table_name}.description", "#{DmsfFileRevision.table_name}.comment"], + project_key: 'project_id', + date_column: "#{table_name}.updated_at" before_create :default_values @@ -132,7 +132,7 @@ class DmsfFile < ActiveRecord::Base if locked_for_user? && (!User.current.allowed_to?(:force_file_unlock, project)) Rails.logger.info l(:error_file_is_locked) if lock.reverse[0].user - errors[:base] << l(:title_locked_by_user, :user => lock.reverse[0].user) + errors[:base] << l(:title_locked_by_user, user: lock.reverse[0].user) else errors[:base] << l(:error_file_is_locked) end @@ -284,7 +284,7 @@ class DmsfFile < ActiveRecord::Base if File.exist? last_revision.disk_file FileUtils.cp last_revision.disk_file, new_revision.disk_file(false) end - new_revision.comment = l(:comment_copied_from, :source => "#{project.identifier}: #{dmsf_path_str}") + new_revision.comment = l(:comment_copied_from, source: "#{project.identifier}: #{dmsf_path_str}") new_revision.custom_values = [] last_revision.custom_values.each do |cv| v = CustomValue.new @@ -575,7 +575,7 @@ class DmsfFile < ActiveRecord::Base # Url if columns.include?(l(:label_document_url)) default_url_options[:host] = Setting.host_name - csv << url_for(:controller => :dmsf_files, :action => 'view', :id => id) + csv << url_for(controller: :dmsf_files, action: 'view', id: id) end # Revision if columns.include?(l(:label_last_revision_id)) @@ -618,7 +618,7 @@ class DmsfFile < ActiveRecord::Base def get_locked_title if locked_for_user? if lock.reverse[0].user - return l(:title_locked_by_user, :user => lock.reverse[0].user) + return l(:title_locked_by_user, user: lock.reverse[0].user) else return l(:notice_account_unknown_email) end diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb index 8f59dd22..941f4b86 100644 --- a/app/models/dmsf_file_revision.rb +++ b/app/models/dmsf_file_revision.rb @@ -55,18 +55,18 @@ class DmsfFileRevision < ActiveRecord::Base scope :deleted, -> { where(deleted: STATUS_DELETED) } acts_as_customizable - acts_as_event :title => Proc.new {|o| (o.source_dmsf_file_revision_id.present? ? "#{l(:label_dmsf_updated)}" : "#{l(:label_created)}") + + acts_as_event title: Proc.new {|o| (o.source_dmsf_file_revision_id.present? ? "#{l(:label_dmsf_updated)}" : "#{l(:label_created)}") + ": #{o.dmsf_file.dmsf_path_str}"}, - :url => Proc.new {|o| {:controller => 'dmsf_files', :action => 'show', :id => o.dmsf_file}}, - :datetime => Proc.new {|o| o.updated_at }, - :description => Proc.new { |o| "#{o.description}\n#{o.comment}" }, - :author => Proc.new {|o| o.user } + url: Proc.new { |o| { controller: 'dmsf_files', action: 'show', id: o.dmsf_file } }, + datetime: Proc.new {|o| o.updated_at }, + description: Proc.new { |o| "#{o.description}\n#{o.comment}" }, + author: Proc.new { |o| o.user } - acts_as_activity_provider :type => 'dmsf_file_revisions', - :timestamp => "#{DmsfFileRevision.table_name}.updated_at", - :author_key => "#{DmsfFileRevision.table_name}.user_id", - :permission => :view_dmsf_file_revisions, - :scope => DmsfFileRevision.joins(:dmsf_file). + acts_as_activity_provider type: 'dmsf_file_revisions', + timestamp: "#{DmsfFileRevision.table_name}.updated_at", + author_key: "#{DmsfFileRevision.table_name}.user_id", + permission: :view_dmsf_file_revisions, + scope: DmsfFileRevision.joins(:dmsf_file). joins("JOIN #{Project.table_name} ON #{Project.table_name}.id = #{DmsfFile.table_name}.project_id").visible validates :title, presence: true @@ -93,7 +93,7 @@ class DmsfFileRevision < ActiveRecord::Base end def self.easy_activity_custom_project_scope(scope, options, event_type) - scope.where(:dmsf_files => { project_id: options[:project_ids] }) + scope.where(dmsf_files: { project_id: options[:project_ids] }) end def delete(commit = false, force = true) @@ -349,7 +349,7 @@ class DmsfFileRevision < ActiveRecord::Base end when DmsfWorkflow::STATE_APPROVED, DmsfWorkflow::STATE_REJECTED action = DmsfWorkflowStepAction.joins(:dmsf_workflow_step_assignment).where( - :dmsf_workflow_step_assignments => { :dmsf_file_revision_id => id }).order( + dmsf_workflow_step_assignments: { dmsf_file_revision_id: id }).order( 'dmsf_workflow_step_actions.created_at').last tooltip << action.author.name if action end diff --git a/app/models/dmsf_file_revision_access.rb b/app/models/dmsf_file_revision_access.rb index a2c61985..1a788155 100644 --- a/app/models/dmsf_file_revision_access.rb +++ b/app/models/dmsf_file_revision_access.rb @@ -25,10 +25,9 @@ class DmsfFileRevisionAccess < ActiveRecord::Base belongs_to :dmsf_file_revision belongs_to :user - delegate :dmsf_file, :to => :dmsf_file_revision, :allow_nil => false - delegate :project, :to => :dmsf_file, :allow_nil => false + delegate :dmsf_file, to: :dmsf_file_revision, allow_nil: false + delegate :project, to: :dmsf_file, allow_nil: false - # TODO: dmsf_file_revision_accesses.dmsf_file_revision_id should be a key scope :access_grouped, -> { select('user_id, COUNT(*) AS count, MIN(created_at) AS first_at, MAX(created_at) AS last_at').group('user_id') } validates :dmsf_file_revision, presence: true @@ -36,18 +35,18 @@ class DmsfFileRevisionAccess < ActiveRecord::Base DownloadAction = 0 EmailAction = 1 - acts_as_event :title => Proc.new {|ra| "#{l(:label_dmsf_downloaded)}: #{ra.dmsf_file.dmsf_path_str}"}, - :url => Proc.new {|ra| {:controller => 'dmsf_files', :action => 'show', :id => ra.dmsf_file}}, - :datetime => Proc.new {|ra| ra.updated_at }, - :description => Proc.new {|ra| ra.dmsf_file_revision.comment }, - :author => Proc.new {|ra| ra.user } + acts_as_event title: Proc.new { |ra| "#{l(:label_dmsf_downloaded)}: #{ra.dmsf_file.dmsf_path_str}" }, + url: Proc.new { |ra| { controller: 'dmsf_files', action: 'show', id: ra.dmsf_file } }, + datetime: Proc.new { |ra| ra.updated_at }, + description: Proc.new { |ra| ra.dmsf_file_revision.comment }, + author: Proc.new { |ra| ra.user } - acts_as_activity_provider :type => 'dmsf_file_revision_accesses', - :timestamp => "#{DmsfFileRevisionAccess.table_name}.updated_at", - :author_key => "#{DmsfFileRevisionAccess.table_name}.user_id", - :permission => :view_dmsf_file_revision_accesses, - :scope => DmsfFileRevisionAccess. + acts_as_activity_provider type: 'dmsf_file_revision_accesses', + timestamp: "#{DmsfFileRevisionAccess.table_name}.updated_at", + author_key: "#{DmsfFileRevisionAccess.table_name}.user_id", + permission: :view_dmsf_file_revision_accesses, + scope: DmsfFileRevisionAccess. joins(:dmsf_file_revision).joins("JOIN #{DmsfFile.table_name} ON dmsf_files.id = dmsf_file_revisions.dmsf_file_id"). joins("JOIN #{Project.table_name} on dmsf_files.project_id = projects.id"). - where(:dmsf_files => { deleted: DmsfFile::STATUS_ACTIVE }) + where(dmsf_files: { deleted: DmsfFile::STATUS_ACTIVE }) end diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index 5310a411..4ba3c855 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -26,23 +26,23 @@ class DmsfFolder < ActiveRecord::Base belongs_to :project belongs_to :dmsf_folder - belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id' + belongs_to :deleted_by_user, class_name: 'User', foreign_key: 'deleted_by_user_id' belongs_to :user - has_many :dmsf_folders, -> { order :title }, :dependent => :destroy - has_many :dmsf_files, :dependent => :destroy + has_many :dmsf_folders, -> { order :title }, dependent: :destroy + has_many :dmsf_files, dependent: :destroy has_many :folder_links, -> { where(target_type: 'DmsfFolder').order(:name) }, - :class_name => 'DmsfLink', :foreign_key => 'dmsf_folder_id', :dependent => :destroy + class_name: 'DmsfLink', foreign_key: 'dmsf_folder_id', dependent: :destroy has_many :file_links, -> { where(target_type: 'DmsfFile') }, - :class_name => 'DmsfLink', :foreign_key => 'dmsf_folder_id', :dependent => :destroy + class_name: 'DmsfLink', foreign_key: 'dmsf_folder_id', dependent: :destroy has_many :url_links, -> { where(target_type: 'DmsfUrl') }, - :class_name => 'DmsfLink', :foreign_key => 'dmsf_folder_id', :dependent => :destroy - has_many :dmsf_links, :dependent => :destroy + class_name: 'DmsfLink', foreign_key: 'dmsf_folder_id', dependent: :destroy + has_many :dmsf_links, dependent: :destroy has_many :referenced_links, -> { where(target_type: 'DmsfFolder') }, - :class_name => 'DmsfLink', :foreign_key => 'target_id', :dependent => :destroy + class_name: 'DmsfLink', foreign_key: 'target_id', dependent: :destroy has_many :locks, -> { where(entity_type: 1).order(updated_at: :desc) }, - :class_name => 'DmsfLock', :foreign_key => 'entity_id', :dependent => :destroy - has_many :dmsf_folder_permissions, :dependent => :destroy + class_name: 'DmsfLock', foreign_key: 'entity_id', dependent: :destroy + has_many :dmsf_folder_permissions, dependent: :destroy INVALID_CHARACTERS = '\[\]\/\\\?":<>#%\*' STATUS_DELETED = 1 @@ -79,21 +79,21 @@ class DmsfFolder < ActiveRecord::Base acts_as_customizable - acts_as_searchable :columns => ["#{table_name}.title", "#{table_name}.description"], - :project_key => 'project_id', - :date_column => 'updated_at', - :permission => :view_dmsf_files, - :scope => Proc.new { DmsfFolder.visible } + acts_as_searchable columns: ["#{table_name}.title", "#{table_name}.description"], + project_key: 'project_id', + date_column: 'updated_at', + permission: :view_dmsf_files, + scope: Proc.new { DmsfFolder.visible } - acts_as_event :title => Proc.new {|o| o.title}, - :description => Proc.new {|o| o.description }, - :url => Proc.new {|o| {:controller => 'dmsf', :action => 'show', :id => o.project, :folder_id => o}}, - :datetime => Proc.new {|o| o.updated_at }, - :author => Proc.new {|o| o.user } + acts_as_event title: Proc.new { |o| o.title }, + description: Proc.new { |o| o.description }, + url: Proc.new { |o| { controller: 'dmsf', action: 'show', id: o.project, folder_id: o } }, + datetime: Proc.new { |o| o.updated_at }, + author: Proc.new { |o| o.user } validates :title, presence: true, dmsf_file_name: true validates :project, presence: true - validates_uniqueness_of :title, :scope => [:dmsf_folder_id, :project_id, :deleted], + validates_uniqueness_of :title, scope: [:dmsf_folder_id, :project_id, :deleted], conditions: -> { where(deleted: STATUS_ACTIVE) } validates :description, length: { maximum: 65535 } @@ -226,7 +226,7 @@ class DmsfFolder < ActiveRecord::Base def self.file_list(files) options = Array.new - options.push ['', nil, :label => 'none'] + options.push ['', nil, label: 'none'] files.each do |f| options.push [f.title, f.id] end @@ -456,7 +456,7 @@ class DmsfFolder < ActiveRecord::Base # Url if columns.include?(l(:label_document_url)) default_url_options[:host] = Setting.host_name - csv << url_for(:controller => :dmsf, :action => 'show', :id => project_id, :folder_id => id) + csv << url_for(controller: :dmsf, action: 'show', id: project_id, folder_id: id) end # Revision csv << '' if columns.include?(l(:label_last_revision_id)) @@ -470,7 +470,7 @@ class DmsfFolder < ActiveRecord::Base def get_locked_title if locked_for_user? if lock.reverse[0].user - return l(:title_locked_by_user, :user => lock.reverse[0].user) + return l(:title_locked_by_user, user: lock.reverse[0].user) else return l(:notice_account_unknown_email) end diff --git a/app/models/dmsf_link.rb b/app/models/dmsf_link.rb index 7c638f5c..2356b048 100644 --- a/app/models/dmsf_link.rb +++ b/app/models/dmsf_link.rb @@ -25,7 +25,7 @@ class DmsfLink < ActiveRecord::Base belongs_to :project belongs_to :dmsf_folder - belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id' + belongs_to :deleted_by_user, class_name: 'User', foreign_key: 'deleted_by_user_id' belongs_to :user validates :name, presence: true, length: { maximum: 255 } @@ -92,9 +92,9 @@ class DmsfLink < ActiveRecord::Base def self.find_link_by_file_name(project, folder, filename) links = DmsfLink.where( - :project_id => project.id, - :dmsf_folder_id => folder ? folder.id : nil, - :target_type => DmsfFile.model_name.to_s).visible.all + project_id: project.id, + dmsf_folder_id: folder ? folder.id : nil, + target_type: DmsfFile.model_name.to_s).visible.all links.each do |link| return link if link.target_file && (link.target_file.name == filename) end @@ -142,7 +142,7 @@ class DmsfLink < ActiveRecord::Base else self.deleted = STATUS_DELETED self.deleted_by_user = User.current - save(:validate => false) + save validate: false end end @@ -153,7 +153,7 @@ class DmsfLink < ActiveRecord::Base end self.deleted = STATUS_ACTIVE self.deleted_by_user = nil - save(:validate => false) + save validate: false end def is_folder? diff --git a/app/models/dmsf_lock.rb b/app/models/dmsf_lock.rb index 89dfa2b6..b02220f6 100644 --- a/app/models/dmsf_lock.rb +++ b/app/models/dmsf_lock.rb @@ -25,8 +25,8 @@ require 'simple_enum' class DmsfLock < ActiveRecord::Base before_create :generate_uuid - belongs_to :file, :class_name => 'DmsfFile', :foreign_key => 'entity_id' - belongs_to :folder, :class_name => 'DmsfFolder', :foreign_key => 'entity_id' + belongs_to :file, class_name: 'DmsfFile', foreign_key: 'entity_id' + belongs_to :folder, class_name: 'DmsfFolder', foreign_key: 'entity_id' belongs_to :user # At the moment apparently we're only supporting a write lock? diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb index 1235663b..66438fb7 100644 --- a/app/models/dmsf_mailer.rb +++ b/app/models/dmsf_mailer.rb @@ -43,7 +43,7 @@ class DmsfMailer < Mailer @author = User.anonymous unless @author message_id project set_language_if_valid user.language - mail :to => user.mail, subject: "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_updated_subject)}" + mail to: user.mail, subject: "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_updated_subject)}" end end @@ -65,8 +65,8 @@ class DmsfMailer < Mailer @author = User.anonymous unless @author message_id project set_language_if_valid user.language - mail :to => user.mail, - :subject => "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_deleted_subject)}" + mail to: user.mail, + subject: "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_deleted_subject)}" end end @@ -85,7 +85,7 @@ class DmsfMailer < Mailer @author = author unless @links_only zipped_content_data = open(email_params[:zipped_content], 'rb') { |io| io.read } - attachments['Documents.zip'] = { :content_type => 'application/zip', :content => zipped_content_data } + attachments['Documents.zip'] = { content_type: 'application/zip', content: zipped_content_data } end mail to: email_params[:to], cc: email_params[:cc], subject: email_params[:subject], 'From' => email_params[:from], 'Reply-To' => email_params[:reply_to] @@ -108,13 +108,13 @@ class DmsfMailer < Mailer message_id workflow @workflow = workflow @revision = revision - @text1 = l(text1_id, :name => workflow.name, :filename => revision.dmsf_file.name, :notice => notice) + @text1 = l(text1_id, name: workflow.name, filename: revision.dmsf_file.name, notice: notice) @text2 = l(text2_id) @notice = notice @author = revision.dmsf_workflow_assigned_by_user @author = User.anonymous unless @author - mail :to => user.mail, - :subject => "[#{@project.name} - #{l(:field_label_dmsf_workflow)}] #{@workflow.name} #{l(subject_id)}" + mail to: user.mail, + subject: "[#{@project.name} - #{l(:field_label_dmsf_workflow)}] #{@workflow.name} #{l(subject_id)}" end end diff --git a/app/models/dmsf_upload.rb b/app/models/dmsf_upload.rb index 65383d78..50237f6e 100644 --- a/app/models/dmsf_upload.rb +++ b/app/models/dmsf_upload.rb @@ -44,11 +44,11 @@ class DmsfUpload a = Attachment.find_by_token(uploaded_file[:token]) if a uploaded = { - :disk_filename => DmsfHelper.temp_filename(a.filename), - :content_type => a.content_type, - :original_filename => a.filename, - :comment => uploaded_file[:description], - :tempfile_path => a.diskfile + disk_filename: DmsfHelper.temp_filename(a.filename), + content_type: a.content_type, + original_filename: a.filename, + comment: uploaded_file[:description], + tempfile_path: a.diskfile } DmsfUpload.new(project, folder, uploaded) else @@ -104,7 +104,7 @@ class DmsfUpload present_custom_fields = file.last_revision.custom_values.collect(&:custom_field).uniq file.last_revision.available_custom_fields.each do |cf| unless present_custom_fields.include?(cf) - @custom_values << CustomValue.new({:custom_field => cf, :value => cf.default_value}) if cf.default_value + @custom_values << CustomValue.new({ custom_field: cf, value: cf.default_value}) if cf.default_value end end end diff --git a/app/models/dmsf_workflow.rb b/app/models/dmsf_workflow.rb index 6bde0300..2dbff559 100644 --- a/app/models/dmsf_workflow.rb +++ b/app/models/dmsf_workflow.rb @@ -20,13 +20,14 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DmsfWorkflow < ActiveRecord::Base + has_many :dmsf_workflow_steps, -> { order(step: :asc, operator: :desc) }, dependent: :destroy - belongs_to :author, :class_name => 'User' + belongs_to :author, class_name: 'User' scope :sorted, lambda { order(name: :asc) } scope :global, lambda { where(project_id: nil) } scope :active, lambda { where(status: STATUS_ACTIVE) } - scope :status, lambda { |arg| where(arg.blank? ? nil : {:status => arg.to_i}) } + scope :status, lambda { |arg| where(arg.blank? ? nil : { status: arg.to_i }) } validates :name, presence: true, length: { maximum: 255 }, dmsf_workflow_name: true @@ -222,7 +223,7 @@ class DmsfWorkflow < ActiveRecord::Base unless recipients.blank? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - controller.flash[:warning] = l(:warning_email_notifications, :to => to) if controller + controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller end end end diff --git a/app/models/dmsf_workflow_step.rb b/app/models/dmsf_workflow_step.rb index 70f31fb8..18e9b289 100644 --- a/app/models/dmsf_workflow_step.rb +++ b/app/models/dmsf_workflow_step.rb @@ -20,10 +20,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DmsfWorkflowStep < ActiveRecord::Base + belongs_to :dmsf_workflow belongs_to :user - has_many :dmsf_workflow_step_assignments, :dependent => :destroy + has_many :dmsf_workflow_step_assignments, dependent: :destroy validates :dmsf_workflow, presence: true validates :step, presence: true diff --git a/app/models/dmsf_workflow_step_action.rb b/app/models/dmsf_workflow_step_action.rb index d732e3b6..f8feac6c 100644 --- a/app/models/dmsf_workflow_step_action.rb +++ b/app/models/dmsf_workflow_step_action.rb @@ -22,12 +22,12 @@ class DmsfWorkflowStepAction < ActiveRecord::Base belongs_to :dmsf_workflow_step_assignment - belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' + belongs_to :author, class_name: 'User', foreign_key: 'author_id' validates :dmsf_workflow_step_assignment, presence: true validates :action, presence: true validates :author_id, presence: true - validates :note, presence: true, :unless => lambda { action == DmsfWorkflowStepAction::ACTION_APPROVE } + validates :note, presence: true, unless: lambda { action == DmsfWorkflowStepAction::ACTION_APPROVE } validates_uniqueness_of :dmsf_workflow_step_assignment_id, scope: [:action], unless: lambda { action == DmsfWorkflowStepAction::ACTION_DELEGATE } diff --git a/app/models/dmsf_workflow_step_assignment.rb b/app/models/dmsf_workflow_step_assignment.rb index 7ead5c8b..9cb00164 100644 --- a/app/models/dmsf_workflow_step_assignment.rb +++ b/app/models/dmsf_workflow_step_assignment.rb @@ -20,11 +20,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DmsfWorkflowStepAssignment < ActiveRecord::Base + belongs_to :dmsf_workflow_step belongs_to :user belongs_to :dmsf_file_revision - has_many :dmsf_workflow_step_actions, :dependent => :destroy + has_many :dmsf_workflow_step_actions, dependent: :destroy validates :dmsf_workflow_step, presence: true validates :dmsf_file_revision, presence: true @@ -43,4 +44,5 @@ class DmsfWorkflowStepAssignment < ActiveRecord::Base end false end + end \ No newline at end of file diff --git a/app/views/dmsf/_add_email.html.erb b/app/views/dmsf/_add_email.html.erb index fd9c486c..84760d88 100644 --- a/app/views/dmsf/_add_email.html.erb +++ b/app/views/dmsf/_add_email.html.erb @@ -23,21 +23,21 @@
<%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %>
<%= late_javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for( - :controller => 'dmsf', :action => 'autocomplete_for_user', :project_id => @project) }')" %> + controller: 'dmsf', action: 'autocomplete_for_user', project_id: @project) }')" %>- <%= f.text_field(:title, :required => true) %> + <%= f.text_field(:title, required: true) %>
- <%= f.text_area :description, :rows => 8, :class => 'wiki-edit' %> + <%= f.text_area :description, rows: 8, class: 'wiki-edit' %>
<% dir = @folder.inherited_permissions_from %> @@ -117,9 +118,9 @@ <% end %> <%= link_to l(:label_user_search_add), - new_dmsf_folder_permissions_path(:project_id => @project, :dmsf_folder_id => @folder), - :remote => true, - :method => 'get' %> + new_dmsf_folder_permissions_path(project_id: @project, dmsf_folder_id: @folder), + remote: true, + method: :get %>
<% values = @folder ? @folder.custom_field_values : (@parent ? @parent.custom_field_values : DmsfFolder.new.custom_field_values) %> diff --git a/app/views/dmsf/edit_root.html.erb b/app/views/dmsf/edit_root.html.erb index ed810042..02849c57 100644 --- a/app/views/dmsf/edit_root.html.erb +++ b/app/views/dmsf/edit_root.html.erb @@ -28,27 +28,24 @@ <% if User.current.allowed_to?(:folder_manipulation, @project) %> <% if @project.dmsf_notification %> <%= link_to(l(:label_notifications_off), - notify_deactivate_dmsf_path(:id => @project), - :title => l(:title_notifications_active_deactivate), - :class => 'icon icon-email') %> + notify_deactivate_dmsf_path(id: @project), + title: l(:title_notifications_active_deactivate), + class: 'icon icon-email') %> <% else %> <%= link_to(l(:label_notifications_on), - notify_activate_dmsf_path(:id => @project), - :title => l(:title_notifications_active_deactivate), - :class => 'icon icon-email-add') %> + notify_activate_dmsf_path(id: @project), + title: l(:title_notifications_active_deactivate), + class: 'icon icon-email-add') %> <% end %> <% end %>- <%= f.text_area(:dmsf_description, :rows => 8, :class => 'wiki-edit', - :label => l(:field_description)) %> + <%= f.text_area :dmsf_description, rows: 8, class: 'wiki-edit', label: l(:field_description) %>
<%= label_tag('', l(:label_email_from)) %> - <%= text_field_tag('email[from_disabled]', @email_params[:from], :style => 'width: 90%;', :disabled => true) %> + <%= text_field_tag('email[from_disabled]', @email_params[:from], style: 'width: 90%;', disabled: true) %>
<%= label_tag('email[to]', l(:label_email_to)) %> - <%= text_field_tag('email[to]', @email_params[:to], :style => 'width: 90%;', :required => true) %> - <%= link_to l(:button_add), add_email_dmsf_path(:project_id => @project), - :title => l(:label_email_address_add), :class => 'icon icon-add', :remote => true %> + <%= text_field_tag('email[to]', @email_params[:to], style: 'width: 90%;', required: true) %> + <%= link_to l(:button_add), add_email_dmsf_path(project_id: @project), + title: l(:label_email_address_add), class: 'icon icon-add', remote: true %>
<%= label_tag('email[cc]', l(:label_email_cc)) %> - <%= text_field_tag('email[cc]', @email_params[:cc], :style => 'width: 90%;') %> + <%= text_field_tag('email[cc]', @email_params[:cc], style: 'width: 90%;') %>
<%= label_tag('email[subject]', l(:label_email_subject)) %> - <%= text_field_tag('email[subject]', @email_params[:subject], :style => 'width: 90%;') %> + <%= text_field_tag('email[subject]', @email_params[:subject], style: 'width: 90%;') %>
<%= label_tag('', l(:label_email_documents)) %> - <%= link_to 'Documents.zip', download_email_entries_path(:id => @project, :folder_id => @folder, - :path => @email_params[:zipped_content]) %> + <%= link_to 'Documents.zip', download_email_entries_path(id: @project, folder_id: @folder, + path: @email_params[:zipped_content]) %> <%= l(:label_or) %> <%= check_box_tag('email[links_only]', 1, Setting.plugin_redmine_dmsf['dmsf_documents_email_links_only'], - :onchange => "$('#public_url').toggle($('#email_links_only').prop('checked'))") + onchange: "$('#public_url').toggle($('#email_links_only').prop('checked'))") %> <%= l(:label_links_only) %> - <%= render(:partial => 'dmsf_public_urls/new') %> + <%= render partial: 'dmsf_public_urls/new' %>
<%= label_tag('email[body]', l(:label_email_body)) %> - <%= text_area_tag('email[body]', @email_params['body'], :rows => '20', :style => 'width: 90%;') %> + <%= text_area_tag('email[body]', @email_params['body'], rows: '20', style: 'width: 90%;') %>
<%= submit_tag(l(:label_email_send)) %>
diff --git a/app/views/dmsf/show.api.rsb b/app/views/dmsf/show.api.rsb index 8d0ef0e0..76dfee1b 100644 --- a/app/views/dmsf/show.api.rsb +++ b/app/views/dmsf/show.api.rsb @@ -1,31 +1,12 @@ api.dmsf do - api.array :dmsf_folders, api_meta(:total_count => @subfolders.size) do - @subfolders.each do |folder| - api.folder do - api.id folder.id - api.title folder.title - end - end - end - api.array :dmsf_files, api_meta(:total_count => @files.size) do - @files.each do |file| - api.file do - api.id file.id - api.name file.name - end - end - end - - api.array :dmsf_links, api_meta(:total_count => @dir_links.size + @file_links.size + @url_links.size) do - (@dir_links + @file_links + @url_links).each do |link| - api.link do - api.id link.id - api.name link.name - api.target_type link.target_type - api.target_id link.target_id - api.target_project_id link.target_project_id - api.external_url link.external_url if link.external_url.present? + api.array :dmsf_nodes, api_meta(total_count: @query.dmsf_nodes.count) do + @query.dmsf_nodes.each do |node| + api.node do + api.id node.id + api.title node.title + api.type node.type + api.filename node.filename end end end diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb index af630e81..869ae39f 100644 --- a/app/views/dmsf/show.html.erb +++ b/app/views/dmsf/show.html.erb @@ -31,47 +31,47 @@ <%= actions_dropdown do %> <% if @folder_manipulation_allowed && !@system_folder %> <% if @folder.nil? %> - <%= link_to(l(:button_edit), edit_root_dmsf_path(:id => @project), - :title => l(:link_edit, :title => l(:link_documents)), - :class => 'icon icon-edit') %> + <%= link_to l(:button_edit), edit_root_dmsf_path(id: @project), + title: l(:link_edit, title: l(:link_documents)), + class: 'icon icon-edit' %> <% elsif !@locked_for_user %> - <%= link_to(l(:button_edit), + <%= link_to l(:button_edit), edit_dmsf_path(id: @project, folder_id: @folder, redirect_to_folder_id: @folder.id), title: l(:link_edit, title: h(@folder.title)), - class: 'icon icon-edit') %> + class: 'icon icon-edit' %> <% end %> <% if @folder && (!@locked_for_user || User.current.allowed_to?(:force_file_unlock, @project)) %> <% if @folder.locked? %> - <%= link_to_if(@folder.unlockable?, l(:button_unlock), - unlock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url), - :title => l(:title_unlock_folder), :class => 'icon icon-unlock') %> + <%= link_to_if @folder.unlockable?, l(:button_unlock), + unlock_dmsf_path(id: @project, folder_id: @folder, current: request.url), + title: l(:title_unlock_folder), class: 'icon icon-unlock' %> <% else %> <%= link_to(l(:button_lock), - lock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url), - :title => l(:title_lock_folder), :class => 'icon icon-lock') %> + lock_dmsf_path(id: @project, folder_id: @folder, current: request.url), + title: l(:title_lock_folder), class: 'icon icon-lock') %> <% end %> <% end %> <% if !@locked_for_user && ((@folder && @folder.notification) || (!@folder && @project.dmsf_notification)) %> - <%= link_to(l(:label_notifications_off), - notify_deactivate_dmsf_path(:id => @project, :folder_id => @folder), - :title => l(:title_notifications_active_deactivate), - :class => 'icon icon-email') %> + <%= link_to l(:label_notifications_off), + notify_deactivate_dmsf_path(id: @project, folder_id: @folder), + title: l(:title_notifications_active_deactivate), + class: 'icon icon-email' %> <% else %> - <%= link_to(l(:label_notifications_on), - notify_activate_dmsf_path(:id => @project, :folder_id => @folder), - :title => l(:title_notifications_not_active_activate), - :class => 'icon icon-email-add') %> + <%= link_to l(:label_notifications_on), + notify_activate_dmsf_path(id: @project, folder_id: @folder), + title: l(:title_notifications_not_active_activate), + class: 'icon icon-email-add' %> <% end %> <% if @file_manipulation_allowed && !@locked_for_user %> - <%= link_to(l(:label_link_from), - new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder ? @folder.id : @folder, - :type => 'link_from'), :title => l(:title_create_link), - :class => 'icon icon-link') %> + <%= link_to l(:label_link_from), + new_dmsf_link_path(project_id: @project.id, dmsf_folder_id: @folder ? @folder.id : @folder, + type: 'link_from'), title: l(:title_create_link), + class: 'icon icon-link' %> <% end %> <%= link_to(l(:link_create_folder), - new_dmsf_path(:id => @project, :parent_id => @folder), - :title => l(:link_create_folder), - :class => 'icon icon-add') unless @locked_for_user %> + new_dmsf_path(id: @project, parent_id: @folder), + title: l(:link_create_folder), + class: 'icon icon-add') unless @locked_for_user %> <% end %> <% if @trash_enabled %> <%= link_to l(:link_trash_bin), trash_dmsf_path(@project), title: l(:link_trash_bin), class: 'icon icon-del' %> @@ -101,22 +101,6 @@ <% unless (@folder && @folder.system) %> <% other_formats_links do |f| %> - <%= f.link_to 'CSV', onclick: "showModal('dmsf_csv_export_options', '350px'); return false;" %> + <%= f.link_to 'CSV', url: { action: :show, id: @project, dmsf_folder_id: @folder } %> <% end %> <% end %> - -<%= l(:info_file_locked) %>
<% else %> - <%= labelled_form_for(@revision, :url => { :action => 'create_revision', :id => @file }, - :html => { :method => :post, :multipart => true, :id => 'new_revision_form' }) do |f| %> + <%= labelled_form_for(@revision, url: { action: 'create_revision', id: @file }, + html: { method: :post, multipart: true, id: 'new_revision_form' }) do |f| %>@@ -38,12 +38,12 @@
- <%= f.text_field(:name, :label => l(:label_file)) %> + <%= f.text_field :name, label: l(:label_file) %>
- <%= f.text_area(:description, :rows => 6, :class => 'wiki-edit') %> + <%= f.text_area :description, rows: 6, class: 'wiki-edit' %>
- <%= label_tag('file_upload', l(:label_new_content)) %> - <%= render :partial => 'dmsf_upload/form', - :locals => { :multiple => false, :container => nil, :description => false, :awf => false } %> + <%= label_tag 'file_upload', l(:label_new_content) %> + <%= render partial: 'dmsf_upload/form', + locals: { multiple: false, container: nil, description: false, awf: false } %>
- <%= f.text_area(:comment, :rows => 2, :label => l(:label_comment), :class => 'wiki-edit') %> + <%= f.text_area :comment, rows: 2, label: l(:label_comment), class: 'wiki-edit' %>
<%= f.submit l(:submit_create) %> <% end %> diff --git a/app/views/dmsf_files/_link.html.erb b/app/views/dmsf_files/_link.html.erb index 2f2490f0..c704b37a 100644 --- a/app/views/dmsf_files/_link.html.erb +++ b/app/views/dmsf_files/_link.html.erb @@ -24,18 +24,18 @@ <% else %><% end %> - <% file_view_url = url_for({:controller => :dmsf_files, :action => 'view', :id => dmsf_file}) %> + <% file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file }) %> <%= link_to(h(dmsf_file.title), file_view_url, - :target => '_blank', - :class => "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}", - :title => h(dmsf_file.last_revision.try(:tooltip)), + target: '_blank', + class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}", + title: h(dmsf_file.last_revision.try(:tooltip)), 'data-downloadurl' => "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}") %> <% if dmsf_file.text? || dmsf_file.image? %> <%= link_to l(:button_view), file_view_url, - :class => 'icon-only icon-magnifier', - :title => l(:button_view) %> + class: 'icon-only icon-magnifier', + title: l(:button_view) %> <% end %> <%= " - #{dmsf_file.description}" unless dmsf_file.description.blank? %> (<%= number_to_human_size dmsf_file.last_revision.size %>) @@ -44,47 +44,47 @@ <% # Details %> <% if User.current.allowed_to? :file_manipulation, dmsf_file.project %> - <%= link_to('', dmsf_file_path(:id => dmsf_file), - :title => l(:link_details, :title => h(dmsf_file.last_revision.title)), - :class => 'icon-only icon-edit') %> + <%= link_to '', dmsf_file_path(id: dmsf_file), + title: l(:link_details, title: h(dmsf_file.last_revision.title)), + class: 'icon-only icon-edit' %> <% else %> <% end %> <% # Email %> - <%= link_to('', entries_operations_dmsf_path(:id => dmsf_file.project_id, :email_entries => 'email', - :ids => ["file-#{dmsf_file.id}"]), :method => :post, :title => l(:heading_send_documents_by_email), - :class => 'icon-only icon-email-disabled') %> + <%= link_to '', entries_operations_dmsf_path(id: dmsf_file.project_id, email_entries: 'email', + ids: ["file-#{dmsf_file.id}"]), method: :post, title: l(:heading_send_documents_by_email), + class: 'icon-only icon-email-disabled' %> <% # Lock %> <% if !dmsf_file.locked? %> - <%= link_to('', lock_dmsf_files_path(:id => dmsf_file), - :title => l(:title_lock_file), - :class => 'icon-only icon-lock') %> + <%= link_to '', lock_dmsf_files_path(id: dmsf_file), + title: l(:title_lock_file), + class: 'icon-only icon-lock' %> <% elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? || User.current.allowed_to?(:force_file_unlock, dmsf_file.project)) %> - <%= link_to('', unlock_dmsf_files_path(:id => dmsf_file), - :title => dmsf_file.get_locked_title, - :class => 'icon-only icon-unlock') %> + <%= link_to '', unlock_dmsf_files_path(id: dmsf_file), + title: dmsf_file.get_locked_title, + class: 'icon-only icon-unlock' %> <% else %> <% end %> <% if !dmsf_file.locked? %> <% # Notifications %> <% if dmsf_file.notification %> - <%= link_to('', notify_deactivate_dmsf_files_path(:id => dmsf_file), - :title => l(:title_notifications_active_deactivate), - :class => 'icon-only icon-email') %> + <%= link_to '', notify_deactivate_dmsf_files_path(id: dmsf_file), + title: l(:title_notifications_active_deactivate), + class: 'icon-only icon-email' %> <% else %> - <%= link_to('', notify_activate_dmsf_files_path(:id => dmsf_file), - :title => l(:title_notifications_not_active_activate), - :class => 'icon-only icon-email-add') %> + <%= link_to '', notify_activate_dmsf_files_path(id: dmsf_file), + title: l(:title_notifications_not_active_activate), + class: 'icon-only icon-email-add' %> <% end %> <% # Delete %> <% if @issue.attributes_editable? && User.current.allowed_to?(:file_delete, dmsf_file.project) %> - <%= link_to('', - link ? dmsf_link_path(link, :commit => 'yes') : dmsf_file_path(:id => dmsf_file, :commit => 'yes'), - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :title => l(:button_delete), - :class => 'icon-only icon-del') %> + <%= link_to '', + link ? dmsf_link_path(link, commit: 'yes') : dmsf_file_path(id: dmsf_file, commit: 'yes'), + data: { confirm: l(:text_are_you_sure) }, + method: :delete, + title: l(:button_delete), + class: 'icon-only icon-del' %> <% end %> <% else %> @@ -92,10 +92,10 @@ <% end %> <% # Approval workflow %> <% wf = DmsfWorkflow.find_by(id: dmsf_file.last_revision.dmsf_workflow_id) if dmsf_file.last_revision.dmsf_workflow_id %> - <%= render(:partial => 'dmsf_workflows/approval_workflow_button', - :locals => {:file => dmsf_file, - :file_approval_allowed => User.current.allowed_to?(:file_approval, dmsf_file.project), - :workflows_available => DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', dmsf_file.project_id]).exists?, - :project => dmsf_file.project, :wf => wf, :dmsf_link_id => nil }) %> + <%= render partial: 'dmsf_workflows/approval_workflow_button', + locals: { file: dmsf_file, + file_approval_allowed: User.current.allowed_to?(:file_approval, dmsf_file.project), + workflows_available: DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', dmsf_file.project_id]).exists?, + project: dmsf_file.project, wf: wf, dmsf_link_id: nil } %>
diff --git a/app/views/dmsf_files/_links.html.erb b/app/views/dmsf_files/_links.html.erb index 477704ef..5351f655 100644 --- a/app/views/dmsf_files/_links.html.erb +++ b/app/views/dmsf_files/_links.html.erb @@ -26,8 +26,8 @@ <% end %> diff --git a/app/views/dmsf_files/_revision_access.html.erb b/app/views/dmsf_files/_revision_access.html.erb index ceb78861..a87d44bd 100644 --- a/app/views/dmsf_files/_revision_access.html.erb +++ b/app/views/dmsf_files/_revision_access.html.erb @@ -29,7 +29,7 @@- <%= label_tag('target_project_id', l(:field_target_project)) %> - <%= select_tag('target_project_id', - project_tree_options_for_select(projects, :selected => target_project)) %> + <%= label_tag 'target_project_id', l(:field_target_project) %> + <%= select_tag 'target_project_id', project_tree_options_for_select(projects, selected: target_project) %>
- <%= label_tag('target_folder_id', l(:field_target_folder)) %> - <%= select_tag('target_folder_id', options_for_select(folders, - :selected => (target_folder.id if target_folder))) %> + <%= label_tag 'target_folder_id', l(:field_target_folder) %> + <%= select_tag 'target_folder_id', options_for_select(folders, selected: (target_folder.id if target_folder)) %>
- <%= submit_tag(l(:button_copy), :id => 'copy_button') %> + <%= submit_tag l(:button_copy), id: 'copy_button' %> <% if !file_or_folder.locked? && User.current.allowed_to?(permission, project) %> - <%= submit_tag(l(:button_move), :id => 'move_button') %> + <%= submit_tag l(:button_move), id: 'move_button' %> <% end %>
<% end %> @@ -45,11 +43,11 @@ <%= late_javascript_tag do %> $('#move_button').click(function(event) { - $('#copyForm').attr('action', "<%= url_for(:action => 'move', :id => file_or_folder) %>"); + $('#copyForm').attr('action', "<%= url_for(action: 'move', id: file_or_folder) %>"); $('#copyForm').submit(); }); $('#target_project_id').change(function () { - $('#content').load("<%= url_for(:action => 'new') %>", $('#copyForm').serialize()); + $('#content').load("<%= url_for(action: 'new') %>", $('#copyForm').serialize()); }); $('#target_project_id').select2(); $('#target_folder_id').select2(); diff --git a/app/views/dmsf_folders_copy/new.html.erb b/app/views/dmsf_folders_copy/new.html.erb index 26f48535..7f712619 100644 --- a/app/views/dmsf_folders_copy/new.html.erb +++ b/app/views/dmsf_folders_copy/new.html.erb @@ -22,14 +22,13 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. %> -<%= render(:partial => '/dmsf/path', :locals => { :folder => @folder, :filename => nil, :title => nil }) %> +<%= render partial: '/dmsf/path', locals: { folder: @folder, filename: nil, title: nil } %> -<%= render(:partial => '/dmsf_folders_copy/form', :locals => { - :projects => @projects, - :project => @project, - :target_project => @target_project, - :folders => @folders, - :file_or_folder => @folder, - :target_folder => @target_folder, - :permission => :folder_manipulation - }) %> +<%= render partial: '/dmsf_folders_copy/form', locals: { + projects: @projects, + project: @project, + target_project: @target_project, + folders: @folders, + file_or_folder: @folder, + target_folder: @target_folder, + permission: :folder_manipulation } %> diff --git a/app/views/dmsf_links/_form.html.erb b/app/views/dmsf_links/_form.html.erb index adfc905f..45e2ff65 100644 --- a/app/views/dmsf_links/_form.html.erb +++ b/app/views/dmsf_links/_form.html.erb @@ -22,13 +22,13 @@@@ -46,11 +46,11 @@ <% end %> <%= select_tag('dmsf_link[target_project_id]', project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, - :selected => @dmsf_link.target_project)) %> + selected: @dmsf_link.target_project)) %> <%= late_javascript_tag do %> $('#dmsf_link_target_project_id').change(function(){ $.ajax({ - url: '<%= escape_javascript autocomplete_for_project_dmsf_link_path(@project, :format => 'js') %>', + url: '<%= escape_javascript autocomplete_for_project_dmsf_link_path(@project, format: 'js') %>', type: 'get', data: $('#new_dmsf_link').serialize() }); @@ -67,17 +67,17 @@ * <% if @fast_links %> - <%= text_field_tag 'dmsf_link[target_folder_id]', '', :required => true, :max_length => 255 %> + <%= text_field_tag 'dmsf_link[target_folder_id]', '', required: true, max_length: 255 %> <% end %> <% end %> <% if !@fast_links || (@type != 'link_to') %> <%= select_tag('dmsf_link[target_folder_id]', folder_tree_options_for_select(DmsfFolder.directory_tree(@dmsf_link.target_project), - :selected => @target_folder_id)) %> + selected: @target_folder_id)) %> <%= late_javascript_tag do %> $('#dmsf_link_target_folder_id').change(function(){ $.ajax({ - url: '<%= escape_javascript autocomplete_for_folder_dmsf_link_path(@project, :format => 'js') %>', + url: '<%= escape_javascript autocomplete_for_folder_dmsf_link_path(@project, format: 'js') %>', type: 'get', data: $('#new_dmsf_link').serialize() }); @@ -90,24 +90,24 @@ <%= label_tag('dmsf_link[target_file_id]', l(:field_target_file)) %> <% files = files_for_select(@dmsf_link.target_project.id, @target_folder_id) %> <%= select_tag('dmsf_link[target_file_id]', - options_for_select(DmsfFolder.file_list(files)), :required => modal) %> + options_for_select(DmsfFolder.file_list(files)), required: modal) %>
<% end %>- <%= f.text_field :external_url, :required => false %> + <%= f.text_field :external_url, required: false %>
- <%= f.text_field :name, :required => true, :max_length => 255 %> + <%= f.text_field :name, required: true, max_length: 255 %>
<% if modal %> - <%= f.submit l(:button_create), :onclick => 'hideModal(this);' %> + <%= f.submit l(:button_create), onclick: 'hideModal(this);' %> <% else %> <%= f.submit l(:button_create) %> <% end %> diff --git a/app/views/dmsf_links/new.html.erb b/app/views/dmsf_links/new.html.erb index 37f2df1e..7741a8cc 100644 --- a/app/views/dmsf_links/new.html.erb +++ b/app/views/dmsf_links/new.html.erb @@ -20,4 +20,4 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. %> -<%= render :partial => 'form', :locals => { :modal => false } %> \ No newline at end of file +<%= render partial: 'form', locals: { modal: false } %> \ No newline at end of file diff --git a/app/views/dmsf_links/new.js.erb b/app/views/dmsf_links/new.js.erb index 4c99c845..dd9dbe3b 100644 --- a/app/views/dmsf_links/new.js.erb +++ b/app/views/dmsf_links/new.js.erb @@ -20,5 +20,5 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. %> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'form', :locals => { :modal => true }) %>'); +$('#ajax-modal').html('<%= escape_javascript(render partial: 'form', locals: { modal: true }) %>'); showModal('ajax-modal', '40%'); \ No newline at end of file diff --git a/app/views/dmsf_mailer/files_updated.html.erb b/app/views/dmsf_mailer/files_updated.html.erb index 3032b6ad..a1887099 100644 --- a/app/views/dmsf_mailer/files_updated.html.erb +++ b/app/views/dmsf_mailer/files_updated.html.erb @@ -22,14 +22,12 @@ <%= link_to @project, project_url(@project) %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %>
- <%= link_to(h(file.dmsf_path_str),
- dmsf_file_url(file, :download => '')) %>
+ <%= link_to h(file.dmsf_path_str), dmsf_file_url(file, download: '') %>
(<%= file.name %>),
<%= number_to_human_size(file.last_revision.size) %>,
<%= l(:label_dmsf_version) %> <%= file.last_revision.version %>,
<%= "#{file.last_revision.workflow_str(true)}," if file.last_revision.workflow_str(true) != l(:title_none) %>
- <%= link_to(l(:link_details, :title => h(file.title)),
- dmsf_file_url(file)) %>
+ <%= link_to l(:link_details, title: h(file.title)), dmsf_file_url(file) %>
<% if file.last_revision.comment.present? %>
<%= h(file.last_revision.comment) %>
<% end %>
diff --git a/app/views/dmsf_mailer/send_documents.html.erb b/app/views/dmsf_mailer/send_documents.html.erb
index 795a6e98..0d87cf1d 100644
--- a/app/views/dmsf_mailer/send_documents.html.erb
+++ b/app/views/dmsf_mailer/send_documents.html.erb
@@ -34,7 +34,7 @@
<% dir = DmsfFolder.find_by(id: i) %>
<% if dir && !folders.include?(dir) %>
- <%= link_to(h(dir.dmsf_path_str), dmsf_folder_path(:id => dir.project_id, :folder_id => dir.id, :only_path => false)) %>
+ <%= link_to h(dir.dmsf_path_str), dmsf_folder_path(id: dir.project_id, folder_id: dir.id, only_path: false) %>
<% dir.dmsf_files.each do |file| %>
<% unless files.include?(file) %>
@@ -44,8 +44,8 @@
<% dmsf_public_url.user = @author %>
<% dmsf_public_url.expire_at = @expired_at %>
<% dmsf_public_url.save %>
- <%= link_to(h(file.title), dmsf_public_urls_url(:token => dmsf_public_url.token)) %>
- (<%= link_to(h(file.name), dmsf_public_urls_url(:token => dmsf_public_url.token)) %>)
+ <%= link_to h(file.title), dmsf_public_urls_url(token: dmsf_public_url.token) %>
+ (<%= link_to h(file.name), dmsf_public_urls_url(token: dmsf_public_url.token) %>)
<% else %>
<%= link_to(h(file.title), dmsf_file_url(file)) %>
(<%= link_to(h(file.name), dmsf_file_url(file)) %>)
@@ -71,11 +71,11 @@
<% dmsf_public_url.user = @author %>
<% dmsf_public_url.expire_at = @expired_at %>
<% dmsf_public_url.save %>
- <%= link_to(h(file.title), dmsf_public_urls_url(:token => dmsf_public_url.token)) %>
- (<%= link_to(h(file.name), dmsf_public_urls_url(:token => dmsf_public_url.token)) %>)
+ <%= link_to h(file.title), dmsf_public_urls_url(token: dmsf_public_url.token) %>
+ (<%= link_to h(file.name), dmsf_public_urls_url(token: dmsf_public_url.token) %>)
<% else %>
- <%= link_to(h(file.title), dmsf_file_url(file)) %>
- (<%= link_to(h(file.name), dmsf_file_url(file)) %>)
+ <%= link_to h(file.title), dmsf_file_url(file) %>
+ (<%= link_to h(file.name), dmsf_file_url(file) %>)
<% end %>
<% files << file %>
diff --git a/app/views/dmsf_mailer/send_documents.text.erb b/app/views/dmsf_mailer/send_documents.text.erb
index 06f71eb8..16acf882 100644
--- a/app/views/dmsf_mailer/send_documents.text.erb
+++ b/app/views/dmsf_mailer/send_documents.text.erb
@@ -42,7 +42,7 @@
<% dmsf_public_url.user = @author %>
<% dmsf_public_url.expire_at = @expired_at %>
<% dmsf_public_url.save %>
- <%= dmsf_public_urls_url(:token => dmsf_public_url.token) %>
+ <%= dmsf_public_urls_url(token: dmsf_public_url.token) %>
<% else %>
<%= dmsf_file_url(file) %>
<% end %>
@@ -64,7 +64,7 @@
<% dmsf_public_url.user = @author %>
<% dmsf_public_url.expire_at = @expired_at %>
<% dmsf_public_url.save %>
- <%= dmsf_public_urls_url(:token => dmsf_public_url.token) %>
+ <%= dmsf_public_urls_url(token: dmsf_public_url.token) %>
<% else %>
<%= dmsf_file_url(file) %>
<% end %>
diff --git a/app/views/dmsf_mailer/workflow_notification.html.erb b/app/views/dmsf_mailer/workflow_notification.html.erb
index 9ad9cc07..8baba3af 100644
--- a/app/views/dmsf_mailer/workflow_notification.html.erb
+++ b/app/views/dmsf_mailer/workflow_notification.html.erb
@@ -23,10 +23,9 @@
<%= @text2 %> <% if @revision.dmsf_file.dmsf_folder %> - <%= link_to @revision.dmsf_file.dmsf_folder.title, - dmsf_folder_url(:id => @revision.dmsf_file.project, :folder_id => @revision.dmsf_file.dmsf_folder) %> + <%= link_to @revision.dmsf_file.dmsf_folder.title, + dmsf_folder_url(id: @revision.dmsf_file.project, folder_id: @revision.dmsf_file.dmsf_folder) %> <% else %> - <%= link_to l(:link_documents), - dmsf_folder_url(:id => @revision.dmsf_file.project) %> + <%= link_to l(:link_documents), dmsf_folder_url(id: @revision.dmsf_file.project) %> <% end %>.
\ No newline at end of file diff --git a/app/views/dmsf_mailer/workflow_notification.text.erb b/app/views/dmsf_mailer/workflow_notification.text.erb index ffe66917..7bf618b9 100644 --- a/app/views/dmsf_mailer/workflow_notification.text.erb +++ b/app/views/dmsf_mailer/workflow_notification.text.erb @@ -22,7 +22,7 @@ <%= @user.name %>, <%= @text1 %> <% if @revision.dmsf_file.dmsf_folder %> -<%= @text2 %> <%= dmsf_folder_url(:id => @revision.dmsf_file.project, :folder_id => @revision.dmsf_file.dmsf_folder) %>. +<%= @text2 %> <%= dmsf_folder_url(id: @revision.dmsf_file.project, folder_id: @revision.dmsf_file.dmsf_folder) %>. <% else %> -<%= @text2 %> <%= dmsf_folder_url(:id => @revision.dmsf_file.project) %>. +<%= @text2 %> <%= dmsf_folder_url(id: @revision.dmsf_file.project) %>. <% end %> \ No newline at end of file diff --git a/app/views/dmsf_public_urls/_new.html.erb b/app/views/dmsf_public_urls/_new.html.erb index afa11be0..ca04310c 100644 --- a/app/views/dmsf_public_urls/_new.html.erb +++ b/app/views/dmsf_public_urls/_new.html.erb @@ -21,8 +21,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. %> -"> - <%= check_box_tag('email[public_urls]', 1, false) %> <%= l(:label_public_urls) %> - <%= date_field_tag('email[expired_at]', '', :value => (DateTime.current + 3.days).to_date, :size => 10, - :readonly => true) + calendar_for('email_expired_at') %> +"> + <%= check_box_tag 'email[public_urls]', 1, false %> <%= l(:label_public_urls) %> + <%= date_field_tag('email[expired_at]', '', value: (DateTime.current + 3.days).to_date, size: 10, readonly: true) + + calendar_for('email_expired_at') %> diff --git a/app/views/dmsf_state/_user_pref.html.erb b/app/views/dmsf_state/_user_pref.html.erb index 6ac52cb3..ebcc128f 100644 --- a/app/views/dmsf_state/_user_pref.html.erb +++ b/app/views/dmsf_state/_user_pref.html.erb @@ -34,20 +34,19 @@<%= content_tag(:label, l(:label_notifications)) %> - <%= select_tag( - 'email_notify', + <%= select_tag 'email_notify', options_for_select([[l(:select_option_default), nil], [l(:select_option_activated), true], [l(:select_option_deactivated), false]], - :selected => mail_notification)) %> + selected: mail_notification) %>
- <%= content_tag(:label, l(:label_title_format)) %> - <%= text_field_tag 'title_format', title_format, :size => 10 %> + <%= content_tag :label, l(:label_title_format) %> + <%= text_field_tag 'title_format', title_format, size: 10 %> <%= l(:text_title_format) %>
- <%= content_tag(:label, l(:label_dmsf_fast_links)) %> - <%= check_box_tag('fast_links', 1, fast_links) %> + <%= content_tag :label, l(:label_dmsf_fast_links) %> + <%= check_box_tag 'fast_links', 1, fast_links %> <%= l(:text_dmsf_fast_links_info) %> @@ -58,14 +57,13 @@
<%= content_tag(:label, "#{l(:label_act_as_attachable)}:") %> - <%= select_tag( - 'act_as_attachable', + <%= select_tag 'act_as_attachable', options_for_select([ [l(:label_attachment_plural) + ' & ' + l(:menu_dmsf), Project::ATTACHABLE_DMS_AND_ATTACHMENTS], [l(:label_attachment_plural), Project::ATTACHABLE_ATTACHMENTS], - ],:selected => @project.dmsf_act_as_attachable)) %> + ], selected: @project.dmsf_act_as_attachable) %>
<% end %> - <%= submit_tag(l(:submit_save), :title => l(:title_save_preferences)) %> + <%= submit_tag l(:submit_save), title: l(:title_save_preferences) %> <% end %> \ No newline at end of file diff --git a/app/views/dmsf_upload/_form.html.erb b/app/views/dmsf_upload/_form.html.erb index 3b3a6c85..a38d7b03 100644 --- a/app/views/dmsf_upload/_form.html.erb +++ b/app/views/dmsf_upload/_form.html.erb @@ -25,19 +25,19 @@ <% container.saved_dmsf_attachments.each_with_index do |attachment, i| %> <% end %> @@ -50,19 +50,19 @@ <% end %> @@ -71,27 +71,27 @@ <% if defined?(container) && container %> <%= link_to l(:label_link_from), - new_dmsf_link_path(:project_id => container.project.id, :type => 'link_from', :container => container.class.name), - :title => l(:title_create_link), :class => 'icon icon-add file_selector', :remote => true %> + new_dmsf_link_path(project_id: container.project.id, type: 'link_from', container: container.class.name), + title: l(:title_create_link), class: 'icon icon-add file_selector', remote: true %> <% end %> diff --git a/app/views/dmsf_upload/_upload_file.html.erb b/app/views/dmsf_upload/_upload_file.html.erb index f2adedef..73e4027b 100644 --- a/app/views/dmsf_upload/_upload_file.html.erb +++ b/app/views/dmsf_upload/_upload_file.html.erb @@ -23,28 +23,28 @@ %>- <%= label_tag("commited_files[#{i}][title]", l(:label_title)) %> - <%= text_field_tag("commited_files[#{i}][title]", upload.title, :required => true) %> + <%= label_tag "commited_files[#{i}][title]", l(:label_title) %> + <%= text_field_tag "commited_files[#{i}][title]", upload.title, required:true %>
- <%= label_tag('', l(:label_filename)) %> - <%= text_field_tag(:name, h(upload.name), :readonly => true) %> - <%= hidden_field_tag("commited_files[#{i}][name]", upload.name) %> + <%= label_tag '', l(:label_filename) %> + <%= text_field_tag :name, h(upload.name), readonly: true %> + <%= hidden_field_tag "commited_files[#{i}][name]", upload.name %>
- <%= label_tag("commited_files[#{i}][description]", l(:label_description)) %> - <%= text_area_tag("commited_files[#{i}][description]", upload.description, :rows => 6, :class => 'wiki-edit') %> + <%= label_tag "commited_files[#{i}][description]", l(:label_description) %> + <%= text_area_tag "commited_files[#{i}][description]", upload.description, rows: 6, class: 'wiki-edit' %>
- <%= label_tag("commited_files[#{i}][version]_minor", l(:label_dmsf_version)) %>
- <%= radio_button_tag("commited_files[#{i}][version]", 1, true) %>
+ <%= label_tag "commited_files[#{i}][version]_minor", l(:label_dmsf_version) %>
+ <%= radio_button_tag "commited_files[#{i}][version]", 1, true %>
<%= DmsfUploadHelper::gui_version(upload.major_version) %>.<%= DmsfUploadHelper::gui_version(DmsfUploadHelper.increase_version(upload.minor_version, 1)) %>
<%= l(:option_version_minor) %>
- <%= radio_button_tag("commited_files[#{i}][version]", 2) %>
+ <%= radio_button_tag "commited_files[#{i}][version]", 2 %>
<%= DmsfUploadHelper::gui_version(DmsfUploadHelper::increase_version(upload.major_version, 1)) %>.0
<%= l(:option_version_major) %>
- <%= radio_button_tag("commited_files[#{i}][version]", 3) %>
+ <%= radio_button_tag "commited_files[#{i}][version]", 3 %>
<%= select_tag "commited_files[#{i}][custom_version_major]",
options_for_select(DmsfUploadHelper::major_version_select_options,
DmsfUploadHelper::gui_version(DmsfUploadHelper::increase_version(upload.major_version, 2))),
- :onchange => "$('#commited_files_#{i}_version_3').prop('checked', true)",
- :class => 'dmsf_select_version'%>.
+ onchange: "$('#commited_files_#{i}_version_3').prop('checked', true)",
+ class: 'dmsf_select_version'%>.
<%= select_tag "commited_files[#{i}][custom_version_minor]",
options_for_select(DmsfUploadHelper::minor_version_select_options,
DmsfUploadHelper::gui_version(DmsfUploadHelper.increase_version(upload.minor_version, 1))),
- :onchange => "$('#commited_files_#{i}_version_3').prop('checked', true)",
- :class => 'dmsf_select_version' %>
+ onchange: "$('#commited_files_#{i}_version_3').prop('checked', true)",
+ class: 'dmsf_select_version' %>
<%= l(:option_version_custom) %>
<%= label_tag '', l(:label_mime) %> - <%= text_field_tag(:name, h(upload.mime_type), :readonly => true) %> + <%= text_field_tag :name, h(upload.mime_type), readonly: true %>
- <%= label_tag('', l(:label_size)) %> - <%= text_field_tag(:name, number_to_human_size(upload.size), :readonly => true) %> + <%= label_tag '', l(:label_size) %> + <%= text_field_tag :name, number_to_human_size(upload.size), readonly: true %>
- <%= label_tag("commited_files[#{i}][comment]", l(:label_comment)) %> - <%= text_area_tag("commited_files[#{i}][comment]", upload.comment, :rows => 2, :class => 'wiki-edit') %> + <%= label_tag "commited_files[#{i}][comment]", l(:label_comment) %> + <%= text_area_tag "commited_files[#{i}][comment]", upload.comment, rows: 2, class: 'wiki-edit' %>
<%= l(:info_file_locked) %>
- <%= label_tag('', l(:label_title)) %> - <%= text_field_tag(:name, h(upload.title), :readonly => true) %> + <%= label_tag '', l(:label_title) %> + <%= text_field_tag :name, h(upload.title), readonly: true %>
- <%= label_tag('', l(:label_filename)) %> - <%= text_field_tag(:name, h(upload.name), :readonly => true) %> + <%= label_tag '', l(:label_filename) %> + <%= text_field_tag :name, h(upload.name), readonly: true %>
- <%= label_tag('', l(:label_description)) %> -
- <%= label_tag('', h(value.custom_field.name)) %> + <%= label_tag '', h(value.custom_field.name) %> <% value.value = nil if value.custom_field.dmsf_not_inheritable %> - <%= text_field_tag(:name, h(value.value), :readonly => true) %> + <%= text_field_tag :name, h(value.value), readonly: true %>
<% end %>- <%= label_tag('', l(:label_dmsf_version)) %> - <%= text_field_tag(:name, "#{DmsfUploadHelper::gui_version(upload.major_version)}.#{DmsfUploadHelper::gui_version(upload.minor_version)}", :readonly => true) %> + <%= label_tag '', l(:label_dmsf_version) %> + <%= text_field_tag :name, + "#{DmsfUploadHelper::gui_version(upload.major_version)}.#{DmsfUploadHelper::gui_version(upload.minor_version)}", + readonly: true %>
- <%= label_tag('', l(:label_mime)) %> - <%= text_field_tag(:name, h(upload.mime_type), :readonly => true) %> + <%= label_tag '', l(:label_mime) %> + <%= text_field_tag :name, h(upload.mime_type), readonly: true %>
- <%= label_tag('', l(:label_size)) %> - <%= text_field_tag(:name, h(number_to_human_size(upload.size)), :readonly => true) %> + <%= label_tag '', l(:label_size) %> + <%= text_field_tag :name, h(number_to_human_size(upload.size)), readonly: true %>
- <%= label_tag('', l(:label_comment)) %> -
@@ -38,13 +37,13 @@
<%= l(:label_dmsf_wokflow_action_reject) %>
- <%= text_area_tag :note, '', :placeholder => l(:message_dmsf_wokflow_note), :style => 'width: 90%' %>
+ <%= text_area_tag :note, '', placeholder: l(:message_dmsf_wokflow_note), style: 'width: 90%' %>
- <%= label_tag('workflow', "#{l(:link_workflow)}:") %> - <%= select_tag( - 'dmsf_workflow_id', - dmsf_workflows_for_select(@project, nil))%> + <%= label_tag 'workflow', "#{l(:link_workflow)}:" %> + <%= select_tag 'dmsf_workflow_id', dmsf_workflows_for_select(@project, nil)%>
<% if (!remote) && User.current.allowed_to?(:manage_workflows, @project) %>- <%= link_to l(:label_dmsf_workflow_new), new_dmsf_workflow_path(:project_id => @project.id), - :class => 'icon icon-add' %> + <%= link_to l(:label_dmsf_workflow_new), new_dmsf_workflow_path(project_id: @project.id), class: 'icon icon-add' %>
<% end %> <% end %> diff --git a/app/views/dmsf_workflows/_main.html.erb b/app/views/dmsf_workflows/_main.html.erb index 19e03b0d..742bafea 100644 --- a/app/views/dmsf_workflows/_main.html.erb +++ b/app/views/dmsf_workflows/_main.html.erb @@ -20,30 +20,28 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. %> -<% @workflows = DmsfWorkflow.active.sorted.where(:project_id => @project.id) if @project && @workflows.nil? %> +<% @workflows = DmsfWorkflow.active.sorted.where(project_id: @project.id) if @project && @workflows.nil? %> <% unless @project %>| <%=l(:field_name)%> | -+ | <%= l(:field_name) %> | +
<%= @dmsf_workflow.dmsf_workflow_steps[index].name if index %>
" class="hol">
- <%= form_for(@dmsf_workflow,
- :url => update_step_dmsf_workflow_path(step: index),
- :method => :put,
- :html => { id: "step-index-name-#{index}-form" }) do |f| %>
+ <%= form_for(@dmsf_workflow, url: update_step_dmsf_workflow_path(step: index), method: :put,
+ html: { id: "step-index-name-#{index}-form" }) do |f| %>
<%= f.text_field(:step_name, value: @dmsf_workflow.dmsf_workflow_steps[index].name, id: "dmsf_workflow_step_name_#{index}") %>
- <%= submit_tag l(:button_change), :class => 'small' %> + <%= submit_tag l(:button_change), class: 'small' %> <%= link_to_function( l(:button_cancel), "$('#step-index-#{index}-name').show(); $('#step-index-#{index}-approvers').show(); $('#step-index-#{index}-name-form').hide(); $('#step-index-#{index}-approvers-form').hide();") @@ -83,10 +81,8 @@ <% end %> " class="hol">
- <%= form_for(@dmsf_workflow,
- :url => update_step_dmsf_workflow_path(step: index),
- :method => :put,
- :html => {:id => "step-index-operator-#{index}-form"}) do |_| %>
+ <%= form_for(@dmsf_workflow, url: update_step_dmsf_workflow_path(step: index), method: :put,
+ html: { id: "step-index-operator-#{index}-form"}) do |_| %>
<% stps.each do |step| %>
@@ -112,10 +108,9 @@
<% end %>
- <%= submit_tag l(:button_change), :class => 'small' %> - <%= link_to_function( - l(:button_cancel), - "$('#step-index-#{index}-name').show(); $('#step-index-#{index}-approvers').show(); $('#step-index-#{index}-name-form').hide(); $('#step-index-#{index}-approvers-form').hide();") + <%= submit_tag l(:button_change), class: 'small' %> + <%= link_to_function l(:button_cancel), + "$('#step-index-#{index}-name').show(); $('#step-index-#{index}-approvers').show(); $('#step-index-#{index}-name-form').hide(); $('#step-index-#{index}-approvers-form').hide();" %> <% end %> @@ -125,8 +120,8 @@ <%= reorder_handle(@dmsf_workflow, url: url_for(action: 'edit', id: @dmsf_workflow, step: i) ) %> <%= link_to_function l(:button_edit), "$('#step-index-#{index}-name').hide(); $('#step-index-#{index}-approvers').hide(); $('#step-index-#{index}-name-form').show(); $('#step-index-#{index}-approvers-form').show();", - :class => 'icon icon-edit' %> - <%= delete_link edit_dmsf_workflow_path(@dmsf_workflow, step: i) %> + class: 'icon icon-edit' %> + <%= delete_link edit_dmsf_workflow_path @dmsf_workflow, step: i %> |
<% end %>
diff --git a/app/views/dmsf_workflows/action.js.erb b/app/views/dmsf_workflows/action.js.erb
index 0228aa4d..0919aed8 100644
--- a/app/views/dmsf_workflows/action.js.erb
+++ b/app/views/dmsf_workflows/action.js.erb
@@ -22,6 +22,6 @@
var modal = $('#ajax-modal');
-modal.html('<%= escape_javascript(render :partial => 'action', :locals => {:workflow => @dmsf_workflow}) %>');
+modal.html('<%= escape_javascript(render partial: 'action', locals: { workflow: @dmsf_workflow }) %>');
showModal('ajax-modal', '35%');
-modal.addClass('new-action');
\ No newline at end of file
+modal.addClass('new-action');
diff --git a/app/views/dmsf_workflows/assign.js.erb b/app/views/dmsf_workflows/assign.js.erb
index 5d34351a..f7103772 100644
--- a/app/views/dmsf_workflows/assign.js.erb
+++ b/app/views/dmsf_workflows/assign.js.erb
@@ -22,6 +22,6 @@
var modal = $('#ajax-modal');
-modal.html('<%= escape_javascript(render :partial => 'assign') %>');
+modal.html('<%= escape_javascript(render partial: 'assign') %>');
showModal('ajax-modal', '30%');
-modal.addClass('assignment');
\ No newline at end of file
+modal.addClass('assignment');
diff --git a/app/views/dmsf_workflows/index.html.erb b/app/views/dmsf_workflows/index.html.erb
index debd5e83..4733d16c 100644
--- a/app/views/dmsf_workflows/index.html.erb
+++ b/app/views/dmsf_workflows/index.html.erb
@@ -20,4 +20,4 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
-<%= render 'main' %>
\ No newline at end of file
+<%= render 'main' %>
diff --git a/app/views/dmsf_workflows/log.html.erb b/app/views/dmsf_workflows/log.html.erb
index 81e292fb..720fd000 100644
--- a/app/views/dmsf_workflows/log.html.erb
+++ b/app/views/dmsf_workflows/log.html.erb
@@ -19,4 +19,4 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
-<%= render partial: 'log', locals: { workflow: @dmsf_workflow, revision: @revision } %>
\ No newline at end of file
+<%= render partial: 'log', locals: { workflow: @dmsf_workflow, revision: @revision } %>
diff --git a/app/views/dmsf_workflows/new.html.erb b/app/views/dmsf_workflows/new.html.erb
index bf4b81ed..ff164692 100644
--- a/app/views/dmsf_workflows/new.html.erb
+++ b/app/views/dmsf_workflows/new.html.erb
@@ -24,22 +24,23 @@
<% @project = Project.find_by_id params[:dmsf_workflow][:project_id] %>
<% end %>
<% if @project %>
- - <%= link_to(h(folder.title), - {:controller => 'dmsf', :action => 'show', :id => folder.project, :folder_id => folder}, - :class => 'icon icon-folder') %> + <%= link_to h(folder.title), { controller: 'dmsf', action: 'show', id: folder.project, folder_id: folder}, + class: 'icon icon-folder' %> | <% if folder.dmsf_folder %> - <%= link_to(h(folder.dmsf_folder.title), - {:controller => 'dmsf', :action => 'show', :id => folder.project, :folder_id => folder.dmsf_folder}) %> + <%= link_to h(folder.dmsf_folder.title), + { controller: 'dmsf', action: 'show', id: folder.project, folder_id: folder.dmsf_folder } %> <% else %> - <%= link_to(l(:link_documents), {:controller => 'dmsf', :action => 'show', :id=> folder.project }) %> + <%= link_to l(:link_documents), { controller: 'dmsf', action: 'show', id: folder.project } %> <% end %> | @@ -70,17 +69,16 @@ <%= link_to_project(file.project) if file.project %>- <%= link_to(h(file.title), - {:controller => 'dmsf_files', :action => :show, :id => file }, - :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}") %> + <%= link_to h(file.title), { controller: 'dmsf_files', action: :show, id: file }, + class: "icon icon-file #{DmsfHelper.filetype_css(file.name)}" %> | <% if file.dmsf_folder %> - <%= link_to(h(file.dmsf_folder.title), - {:controller => 'dmsf', :action => 'show', :id => file.project, :folder_id => file.dmsf_folder}) %> + <%= link_to h(file.dmsf_folder.title), + { controller: 'dmsf', action: 'show', id: file.project, folder_id: file.dmsf_folder } %> <% else %> - <%= link_to_if(file.project, l(:link_documents), {:controller => 'dmsf', :action => 'show', - :id=> file.project }) %> + <%= link_to_if file.project, l(:link_documents), + { controller: 'dmsf', action: 'show', id: file.project } %> <% end %> | diff --git a/app/views/my/blocks/_open_approvals.html.erb b/app/views/my/blocks/_open_approvals.html.erb index b8df0ac5..e70cf51a 100644 --- a/app/views/my/blocks/_open_approvals.html.erb +++ b/app/views/my/blocks/_open_approvals.html.erb @@ -24,7 +24,7 @@ <% if @user %> <% all_assignments = DmsfWorkflowStepAssignment.joins( 'LEFT JOIN dmsf_workflow_step_actions ON dmsf_workflow_step_assignments.id = dmsf_workflow_step_actions.dmsf_workflow_step_assignment_id').where( - :dmsf_workflow_step_assignments => { :user_id => @user.id }).where( + dmsf_workflow_step_assignments: { user_id: @user.id }).where( ['dmsf_workflow_step_actions.id IS NULL OR dmsf_workflow_step_actions.action = ?', DmsfWorkflowStepAction::ACTION_DELEGATE]) %> <% all_assignments.find_each do |assignment| %> <% if assignment.dmsf_file_revision.dmsf_file.last_revision && @@ -67,44 +67,43 @@<% if assignment.dmsf_workflow_step.dmsf_workflow %> - <%= link_to( - assignment.dmsf_file_revision.workflow_str(false), + <%= link_to assignment.dmsf_file_revision.workflow_str(false), log_dmsf_workflow_path( - :project_id => assignment.dmsf_file_revision.dmsf_file.project_id, - :id => assignment.dmsf_workflow_step.dmsf_workflow_id, - :dmsf_file_revision_id => assignment.dmsf_file_revision_id), - :title => assignment.dmsf_file_revision.workflow_tooltip, - :remote => true) %> + project_id: assignment.dmsf_file_revision.dmsf_file.project_id, + id: assignment.dmsf_workflow_step.dmsf_workflow_id, + dmsf_file_revision_id: assignment.dmsf_file_revision_id), + title: assignment.dmsf_file_revision.workflow_tooltip, + remote: true %> <% else %> <%= assignment.dmsf_file_revision.workflow_str(false) %> <% end %> | <% if assignment.dmsf_file_revision && assignment.dmsf_file_revision.dmsf_file %> - <%= link_to(h(assignment.dmsf_file_revision.title), - {:controller => 'dmsf_files', :action => :show, :id => assignment.dmsf_file_revision.dmsf_file }) %> + <%= link_to h(assignment.dmsf_file_revision.title), + { controller: 'dmsf_files', action: :show, id: assignment.dmsf_file_revision.dmsf_file } %> <% end %> | <% if assignment.dmsf_file_revision %> <% if assignment.dmsf_file_revision.dmsf_file.dmsf_folder %> - <%= link_to(h(assignment.dmsf_file_revision.dmsf_file.dmsf_folder.title), - {:controller => 'dmsf', :action => 'show', :id => assignment.dmsf_file_revision.dmsf_file.project, - :folder_id => assignment.dmsf_file_revision.dmsf_file.dmsf_folder}) %> + <%= link_to h(assignment.dmsf_file_revision.dmsf_file.dmsf_folder.title), + { controller: 'dmsf', action: 'show', id: assignment.dmsf_file_revision.dmsf_file.project, + folder_id: assignment.dmsf_file_revision.dmsf_file.dmsf_folder} %> <% elsif assignment.dmsf_file_revision.dmsf_file.project %> - <%= link_to(l(:link_documents), {:controller => 'dmsf', :action => 'show', - :id => assignment.dmsf_file_revision.dmsf_file.project }) %> + <%= link_to l(:link_documents), + { controller: 'dmsf', action: 'show', id: assignment.dmsf_file_revision.dmsf_file.project } %> <% end %> <% end %> | - <%= render(:partial => 'dmsf_workflows/approval_workflow_button', - :locals => {:file => assignment.dmsf_file_revision.dmsf_file, - :file_approval_allowed => User.current.allowed_to?(:file_approval, + <%= render partial: 'dmsf_workflows/approval_workflow_button', + locals: { file: assignment.dmsf_file_revision.dmsf_file, + file_approval_allowed: User.current.allowed_to?(:file_approval, assignment.dmsf_file_revision.dmsf_file.project), - :workflows_available => nil, - :project => assignment.dmsf_file_revision.dmsf_file.project, - :wf => assignment.dmsf_workflow_step.dmsf_workflow, :dmsf_link_id => nil }) %> + workflows_available: nil, + project: assignment.dmsf_file_revision.dmsf_file.project, + wf: assignment.dmsf_workflow_step.dmsf_workflow, dmsf_link_id: nil } %> | <% end %> diff --git a/app/views/search/_container.html.erb b/app/views/search/_container.html.erb index 32494197..34ff6262 100644 --- a/app/views/search/_container.html.erb +++ b/app/views/search/_container.html.erb @@ -27,5 +27,5 @@ <% else %> <% title = dmsf_file_or_folder.project.name %> <% end %> -<%= link_to(h(title), dmsf_folder_path(:id => dmsf_file_or_folder.project, - :folder_id => dmsf_file_or_folder.dmsf_folder_id), :class => 'icon icon-folder') %> +<%= link_to h(title), dmsf_folder_path(id: dmsf_file_or_folder.project, + folder_id: dmsf_file_or_folder.dmsf_folder_id), class: 'icon icon-folder' %> diff --git a/app/views/settings/_dmsf_columns.html.erb b/app/views/settings/_dmsf_columns.html.erb index d3e45491..9d2f2b2b 100644 --- a/app/views/settings/_dmsf_columns.html.erb +++ b/app/views/settings/_dmsf_columns.html.erb @@ -33,7 +33,7 @@ <% columns.concat(cfs.map{ |c| c.name }) %> <% selected_columns = DmsfFolder::DEFAULT_COLUMNS if selected_columns.blank? %> <% columns.each_with_index do |column, i| %> - <%= check_box_tag('settings[dmsf_columns][]', column, selected_columns.include?(column), id: "dmsf_column_#{i}") %> + <%= check_box_tag 'settings[dmsf_columns][]', column, selected_columns.include?(column), id: "dmsf_column_#{i}" %> <%= h column.capitalize %>' end - file_view_url = url_for({:controller => :dmsf_files, :action => 'view', :id => dmsf_file}) + file_view_url = url_for({ controller: :dmsf_files, action: 'view', id: dmsf_file}) # Title, size html << ' | ' - html << link_to(h(dmsf_file.title),file_view_url, :target => '_blank', - :class => "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}", - :title => h(dmsf_file.last_revision.try(:tooltip)), + html << link_to(h(dmsf_file.title),file_view_url, target: '_blank', + class: "icon icon-file #{DmsfHelper.filetype_css(dmsf_file.name)}", + title: h(dmsf_file.last_revision.try(:tooltip)), 'data-downloadurl' => "#{dmsf_file.last_revision.detect_content_type}:#{h(dmsf_file.name)}:#{file_view_url}") html << "(#{number_to_human_size(dmsf_file.last_revision.size)})" html << " - #{h(dmsf_file.description)}" unless dmsf_file.description.blank? @@ -218,23 +218,23 @@ module RedmineDmsf html << ' | ' html << '' html diff --git a/lib/redmine_dmsf/hooks/views/my_account_view_hooks.rb b/lib/redmine_dmsf/hooks/views/my_account_view_hooks.rb deleted file mode 100644 index ec666730..00000000 --- a/lib/redmine_dmsf/hooks/views/my_account_view_hooks.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: utf-8 -# -# Redmine plugin for Document Management System "Features" -# -# Copyright © 2011-20 Karel Pičman
|---|