summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-03 11:18:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-03 11:18:09 +0000
commitcab99aa5adf918ac6de25001912ea34c598fac83 (patch)
tree19e8c5a6cace414de530201fd49fb4b2a07e4219 /app
parente9810b5de643513f73ea07445e7d7ded731ef446 (diff)
downloadredmine-cab99aa5adf918ac6de25001912ea34c598fac83.tar.gz
redmine-cab99aa5adf918ac6de25001912ea34c598fac83.zip
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
Diffstat (limited to 'app')
-rw-r--r--app/controllers/issues_controller.rb2
-rw-r--r--app/helpers/custom_fields_helper.rb20
-rw-r--r--app/views/issues/bulk_edit.rhtml4
3 files changed, 22 insertions, 4 deletions
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 @@
</p>
<% @custom_fields.each do |custom_field| %>
-<p><label><%= h(custom_field.name) %>
-<%= select_tag "custom_field_values[#{custom_field.id}]", options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values) %></label>
-</p>
+<p><label><%= h(custom_field.name) %> <%= custom_field_tag_for_bulk_edit(custom_field) %></label></p>
<% end %>
<%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %>