Merge branch 'master' into allow-no-nickname

Conflicts:
	app/views/foodcoop/users/_users.html.haml
This commit is contained in:
wvengen 2013-10-29 19:15:52 +01:00
commit c37ed74942
84 changed files with 1712 additions and 2579 deletions

View file

@ -73,6 +73,22 @@ 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'.
# Other options are passed through to I18n.
def heading_helper(model, attribute, options = {})
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, options.merge({defaults: ''}))
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