start moving from simple_form i18n to activerecord

This commit is contained in:
wvengen 2013-10-03 16:03:13 +02:00
parent 1674dcf851
commit bbcad49831
8 changed files with 81 additions and 71 deletions

View file

@ -73,6 +73,20 @@ module ApplicationHelper
link_to(text, url_for(url_options), html_options)
end
# Generates text for table heading for model attribute
# When the 'short' option is true, abbreviations will be used:
# 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'.
def heading_helper(model, attribute, options = {})
s = model.human_attribute_name(attribute)
if options[:short]
sshort = model.human_attribute_name("#{attribute}_short".to_sym, default: '')
s = raw "<acronym title='#{s}'>#{sshort}</acronym>" unless sshort.empty?
end
s
end
# Generates a link to the top of the website
def link_to_top