Files
grecia/app/components/concerns/header.rb
taitus 6d5333fc7a Add generic method for header
Unify Header to be able to use it from the admin as from the seg_management.
2020-12-16 13:16:48 +01:00

24 lines
371 B
Ruby

module Header
extend ActiveSupport::Concern
def header(&block)
provide(:title) do
"#{t("#{namespace}.header.title")} - #{title}"
end
tag.header do
if block_given?
tag.h2(title) + capture(&block)
else
tag.h2(title)
end
end
end
private
def namespace
controller_path.split("/").first
end
end