i18n simple_form move of foodcoop

This commit is contained in:
wvengen 2013-10-09 23:00:07 +02:00
parent 552af7925d
commit 78c81b194c
4 changed files with 28 additions and 28 deletions

View file

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