Add generic method for header

Unify Header to be able to use it from the admin as from the seg_management.
This commit is contained in:
taitus
2020-12-14 10:12:35 +01:00
committed by Javi Martín
parent dfec661a52
commit 6d5333fc7a
7 changed files with 13 additions and 20 deletions

View File

@@ -0,0 +1,23 @@
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