Files
grecia/app/components/admin/settings/featured_settings_form_component.rb
Javi Martín 7b8e892f9c Use a switch to enable/disable homepage features
So it's consistent with the way we enable/disable other features.
2021-09-23 13:25:22 +02:00

30 lines
654 B
Ruby

class Admin::Settings::FeaturedSettingsFormComponent < ApplicationComponent
attr_reader :feature, :tab, :describedby
alias_method :describedby?, :describedby
delegate :enabled?, to: :feature
def initialize(feature, tab: nil, describedby: true)
@feature = feature
@tab = tab
@describedby = describedby
end
private
def text
if enabled?
t("shared.yes")
else
t("shared.no")
end
end
def options
{
"aria-labelledby": dom_id(feature, :title),
"aria-describedby": (dom_id(feature, :description) if describedby?),
"aria-pressed": enabled?
}
end
end