start moving from simple_form i18n to activerecord
This commit is contained in:
parent
1674dcf851
commit
bbcad49831
8 changed files with 81 additions and 71 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue