Files
mozo-backend/app/helpers/application_helper.rb
T
2012-08-22 18:15:37 +02:00

29 lines
705 B
Ruby

module ApplicationHelper
def title(*args)
content_tag :h1 do
if args.first.is_a?(Symbol) && (args[1].respond_to?(:model_name) || args[1].class.respond_to?(:model_name))
model = args[1].respond_to?(:model_name) ? args[1] : args[1].class
if args.first == :index
t('action.index.label', models: model.model_name.human_plural)
else
t("action.#{args.first}.label", model: model.model_name.human)
end
else
args.first
end
end
end
def are_you_sure?
t('helpers.links.are_you_sure')
end
def list_open?
session[:list_id].present?
end
def no_content_given(model)
t('helpers.list.no_records')
end
end