use abbr instead of acronym for heading helper

This commit is contained in:
wvengen 2013-11-01 12:48:14 +01:00
parent e883f4cfa7
commit 13c8af3642

View file

@ -78,14 +78,14 @@ module ApplicationHelper
# When the 'short' option is true, abbreviations will be used: # When the 'short' option is true, abbreviations will be used:
# When there is a non-empty model attribute 'foo', it looks for # When there is a non-empty model attribute 'foo', it looks for
# the model attribute translation 'foo_short' and use that as # the model attribute translation 'foo_short' and use that as
# heading, with an acronym title of 'foo'. # heading, with an abbreviation title of 'foo'.
# Other options are passed through to I18n. # Other options are passed through to I18n.
def heading_helper(model, attribute, options = {}) def heading_helper(model, attribute, options = {})
i18nopts = options.select {|a| !['short'].include?(a) } i18nopts = options.select {|a| !['short'].include?(a) }
s = model.human_attribute_name(attribute, i18nopts) s = model.human_attribute_name(attribute, i18nopts)
if options[:short] if options[:short]
sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({defaults: ''})) sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({defaults: ''}))
s = raw "<acronym title='#{s}'>#{sshort}</acronym>" unless sshort.empty? s = raw "<abbr title='#{s}'>#{sshort}</abbr>" unless sshort.empty?
end end
s s
end end