##// 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 field_name << "[]" if custom_field.multiple?
39 field_name << "[]" if custom_field.multiple?
40 field_id = "#{name}_custom_field_values_#{custom_field.id}"
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 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
44 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
43 case field_format.try(:edit_as)
45 case field_format.try(:edit_as)
44 when "date"
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 calendar_for(field_id)
48 calendar_for(field_id)
47 when "text"
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 when "bool"
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 when "list"
53 when "list"
52 blank_option = ''
54 blank_option = ''
53 unless custom_field.multiple?
55 unless custom_field.multiple?
@@ -60,13 +62,13 module CustomFieldsHelper
60 end
62 end
61 end
63 end
62 s = select_tag(field_name, blank_option.html_safe + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value),
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 if custom_field.multiple?
66 if custom_field.multiple?
65 s << hidden_field_tag(field_name, '')
67 s << hidden_field_tag(field_name, '')
66 end
68 end
67 s
69 s
68 else
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 end
72 end
71 end
73 end
72
74
@@ -86,26 +88,28 module CustomFieldsHelper
86 field_name = "#{name}[custom_field_values][#{custom_field.id}]"
88 field_name = "#{name}[custom_field_values][#{custom_field.id}]"
87 field_name << "[]" if custom_field.multiple?
89 field_name << "[]" if custom_field.multiple?
88 field_id = "#{name}_custom_field_values_#{custom_field.id}"
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 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
94 field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
90 case field_format.try(:edit_as)
95 case field_format.try(:edit_as)
91 when "date"
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 calendar_for(field_id)
98 calendar_for(field_id)
94 when "text"
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 when "bool"
101 when "bool"
97 select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
102 select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
98 [l(:general_text_yes), '1'],
103 [l(:general_text_yes), '1'],
99 [l(:general_text_no), '0']]), :id => field_id)
104 [l(:general_text_no), '0']]), tag_options)
100 when "list"
105 when "list"
101 options = []
106 options = []
102 options << [l(:label_no_change_option), ''] unless custom_field.multiple?
107 options << [l(:label_no_change_option), ''] unless custom_field.multiple?
103 options << [l(:label_none), '__none__'] unless custom_field.is_required?
108 options << [l(:label_none), '__none__'] unless custom_field.is_required?
104 options += custom_field.possible_values_options(projects)
109 options += custom_field.possible_values_options(projects)
105 select_tag(field_name, options_for_select(options),
110 select_tag(field_name, options_for_select(options), tag_options.merge(:multiple => custom_field.multiple?))
106 :id => field_id, :multiple => custom_field.multiple?)
107 else
111 else
108 text_field_tag(field_name, '', :id => field_id)
112 text_field_tag(field_name, '', tag_options)
109 end
113 end
110 end
114 end
111
115
@@ -521,6 +521,8 a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px
521 em.info {font-style:normal;font-size:90%;color:#888;display:block;}
521 em.info {font-style:normal;font-size:90%;color:#888;display:block;}
522 em.info.error {padding-left:20px; background:url(../images/exclamation.png) no-repeat 0 50%;}
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 /* Project members tab */
526 /* Project members tab */
525 div#tab-content-members .splitcontentleft, div#tab-content-memberships .splitcontentleft, div#tab-content-users .splitcontentleft { width: 64% }
527 div#tab-content-members .splitcontentleft, div#tab-content-memberships .splitcontentleft, div#tab-content-users .splitcontentleft { width: 64% }
526 div#tab-content-members .splitcontentright, div#tab-content-memberships .splitcontentright, div#tab-content-users .splitcontentright { width: 34% }
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 assert_template 'new'
1268 assert_template 'new'
1269
1269
1270 assert_tag 'select',
1270 assert_tag 'select',
1271 :attributes => {:name => 'issue[custom_field_values][1]'},
1271 :attributes => {:name => 'issue[custom_field_values][1]', :class => 'list_cf'},
1272 :children => {:count => 4},
1272 :children => {:count => 4},
1273 :child => {:tag => 'option', :attributes => {:value => 'MySQL'}, :content => 'MySQL'}
1273 :child => {:tag => 'option', :attributes => {:value => 'MySQL'}, :content => 'MySQL'}
1274 end
1274 end
@@ -2740,7 +2740,7 class IssuesControllerTest < ActionController::TestCase
2740 assert_template 'bulk_edit'
2740 assert_template 'bulk_edit'
2741
2741
2742 assert_tag :select,
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 :children => {
2744 :children => {
2745 :only => {:tag => 'option'},
2745 :only => {:tag => 'option'},
2746 :count => Project.find(1).users.count + 2 # "no change" + "none" options
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