From cab99aa5adf918ac6de25001912ea34c598fac83 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 3 Jan 2010 11:18:09 +0000 Subject: Allow bulk edit custom fields of any type (#461). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3278 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 2 +- app/helpers/custom_fields_helper.rb | 20 ++++++++++++++++++++ app/views/issues/bulk_edit.rhtml | 4 +--- 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 0d7ef7164..cd435ebe7 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -273,7 +273,7 @@ class IssuesController < ApplicationController return end @available_statuses = Workflow.available_statuses(@project) - @custom_fields = @project.all_issue_custom_fields.select {|f| f.field_format == 'list'} + @custom_fields = @project.all_issue_custom_fields end def move diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index e11f7ccfe..330b1aa93 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -66,6 +66,26 @@ module CustomFieldsHelper def custom_field_tag_with_label(name, custom_value) custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value) end + + def custom_field_tag_for_bulk_edit(custom_field) + field_name = "custom_field_values[#{custom_field.id}]" + field_id = "custom_field_values_#{custom_field.id}" + case custom_field.field_format + when "date" + text_field_tag(field_name, '', :id => field_id, :size => 10) + + calendar_for(field_id) + when "text" + text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%') + when "bool" + select_tag(field_name, options_for_select([[l(:label_no_change_option), ''], + [l(:general_text_yes), '1'], + [l(:general_text_no), '0']]), :id => field_id) + when "list" + select_tag(field_name, options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values), :id => field_id) + else + text_field_tag(field_name, '', :id => field_id) + end + end # Return a string used to display a custom value def show_value(custom_value) diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml index d8249a8af..db2ba0fa8 100644 --- a/app/views/issues/bulk_edit.rhtml +++ b/app/views/issues/bulk_edit.rhtml @@ -46,9 +46,7 @@

<% @custom_fields.each do |custom_field| %> -

-

+

<% end %> <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %> -- cgit v1.2.3