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:
@@ -1,13 +0,0 @@
|
|||||||
module Admin::Header
|
|
||||||
extend ActiveSupport::Concern
|
|
||||||
|
|
||||||
def header(options: {})
|
|
||||||
provide(:title) do
|
|
||||||
title
|
|
||||||
end
|
|
||||||
|
|
||||||
tag.h2 options do
|
|
||||||
title
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Admin::SDG::Managers::IndexComponent < ApplicationComponent
|
class Admin::SDG::Managers::IndexComponent < ApplicationComponent
|
||||||
include Admin::Header
|
include Header
|
||||||
|
|
||||||
attr_reader :users
|
attr_reader :users
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
module SDGManagement::Header
|
module Header
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def header(&block)
|
def header(&block)
|
||||||
provide(:title) do
|
provide(:title) do
|
||||||
"#{t("sdg_management.header.title")} - #{title}"
|
"#{t("#{namespace}.header.title")} - #{title}"
|
||||||
end
|
end
|
||||||
|
|
||||||
tag.header do
|
tag.header do
|
||||||
@@ -14,4 +14,10 @@ module SDGManagement::Header
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def namespace
|
||||||
|
controller_path.split("/").first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class SDGManagement::Goals::IndexComponent < ApplicationComponent
|
class SDGManagement::Goals::IndexComponent < ApplicationComponent
|
||||||
include SDGManagement::Header
|
include Header
|
||||||
|
|
||||||
attr_reader :goals
|
attr_reader :goals
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class SDGManagement::LocalTargets::FormComponent < ApplicationComponent
|
class SDGManagement::LocalTargets::FormComponent < ApplicationComponent
|
||||||
delegate :back_link_to, to: :helpers
|
delegate :back_link_to, to: :helpers
|
||||||
include SDGManagement::Header
|
include Header
|
||||||
include TranslatableFormHelper
|
include TranslatableFormHelper
|
||||||
include GlobalizeHelper
|
include GlobalizeHelper
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class SDGManagement::LocalTargets::IndexComponent < ApplicationComponent
|
class SDGManagement::LocalTargets::IndexComponent < ApplicationComponent
|
||||||
include SDGManagement::Header
|
include Header
|
||||||
|
|
||||||
attr_reader :local_targets
|
attr_reader :local_targets
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class SDGManagement::Targets::IndexComponent < ApplicationComponent
|
class SDGManagement::Targets::IndexComponent < ApplicationComponent
|
||||||
include SDGManagement::Header
|
include Header
|
||||||
|
|
||||||
attr_reader :targets
|
attr_reader :targets
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user