##// END OF EJS Templates
Adds css class to custom field input tags....
Jean-Philippe Lang -
r9425:c085367bb63b
parent child
Show More
@@ -39,15 +39,17 module CustomFieldsHelper
39 39 field_name << "[]" if custom_field.multiple?
40 40 field_id = "#{name}_custom_field_values_#{custom_field.id}"
41 41
42 tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
43
42 44 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
43 45 case field_format.try(:edit_as)
44 46 when "date"
45 text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) +
47 text_field_tag(field_name, custom_value.value, tag_options.merge(:size => 10)) +
46 48 calendar_for(field_id)
47 49 when "text"
48 text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%')
50 text_area_tag(field_name, custom_value.value, tag_options.merge(:rows => 3))
49 51 when "bool"
50 hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, :id => field_id)
52 hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options)
51 53 when "list"
52 54 blank_option = ''
53 55 unless custom_field.multiple?
@@ -60,13 +62,13 module CustomFieldsHelper
60 62 end
61 63 end
62 64 s = select_tag(field_name, blank_option.html_safe + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value),
63 :id => field_id, :multiple => custom_field.multiple?)
65 tag_options.merge(:multiple => custom_field.multiple?))
64 66 if custom_field.multiple?
65 67 s << hidden_field_tag(field_name, '')
66 68 end
67 69 s
68 70 else
69 text_field_tag(field_name, custom_value.value, :id => field_id)
71 text_field_tag(field_name, custom_value.value, tag_options)
70 72 end
71 73 end
72 74
@@ -86,26 +88,28 module CustomFieldsHelper
86 88 field_name = "#{name}[custom_field_values][#{custom_field.id}]"
87 89 field_name << "[]" if custom_field.multiple?
88 90 field_id = "#{name}_custom_field_values_#{custom_field.id}"
91
92 tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
93
89 94 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
90 95 case field_format.try(:edit_as)
91 96 when "date"
92 text_field_tag(field_name, '', :id => field_id, :size => 10) +
97 text_field_tag(field_name, '', tag_options.merge(:size => 10)) +
93 98 calendar_for(field_id)
94 99 when "text"
95 text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%')
100 text_area_tag(field_name, '', tag_options.merge(:rows => 3))
96 101 when "bool"
97 102 select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
98 103 [l(:general_text_yes), '1'],
99 [l(:general_text_no), '0']]), :id => field_id)
104 [l(:general_text_no), '0']]), tag_options)
100 105 when "list"
101 106 options = []
102 107 options << [l(:label_no_change_option), ''] unless custom_field.multiple?
103 108 options << [l(:label_none), '__none__'] unless custom_field.is_required?
104 109 options += custom_field.possible_values_options(projects)
105 select_tag(field_name, options_for_select(options),
106 :id => field_id, :multiple => custom_field.multiple?)
110 select_tag(field_name, options_for_select(options), tag_options.merge(:multiple => custom_field.multiple?))
107 111 else
108 text_field_tag(field_name, '', :id => field_id)
112 text_field_tag(field_name, '', tag_options)
109 113 end
110 114 end
111 115
@@ -521,6 +521,8 a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px
521 521 em.info {font-style:normal;font-size:90%;color:#888;display:block;}
522 522 em.info.error {padding-left:20px; background:url(../images/exclamation.png) no-repeat 0 50%;}
523 523
524 textarea.text_cf {width:90%;}
525
524 526 /* Project members tab */
525 527 div#tab-content-members .splitcontentleft, div#tab-content-memberships .splitcontentleft, div#tab-content-users .splitcontentleft { width: 64% }
526 528 div#tab-content-members .splitcontentright, div#tab-content-memberships .splitcontentright, div#tab-content-users .splitcontentright { width: 34% }
@@ -1268,7 +1268,7 class IssuesControllerTest < ActionController::TestCase
1268 1268 assert_template 'new'
1269 1269
1270 1270 assert_tag 'select',
1271 :attributes => {:name => 'issue[custom_field_values][1]'},
1271 :attributes => {:name => 'issue[custom_field_values][1]', :class => 'list_cf'},
1272 1272 :children => {:count => 4},
1273 1273 :child => {:tag => 'option', :attributes => {:value => 'MySQL'}, :content => 'MySQL'}
1274 1274 end
@@ -2740,7 +2740,7 class IssuesControllerTest < ActionController::TestCase
2740 2740 assert_template 'bulk_edit'
2741 2741
2742 2742 assert_tag :select,
2743 :attributes => {:name => "issue[custom_field_values][#{field.id}]"},
2743 :attributes => {:name => "issue[custom_field_values][#{field.id}]", :class => 'user_cf'},
2744 2744 :children => {
2745 2745 :only => {:tag => 'option'},
2746 2746 :count => Project.find(1).users.count + 2 # "no change" + "none" options
General Comments 0
You need to be logged in to leave comments. Login now