Index: app/helpers/issues_helper.rb =================================================================== --- app/helpers/issues_helper.rb (revision 10483) +++ app/helpers/issues_helper.rb (working copy) @@ -135,12 +135,13 @@ end def render_custom_fields_rows(issue) - return if issue.custom_field_values.empty? + local_viewablecf=issue.viewable_custom_field_values + return if local_viewablecf.empty? ordered_values = [] - half = (issue.custom_field_values.size / 2.0).ceil + half = (local_viewablecf.size / 2.0).ceil half.times do |i| - ordered_values << issue.custom_field_values[i] - ordered_values << issue.custom_field_values[i + half] + ordered_values << local_viewablecf[i] + ordered_values << local_viewablecf[i + half] end s = "\n" n = 0 Index: app/helpers/workflows_helper.rb =================================================================== --- app/helpers/workflows_helper.rb (revision 10483) +++ app/helpers/workflows_helper.rb (working copy) @@ -25,6 +25,7 @@ def field_permission_tag(permissions, status, field) name = field.is_a?(CustomField) ? field.id.to_s : field options = [["", ""], [l(:label_readonly), "readonly"]] + options << [l(:label_hidden), "hidden"] unless field_required?(field) options << [l(:label_required), "required"] unless field_required?(field) select_tag("permissions[#{name}][#{status.id}]", options_for_select(options, permissions[status.id][name])) Index: app/models/workflow_permission.rb =================================================================== --- app/models/workflow_permission.rb (revision 10483) +++ app/models/workflow_permission.rb (working copy) @@ -16,13 +16,13 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WorkflowPermission < WorkflowRule - validates_inclusion_of :rule, :in => %w(readonly required) + validates_inclusion_of :rule, :in => %w(readonly required hidden) validate :validate_field_name # Replaces the workflow permissions for the given tracker and role # # Example: - # WorkflowPermission.replace_permissions role, tracker, {'due_date' => {'1' => 'readonly', '2' => 'required'}} + # WorkflowPermission.replace_permissions role, tracker, {'due_date' => {'1' => 'readonly', '2' => 'required', '3' => 'hidden'}} def self.replace_permissions(tracker, role, permissions) destroy_all(:tracker_id => tracker.id, :role_id => role.id) Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 10483) +++ app/models/issue.rb (working copy) @@ -416,6 +416,14 @@ end end + # Returns the custom_field_values that can be viewed by the given user + # For now: just exclude Fix Info and RNs, as it is printed seperately below description. + def viewable_custom_field_values(user=nil) + custom_field_values.reject do |value| + hidden_attribute_names(user).include?(value.custom_field_id.to_s) + end + end + # Returns the names of attributes that are read-only for user or the current user # For users with multiple roles, the read-only fields are the intersection of # read-only fields of each role @@ -428,6 +436,11 @@ workflow_rule_by_attribute(user).reject {|attr, rule| rule != 'readonly'}.keys end + # Same as above, but for hidden fields + def hidden_attribute_names(user=nil) + workflow_rule_by_attribute(user).reject {|attr, rule| rule != 'hidden'}.keys + end + # Returns the names of required attributes for user or the current user # For users with multiple roles, the required fields are the intersection of # required fields of each role Index: app/views/issues/_form_custom_fields.html.erb =================================================================== --- app/views/issues/_form_custom_fields.html.erb (revision 10483) +++ app/views/issues/_form_custom_fields.html.erb (working copy) @@ -1,7 +1,7 @@
<% i = 0 %> -<% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %> +<% split_on = (@issue.editable_custom_field_values.size / 2.0).ceil - 1 %> <% @issue.editable_custom_field_values.each do |value| %>

<%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %>

<% if i == split_on -%> Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (revision 10483) +++ config/locales/en.yml (working copy) @@ -867,6 +867,7 @@ label_fields_permissions: Fields permissions label_readonly: Read-only label_required: Required + label_hidden: " Hidden " label_attribute_of_project: "Project's %{name}" label_attribute_of_author: "Author's %{name}" label_attribute_of_assigned_to: "Assignee's %{name}"