From 7275b6fd899b01e49da9ee06ae1fd3ebe4ca5097 Mon Sep 17 00:00:00 2001 From: Akira Saito Date: Thu, 16 Apr 2015 23:23:44 +0900 Subject: [PATCH] bugfix refs #35069 --- app/helpers/application_helper.rb | 18 +++++++++++++++++- app/views/hooks/_quick_edit_context.html.erb | 16 ++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4b3e464..a0a4b51 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,7 +5,23 @@ module ApplicationHelper Redmine::VERSION::MAJOR * 10 + Redmine::VERSION::MINOR end - def editable(attribute_name, can) + def editable(attribute_name, can, readonly_fields) + if readonly_fields.include?(attribute_name.to_s) + return false + end + + if redmine_version() >= 30 + return can[:edit] + else + return can[:update] + end + end + + def editable_custom_field(custom_field, can, readonly_fields) + if readonly_fields.include?(custom_field.id.to_s) + return false + end + if redmine_version() >= 30 return can[:edit] else diff --git a/app/views/hooks/_quick_edit_context.html.erb b/app/views/hooks/_quick_edit_context.html.erb index 485291b..081c0d4 100644 --- a/app/views/hooks/_quick_edit_context.html.erb +++ b/app/views/hooks/_quick_edit_context.html.erb @@ -8,6 +8,10 @@ %w{string date int text link float}.include?(f.field_format) && ( excludes.empty? || excludes.none? {|ex| ex.match(f.name)} ) end + readonly_fields = @issues.map {|issue| issue.read_only_attribute_names(User.current)} + readonly_fields.flatten! + readonly_fields.uniq! + first_issue = @issues.first first_issue_id = first_issue.id if @issues.size > 1 @@ -28,19 +32,19 @@
  • <%= l(:button_quick_edit) %>