diff options
Diffstat (limited to 'app/helpers/workflows_helper.rb')
-rw-r--r-- | app/helpers/workflows_helper.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/helpers/workflows_helper.rb b/app/helpers/workflows_helper.rb index 1cec67a88..7ef6e9942 100644 --- a/app/helpers/workflows_helper.rb +++ b/app/helpers/workflows_helper.rb @@ -22,11 +22,20 @@ module WorkflowsHelper field.is_a?(CustomField) ? field.is_required? : %w(project_id tracker_id subject priority_id is_private).include?(field) end - def field_permission_tag(permissions, status, field) + def field_permission_tag(permissions, status, field, role) name = field.is_a?(CustomField) ? field.id.to_s : field options = [["", ""], [l(:label_readonly), "readonly"]] options << [l(:label_required), "required"] unless field_required?(field) + html_options = {} + selected = permissions[status.id][name] - select_tag("permissions[#{name}][#{status.id}]", options_for_select(options, permissions[status.id][name])) + hidden = field.is_a?(CustomField) && !field.visible? && !role.custom_fields.to_a.include?(field) + if hidden + options[0][0] = l(:label_hidden) + selected = '' + html_options[:disabled] = true + end + + select_tag("permissions[#{name}][#{status.id}]", options_for_select(options, selected), html_options) end end |