From 303d2353248a6084763c7bdb1cdc3ff98597a682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Fri, 7 Jun 2019 10:21:43 +0200 Subject: [PATCH] Access to user's preferencies via properties --- app/controllers/dmsf_controller.rb | 2 +- app/controllers/dmsf_files_controller.rb | 2 +- lib/redmine_dmsf/hooks/views/issue_view_hooks.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 1aa4aca4..275c99ac 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -576,7 +576,7 @@ class DmsfController < ApplicationController 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 + @tree_view = (User.current.pref.dmsf_tree_view == '1') && (!%w(atom xml json).include?(params[:format])) && !tag end def copy_folder(folder) diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index c95e9f1a..7126583f 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -358,7 +358,7 @@ class DmsfFilesController < ApplicationController 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 + @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/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb b/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb index 57e68f74..769abfe9 100644 --- a/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb @@ -93,7 +93,7 @@ module RedmineDmsf end def view_issues_edit_notes_bottom_style(context={}) - if (User.current.pref[:dmsf_attachments_upload_choice] == 'Attachments') || + if (User.current.pref.dmsf_attachments_upload_choice == 'Attachments') || !allowed_to_attach_documents(context[:container]) '' else @@ -148,7 +148,7 @@ module RedmineDmsf container = context[:container] if allowed_to_attach_documents(container) html = (description ? '" + html << " style=\"#{(User.current.pref.dmsf_attachments_upload_choice == 'Attachments') ? 'display: none;' : ''}\">" if label html << "" html << ""