Index: app/helpers/custom_fields_helper.rb
===================================================================
--- app/helpers/custom_fields_helper.rb (revision 2294)
+++ app/helpers/custom_fields_helper.rb (working copy)
@@ -49,6 +49,17 @@
end
end
+ # Return custom field html tag corresponding to its format fpr bulk edit page
+ def custom_field_tag_bulk_edit(custom_field)
+ field_name = "custom_fields[#{custom_field.id}]"
+ field_id = "custom_fields_#{custom_field.id}"
+ case custom_field.field_format
+ when "list"
+ blank_option = ""
+ select_tag(field_name, blank_option + options_for_select(custom_field.possible_values), :id => field_id)
+
+ end
+ end
# Return custom field label tag
def custom_field_label_tag(name, custom_value)
content_tag "label", custom_value.custom_field.name +
Index: app/controllers/issues_controller.rb
===================================================================
--- app/controllers/issues_controller.rb (revision 2294)
+++ app/controllers/issues_controller.rb (working copy)
@@ -235,6 +235,24 @@
unsaved_issue_ids = []
@issues.each do |issue|
+ # load custom field values
+ @custom_values = issue.available_custom_fields.collect { |x|
+ CustomValue.new(:custom_field => x,
+ :value => (params[:custom_fields] ? params[:custom_fields][x.id.to_s] : nil)) }
+ if @custom_values
+ # reject the empty values
+ @custom_values = @custom_values.reject { |v| v.value.nil? || v.value.blank? }
+ # update custom field value if exist
+ issue.custom_values = issue.custom_values.clone.collect {|v|
+ newValue=@custom_values.detect{|c|c.custom_field.id==v.custom_field.id}
+ newValue =v.clone if newValue.nil?
+ newValue
+ }
+ # add custom value if currently not exist
+ @custom_values.each {|c|
+ issue.custom_values<
+ <% @custom_fields.each do | field | %> + <%=content_tag "label", field.name,:for => "custom_fields_#{field.id}" %>: <%= custom_field_tag_bulk_edit field%> + <% end %> +
<%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %>