##// END OF EJS Templates
Fixed: auto-generated links corrupted when url contains & characters in the query string....
Jean-Philippe Lang -
r679:521f4a6ddbc9
parent child
Show More
@@ -1,294 +1,294
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class RedCloth
18 class RedCloth
19 # Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet.
19 # Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet.
20 # <a href="http://code.whytheluckystiff.net/redcloth/changeset/128">http://code.whytheluckystiff.net/redcloth/changeset/128</a>
20 # <a href="http://code.whytheluckystiff.net/redcloth/changeset/128">http://code.whytheluckystiff.net/redcloth/changeset/128</a>
21 def hard_break( text )
21 def hard_break( text )
22 text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks
22 text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks
23 end
23 end
24 end
24 end
25
25
26 module ApplicationHelper
26 module ApplicationHelper
27
27
28 def current_role
28 def current_role
29 @current_role ||= User.current.role_for_project(@project)
29 @current_role ||= User.current.role_for_project(@project)
30 end
30 end
31
31
32 # Return true if user is authorized for controller/action, otherwise false
32 # Return true if user is authorized for controller/action, otherwise false
33 def authorize_for(controller, action)
33 def authorize_for(controller, action)
34 User.current.allowed_to?({:controller => controller, :action => action}, @project)
34 User.current.allowed_to?({:controller => controller, :action => action}, @project)
35 end
35 end
36
36
37 # Display a link if user is authorized
37 # Display a link if user is authorized
38 def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
38 def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
39 link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action])
39 link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action])
40 end
40 end
41
41
42 # Display a link to user's account page
42 # Display a link to user's account page
43 def link_to_user(user)
43 def link_to_user(user)
44 link_to user.name, :controller => 'account', :action => 'show', :id => user
44 link_to user.name, :controller => 'account', :action => 'show', :id => user
45 end
45 end
46
46
47 def link_to_issue(issue)
47 def link_to_issue(issue)
48 link_to "#{issue.tracker.name} ##{issue.id}", :controller => "issues", :action => "show", :id => issue
48 link_to "#{issue.tracker.name} ##{issue.id}", :controller => "issues", :action => "show", :id => issue
49 end
49 end
50
50
51 def toggle_link(name, id, options={})
51 def toggle_link(name, id, options={})
52 onclick = "Element.toggle('#{id}'); "
52 onclick = "Element.toggle('#{id}'); "
53 onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ")
53 onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ")
54 onclick << "return false;"
54 onclick << "return false;"
55 link_to(name, "#", :onclick => onclick)
55 link_to(name, "#", :onclick => onclick)
56 end
56 end
57
57
58 def image_to_function(name, function, html_options = {})
58 def image_to_function(name, function, html_options = {})
59 html_options.symbolize_keys!
59 html_options.symbolize_keys!
60 tag(:input, html_options.merge({
60 tag(:input, html_options.merge({
61 :type => "image", :src => image_path(name),
61 :type => "image", :src => image_path(name),
62 :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};"
62 :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};"
63 }))
63 }))
64 end
64 end
65
65
66 def prompt_to_remote(name, text, param, url, html_options = {})
66 def prompt_to_remote(name, text, param, url, html_options = {})
67 html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;"
67 html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;"
68 link_to name, {}, html_options
68 link_to name, {}, html_options
69 end
69 end
70
70
71 def format_date(date)
71 def format_date(date)
72 return nil unless date
72 return nil unless date
73 @date_format_setting ||= Setting.date_format.to_i
73 @date_format_setting ||= Setting.date_format.to_i
74 @date_format_setting == 0 ? l_date(date) : date.strftime("%Y-%m-%d")
74 @date_format_setting == 0 ? l_date(date) : date.strftime("%Y-%m-%d")
75 end
75 end
76
76
77 def format_time(time)
77 def format_time(time)
78 return nil unless time
78 return nil unless time
79 @date_format_setting ||= Setting.date_format.to_i
79 @date_format_setting ||= Setting.date_format.to_i
80 time = time.to_time if time.is_a?(String)
80 time = time.to_time if time.is_a?(String)
81 @date_format_setting == 0 ? l_datetime(time) : (time.strftime("%Y-%m-%d") + ' ' + l_time(time))
81 @date_format_setting == 0 ? l_datetime(time) : (time.strftime("%Y-%m-%d") + ' ' + l_time(time))
82 end
82 end
83
83
84 def day_name(day)
84 def day_name(day)
85 l(:general_day_names).split(',')[day-1]
85 l(:general_day_names).split(',')[day-1]
86 end
86 end
87
87
88 def month_name(month)
88 def month_name(month)
89 l(:actionview_datehelper_select_month_names).split(',')[month-1]
89 l(:actionview_datehelper_select_month_names).split(',')[month-1]
90 end
90 end
91
91
92 def pagination_links_full(paginator, options={}, html_options={})
92 def pagination_links_full(paginator, options={}, html_options={})
93 page_param = options.delete(:page_param) || :page
93 page_param = options.delete(:page_param) || :page
94
94
95 html = ''
95 html = ''
96 html << link_to_remote(('&#171; ' + l(:label_previous)),
96 html << link_to_remote(('&#171; ' + l(:label_previous)),
97 {:update => "content", :url => options.merge(page_param => paginator.current.previous)},
97 {:update => "content", :url => options.merge(page_param => paginator.current.previous)},
98 {:href => url_for(:params => options.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous
98 {:href => url_for(:params => options.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous
99
99
100 html << (pagination_links_each(paginator, options) do |n|
100 html << (pagination_links_each(paginator, options) do |n|
101 link_to_remote(n.to_s,
101 link_to_remote(n.to_s,
102 {:url => {:params => options.merge(page_param => n)}, :update => 'content'},
102 {:url => {:params => options.merge(page_param => n)}, :update => 'content'},
103 {:href => url_for(:params => options.merge(page_param => n))})
103 {:href => url_for(:params => options.merge(page_param => n))})
104 end || '')
104 end || '')
105
105
106 html << ' ' + link_to_remote((l(:label_next) + ' &#187;'),
106 html << ' ' + link_to_remote((l(:label_next) + ' &#187;'),
107 {:update => "content", :url => options.merge(page_param => paginator.current.next)},
107 {:update => "content", :url => options.merge(page_param => paginator.current.next)},
108 {:href => url_for(:params => options.merge(page_param => paginator.current.next))}) if paginator.current.next
108 {:href => url_for(:params => options.merge(page_param => paginator.current.next))}) if paginator.current.next
109 html
109 html
110 end
110 end
111
111
112 # textilize text according to system settings and RedCloth availability
112 # textilize text according to system settings and RedCloth availability
113 def textilizable(text, options = {})
113 def textilizable(text, options = {})
114 return "" if text.blank?
114 return "" if text.blank?
115
115
116 # different methods for formatting wiki links
116 # different methods for formatting wiki links
117 case options[:wiki_links]
117 case options[:wiki_links]
118 when :local
118 when :local
119 # used for local links to html files
119 # used for local links to html files
120 format_wiki_link = Proc.new {|project, title| "#{title}.html" }
120 format_wiki_link = Proc.new {|project, title| "#{title}.html" }
121 when :anchor
121 when :anchor
122 # used for single-file wiki export
122 # used for single-file wiki export
123 format_wiki_link = Proc.new {|project, title| "##{title}" }
123 format_wiki_link = Proc.new {|project, title| "##{title}" }
124 else
124 else
125 format_wiki_link = Proc.new {|project, title| url_for :controller => 'wiki', :action => 'index', :id => project, :page => title }
125 format_wiki_link = Proc.new {|project, title| url_for :controller => 'wiki', :action => 'index', :id => project, :page => title }
126 end
126 end
127
127
128 project = options[:project] || @project
128 project = options[:project] || @project
129
129
130 # turn wiki links into html links
130 # turn wiki links into html links
131 # example:
131 # example:
132 # [[mypage]]
132 # [[mypage]]
133 # [[mypage|mytext]]
133 # [[mypage|mytext]]
134 # wiki links can refer other project wikis, using project name or identifier:
134 # wiki links can refer other project wikis, using project name or identifier:
135 # [[project:]] -> wiki starting page
135 # [[project:]] -> wiki starting page
136 # [[project:|mytext]]
136 # [[project:|mytext]]
137 # [[project:mypage]]
137 # [[project:mypage]]
138 # [[project:mypage|mytext]]
138 # [[project:mypage|mytext]]
139 text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) do |m|
139 text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) do |m|
140 link_project = project
140 link_project = project
141 page = $1
141 page = $1
142 title = $3
142 title = $3
143 if page =~ /^([^\:]+)\:(.*)$/
143 if page =~ /^([^\:]+)\:(.*)$/
144 link_project = Project.find_by_name($1) || Project.find_by_identifier($1)
144 link_project = Project.find_by_name($1) || Project.find_by_identifier($1)
145 page = title || $2
145 page = title || $2
146 title = $1 if page.blank?
146 title = $1 if page.blank?
147 end
147 end
148 link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), :class => 'wiki-page')
148 link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), :class => 'wiki-page')
149 end
149 end
150
150
151 # turn issue ids into links
151 # turn issue ids into links
152 # example:
152 # example:
153 # #52 -> <a href="/issues/show/52">#52</a>
153 # #52 -> <a href="/issues/show/52">#52</a>
154 text = text.gsub(/#(\d+)(?=\b)/) {|m| link_to "##{$1}", {:controller => 'issues', :action => 'show', :id => $1}, :class => 'issue' }
154 text = text.gsub(/#(\d+)(?=\b)/) {|m| link_to "##{$1}", {:controller => 'issues', :action => 'show', :id => $1}, :class => 'issue' }
155
155
156 # turn revision ids into links (@project needed)
156 # turn revision ids into links (@project needed)
157 # example:
157 # example:
158 # r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (@project.id is 6)
158 # r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (@project.id is 6)
159 text = text.gsub(/(?=\b)r(\d+)(?=\b)/) {|m| link_to "r#{$1}", {:controller => 'repositories', :action => 'revision', :id => project.id, :rev => $1}, :class => 'changeset' } if project
159 text = text.gsub(/(?=\b)r(\d+)(?=\b)/) {|m| link_to "r#{$1}", {:controller => 'repositories', :action => 'revision', :id => project.id, :rev => $1}, :class => 'changeset' } if project
160
160
161 # when using an image link, try to use an attachment, if possible
161 # when using an image link, try to use an attachment, if possible
162 attachments = options[:attachments]
162 attachments = options[:attachments]
163 if attachments
163 if attachments
164 text = text.gsub(/!([<>=]*)(\S+\.(gif|jpg|jpeg|png))!/) do |m|
164 text = text.gsub(/!([<>=]*)(\S+\.(gif|jpg|jpeg|png))!/) do |m|
165 align = $1
165 align = $1
166 filename = $2
166 filename = $2
167 rf = Regexp.new(filename, Regexp::IGNORECASE)
167 rf = Regexp.new(filename, Regexp::IGNORECASE)
168 # search for the picture in attachments
168 # search for the picture in attachments
169 if found = attachments.detect { |att| att.filename =~ rf }
169 if found = attachments.detect { |att| att.filename =~ rf }
170 image_url = url_for :controller => 'attachments', :action => 'download', :id => found.id
170 image_url = url_for :controller => 'attachments', :action => 'download', :id => found.id
171 "!#{align}#{image_url}!"
171 "!#{align}#{image_url}!"
172 else
172 else
173 "!#{align}#{filename}!"
173 "!#{align}#{filename}!"
174 end
174 end
175 end
175 end
176 end
176 end
177
177
178 # finally textilize text
178 # finally textilize text
179 @do_textilize ||= (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize")
179 @do_textilize ||= (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize")
180 text = @do_textilize ? auto_link(RedCloth.new(text, [:hard_breaks]).to_html) : simple_format(auto_link(h(text)))
180 text = @do_textilize ? RedCloth.new(auto_link(text), [:hard_breaks]).to_html : simple_format(auto_link(h(text)))
181 end
181 end
182
182
183 # Same as Rails' simple_format helper without using paragraphs
183 # Same as Rails' simple_format helper without using paragraphs
184 def simple_format_without_paragraph(text)
184 def simple_format_without_paragraph(text)
185 text.to_s.
185 text.to_s.
186 gsub(/\r\n?/, "\n"). # \r\n and \r -> \n
186 gsub(/\r\n?/, "\n"). # \r\n and \r -> \n
187 gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br
187 gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br
188 gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
188 gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
189 end
189 end
190
190
191 def error_messages_for(object_name, options = {})
191 def error_messages_for(object_name, options = {})
192 options = options.symbolize_keys
192 options = options.symbolize_keys
193 object = instance_variable_get("@#{object_name}")
193 object = instance_variable_get("@#{object_name}")
194 if object && !object.errors.empty?
194 if object && !object.errors.empty?
195 # build full_messages here with controller current language
195 # build full_messages here with controller current language
196 full_messages = []
196 full_messages = []
197 object.errors.each do |attr, msg|
197 object.errors.each do |attr, msg|
198 next if msg.nil?
198 next if msg.nil?
199 msg = msg.first if msg.is_a? Array
199 msg = msg.first if msg.is_a? Array
200 if attr == "base"
200 if attr == "base"
201 full_messages << l(msg)
201 full_messages << l(msg)
202 else
202 else
203 full_messages << "&#171; " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " &#187; " + l(msg) unless attr == "custom_values"
203 full_messages << "&#171; " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " &#187; " + l(msg) unless attr == "custom_values"
204 end
204 end
205 end
205 end
206 # retrieve custom values error messages
206 # retrieve custom values error messages
207 if object.errors[:custom_values]
207 if object.errors[:custom_values]
208 object.custom_values.each do |v|
208 object.custom_values.each do |v|
209 v.errors.each do |attr, msg|
209 v.errors.each do |attr, msg|
210 next if msg.nil?
210 next if msg.nil?
211 msg = msg.first if msg.is_a? Array
211 msg = msg.first if msg.is_a? Array
212 full_messages << "&#171; " + v.custom_field.name + " &#187; " + l(msg)
212 full_messages << "&#171; " + v.custom_field.name + " &#187; " + l(msg)
213 end
213 end
214 end
214 end
215 end
215 end
216 content_tag("div",
216 content_tag("div",
217 content_tag(
217 content_tag(
218 options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":"
218 options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":"
219 ) +
219 ) +
220 content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),
220 content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),
221 "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"
221 "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"
222 )
222 )
223 else
223 else
224 ""
224 ""
225 end
225 end
226 end
226 end
227
227
228 def lang_options_for_select(blank=true)
228 def lang_options_for_select(blank=true)
229 (blank ? [["(auto)", ""]] : []) +
229 (blank ? [["(auto)", ""]] : []) +
230 GLoc.valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.first <=> y.first }
230 GLoc.valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.first <=> y.first }
231 end
231 end
232
232
233 def label_tag_for(name, option_tags = nil, options = {})
233 def label_tag_for(name, option_tags = nil, options = {})
234 label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
234 label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
235 content_tag("label", label_text)
235 content_tag("label", label_text)
236 end
236 end
237
237
238 def labelled_tabular_form_for(name, object, options, &proc)
238 def labelled_tabular_form_for(name, object, options, &proc)
239 options[:html] ||= {}
239 options[:html] ||= {}
240 options[:html].store :class, "tabular"
240 options[:html].store :class, "tabular"
241 form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)
241 form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)
242 end
242 end
243
243
244 def check_all_links(form_name)
244 def check_all_links(form_name)
245 link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") +
245 link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") +
246 " | " +
246 " | " +
247 link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
247 link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
248 end
248 end
249
249
250 def calendar_for(field_id)
250 def calendar_for(field_id)
251 image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
251 image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
252 javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
252 javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
253 end
253 end
254
254
255 def wikitoolbar_for(field_id)
255 def wikitoolbar_for(field_id)
256 return '' unless Setting.text_formatting == 'textile'
256 return '' unless Setting.text_formatting == 'textile'
257 javascript_include_tag('jstoolbar') + javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.draw();")
257 javascript_include_tag('jstoolbar') + javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.draw();")
258 end
258 end
259 end
259 end
260
260
261 class TabularFormBuilder < ActionView::Helpers::FormBuilder
261 class TabularFormBuilder < ActionView::Helpers::FormBuilder
262 include GLoc
262 include GLoc
263
263
264 def initialize(object_name, object, template, options, proc)
264 def initialize(object_name, object, template, options, proc)
265 set_language_if_valid options.delete(:lang)
265 set_language_if_valid options.delete(:lang)
266 @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc
266 @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc
267 end
267 end
268
268
269 (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector|
269 (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector|
270 src = <<-END_SRC
270 src = <<-END_SRC
271 def #{selector}(field, options = {})
271 def #{selector}(field, options = {})
272 return super if options.delete :no_label
272 return super if options.delete :no_label
273 label_text = l(options[:label]) if options[:label]
273 label_text = l(options[:label]) if options[:label]
274 label_text ||= l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym)
274 label_text ||= l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym)
275 label_text << @template.content_tag("span", " *", :class => "required") if options.delete(:required)
275 label_text << @template.content_tag("span", " *", :class => "required") if options.delete(:required)
276 label = @template.content_tag("label", label_text,
276 label = @template.content_tag("label", label_text,
277 :class => (@object && @object.errors[field] ? "error" : nil),
277 :class => (@object && @object.errors[field] ? "error" : nil),
278 :for => (@object_name.to_s + "_" + field.to_s))
278 :for => (@object_name.to_s + "_" + field.to_s))
279 label + super
279 label + super
280 end
280 end
281 END_SRC
281 END_SRC
282 class_eval src, __FILE__, __LINE__
282 class_eval src, __FILE__, __LINE__
283 end
283 end
284
284
285 def select(field, choices, options = {}, html_options = {})
285 def select(field, choices, options = {}, html_options = {})
286 label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
286 label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
287 label = @template.content_tag("label", label_text,
287 label = @template.content_tag("label", label_text,
288 :class => (@object && @object.errors[field] ? "error" : nil),
288 :class => (@object && @object.errors[field] ? "error" : nil),
289 :for => (@object_name.to_s + "_" + field.to_s))
289 :for => (@object_name.to_s + "_" + field.to_s))
290 label + super
290 label + super
291 end
291 end
292
292
293 end
293 end
294
294
General Comments 0
You need to be logged in to leave comments. Login now