infra updates

This commit is contained in:
2020-03-05 11:36:49 -05:00
parent aec5364f2e
commit 840bac4d54
12 changed files with 47 additions and 49 deletions
-17
View File
@@ -1,21 +1,4 @@
module ApplicationHelper
def title(*args)
res = content_tag :h1, class: 'page-title' 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
content_for :page_title, res
res
end
# overwrite i18n l, to handle nil values
def l(*args)
return '' unless args.first