From 1e6d33edfde0f361d671209ce7970557e32dd3e9 Mon Sep 17 00:00:00 2001 From: Anthony Callegaro Date: Fri, 13 Feb 2015 09:43:52 +0100 Subject: [PATCH] Include 2.6.X patches from https://github.com/alexwais/redmine_workflow_hidden_fields/issues/5 --- lib/pdf.rb | 7 +------ .../workflows_helper_patch.rb | 15 +++++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/pdf.rb b/lib/pdf.rb index 41b8fcf..6995d69 100644 --- a/lib/pdf.rb +++ b/lib/pdf.rb @@ -17,11 +17,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -require 'tcpdf' -require 'fpdf/chinese' -require 'fpdf/japanese' -require 'fpdf/korean' - if RUBY_VERSION < '1.9' require 'iconv' end @@ -33,7 +28,7 @@ module PDF include ActionView::Helpers::NumberHelper include IssuesHelper - class ITCPDF < TCPDF + class ITCPDF < RBPDF include Redmine::I18n attr_accessor :footer_date diff --git a/lib/redmine_workflow_hidden_fields/workflows_helper_patch.rb b/lib/redmine_workflow_hidden_fields/workflows_helper_patch.rb index b8c1f67..6c2fb08 100644 --- a/lib/redmine_workflow_hidden_fields/workflows_helper_patch.rb +++ b/lib/redmine_workflow_hidden_fields/workflows_helper_patch.rb @@ -11,13 +11,20 @@ def self.included(base) module InstanceMethods - def field_permission_tag_with_hidden(permissions, status, field, role) + def field_permission_tag_with_hidden(permissions, status, field, roles) name = field.is_a?(CustomField) ? field.id.to_s : field options = [["", ""], [l(:label_readonly), "readonly"]] options << [l(:label_hidden), "hidden"] options << [l(:label_required), "required"] unless field_required?(field) html_options = {} - selected = permissions[status.id][name] + if perm = permissions[status.id][name] + if perm.uniq.size > 1 || perm.size < @roles.size * @trackers.size + options << [l(:label_no_change_option), "no_change"] + selected = 'no_change' + else + selected = perm.first + end + end hidden = field.is_a?(CustomField) && !field.visible? && !role.custom_fields.to_a.include?(field) if hidden @@ -26,9 +33,9 @@ def field_permission_tag_with_hidden(permissions, status, field, role) html_options[:disabled] = true end - select_tag("permissions[#{name}][#{status.id}]", options_for_select(options, selected), html_options) + select_tag("permissions[#{status.id}][#{name}]", options_for_select(options, selected), html_options) end end end -end \ No newline at end of file +end