]> source.dussan.org Git - redmine.git/commitdiff
Adds css class to custom field input tags.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 1 May 2012 16:50:42 +0000 (16:50 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 1 May 2012 16:50:42 +0000 (16:50 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9608 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/custom_fields_helper.rb
public/stylesheets/application.css
test/functional/issues_controller_test.rb

index 5e63a5634f5d96d398e976e06ffb4bbc03c0e6f0..789d527b5c9b275d50c1286f60467357d830a5aa 100644 (file)
@@ -39,15 +39,17 @@ module CustomFieldsHelper
     field_name << "[]" if custom_field.multiple?
     field_id = "#{name}_custom_field_values_#{custom_field.id}"
 
+    tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
+
     field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
     case field_format.try(:edit_as)
     when "date"
-      text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) +
+      text_field_tag(field_name, custom_value.value, tag_options.merge(:size => 10)) +
       calendar_for(field_id)
     when "text"
-      text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%')
+      text_area_tag(field_name, custom_value.value, tag_options.merge(:rows => 3))
     when "bool"
-      hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, :id => field_id)
+      hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options)
     when "list"
       blank_option = ''
       unless custom_field.multiple?
@@ -60,13 +62,13 @@ module CustomFieldsHelper
         end
       end
       s = select_tag(field_name, blank_option.html_safe + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value),
-        :id => field_id, :multiple => custom_field.multiple?)
+        tag_options.merge(:multiple => custom_field.multiple?))
       if custom_field.multiple?
         s << hidden_field_tag(field_name, '')
       end
       s
     else
-      text_field_tag(field_name, custom_value.value, :id => field_id)
+      text_field_tag(field_name, custom_value.value, tag_options)
     end
   end
 
@@ -86,26 +88,28 @@ module CustomFieldsHelper
     field_name = "#{name}[custom_field_values][#{custom_field.id}]"
     field_name << "[]" if custom_field.multiple?
     field_id = "#{name}_custom_field_values_#{custom_field.id}"
+
+    tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
+
     field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
     case field_format.try(:edit_as)
       when "date"
-        text_field_tag(field_name, '', :id => field_id, :size => 10) +
+        text_field_tag(field_name, '', tag_options.merge(:size => 10)) +
         calendar_for(field_id)
       when "text"
-        text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%')
+        text_area_tag(field_name, '', tag_options.merge(:rows => 3))
       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)
+                                                   [l(:general_text_no), '0']]), tag_options)
       when "list"
         options = []
         options << [l(:label_no_change_option), ''] unless custom_field.multiple?
         options << [l(:label_none), '__none__'] unless custom_field.is_required?
         options += custom_field.possible_values_options(projects)
-        select_tag(field_name, options_for_select(options),
-          :id => field_id, :multiple => custom_field.multiple?)
+        select_tag(field_name, options_for_select(options), tag_options.merge(:multiple => custom_field.multiple?))
       else
-        text_field_tag(field_name, '', :id => field_id)
+        text_field_tag(field_name, '', tag_options)
     end
   end
 
index 48e56ca38f6ed951281ea6dc687c8ad264e02222..03fb2960afe428d0a15cd04310e372a63c7b5a27 100644 (file)
@@ -521,6 +521,8 @@ a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px
 em.info {font-style:normal;font-size:90%;color:#888;display:block;}
 em.info.error {padding-left:20px; background:url(../images/exclamation.png) no-repeat 0 50%;}
 
+textarea.text_cf {width:90%;}
+
 /* Project members tab */
 div#tab-content-members .splitcontentleft, div#tab-content-memberships .splitcontentleft, div#tab-content-users .splitcontentleft { width: 64% }
 div#tab-content-members .splitcontentright, div#tab-content-memberships .splitcontentright, div#tab-content-users .splitcontentright { width: 34% }
index bf24ff368e88853b8d1ec379f70b335e392a1650..d719137f12e5fdd922fc54433770bbdb672b7c30 100644 (file)
@@ -1268,7 +1268,7 @@ class IssuesControllerTest < ActionController::TestCase
     assert_template 'new'
 
     assert_tag 'select',
-      :attributes => {:name => 'issue[custom_field_values][1]'},
+      :attributes => {:name => 'issue[custom_field_values][1]', :class => 'list_cf'},
       :children => {:count => 4},
       :child => {:tag => 'option', :attributes => {:value => 'MySQL'}, :content => 'MySQL'}
   end
@@ -2740,7 +2740,7 @@ class IssuesControllerTest < ActionController::TestCase
     assert_template 'bulk_edit'
 
     assert_tag :select,
-      :attributes => {:name => "issue[custom_field_values][#{field.id}]"},
+      :attributes => {:name => "issue[custom_field_values][#{field.id}]", :class => 'user_cf'},
       :children => {
         :only => {:tag => 'option'},
         :count => Project.find(1).users.count + 2 # "no change" + "none" options