]> source.dussan.org Git - redmine.git/commitdiff
Refactor: extract method in bulk_update.
authorEric Davis <edavis@littlestreamsoftware.com>
Wed, 25 Aug 2010 14:59:16 +0000 (14:59 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Wed, 25 Aug 2010 14:59:16 +0000 (14:59 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4040 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb

index 29b131360509307e08671054266fe6772aa9c7bd..f10ba03bfaf5156bdf1ceaecd44a047f1079e312 100644 (file)
@@ -198,11 +198,8 @@ class IssuesController < ApplicationController
 
   def bulk_update
     @issues.sort!
+    attributes = parse_params_for_bulk_issue_attributes(params)
 
-    attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
-    attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
-    attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values]
-    
     unsaved_issue_ids = []
     @issues.each do |issue|
       issue.reload
@@ -318,4 +315,11 @@ private
       return false
     end
   end
+
+  def parse_params_for_bulk_issue_attributes(params)
+    attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
+    attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
+    attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values]
+    attributes
+  end
 end