i18n simple_form move of foodcoop
This commit is contained in:
parent
552af7925d
commit
78c81b194c
4 changed files with 28 additions and 28 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'simple_form.labels.user.nick'
|
||||
%th= t 'simple_form.labels.user.name'
|
||||
%th= t 'simple_form.labels.user.email'
|
||||
%th= t 'simple_form.labels.user.phone'
|
||||
%th= t 'simple_form.labels.user.ordergroup'
|
||||
%th= t 'simple_form.labels.user.workgroup', count: 3
|
||||
%th= heading_helper User, :nick
|
||||
%th= heading_helper User, :name
|
||||
%th= heading_helper User, :email
|
||||
%th= heading_helper User, :phone
|
||||
%th= heading_helper User, :ordergroup
|
||||
%th= heading_helper User, :workgroup, count: 3
|
||||
%tbody
|
||||
- for user in @users
|
||||
%tr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue