Extract components to edit and add cards
This way we'll be able to reuse it in the SDG Management section while reusing the `title` method to set the page title.
This commit is contained in:
19
app/components/admin/widget/cards/edit_component.rb
Normal file
19
app/components/admin/widget/cards/edit_component.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Admin::Widget::Cards::EditComponent < ApplicationComponent
|
||||
include Header
|
||||
attr_reader :card, :index_path
|
||||
|
||||
def initialize(card, index_path:)
|
||||
@card = card
|
||||
@index_path = index_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def title
|
||||
if card.header?
|
||||
t("admin.homepage.edit.header_title")
|
||||
else
|
||||
t("admin.homepage.edit.card_title")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user