Files
nairobi/app/components/admin/widget/cards/new_component.rb
Javi Martín 1e7517d1f6 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.
2021-01-14 17:38:01 +01:00

20 lines
372 B
Ruby

class Admin::Widget::Cards::NewComponent < 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.new.header_title")
else
t("admin.homepage.new.card_title")
end
end
end