Extract settings table partial to a component
This commit is contained in:
committed by
Javi Martín
parent
8a3bd04a9a
commit
57c257e91c
18
app/components/admin/settings/table_component.rb
Normal file
18
app/components/admin/settings/table_component.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Admin::Settings::TableComponent < ApplicationComponent
|
||||
attr_reader :settings, :setting_name, :tab
|
||||
delegate :dom_id, to: :helpers
|
||||
|
||||
def initialize(settings:, setting_name:, tab: nil)
|
||||
@settings = settings
|
||||
@setting_name = setting_name
|
||||
@tab = tab
|
||||
end
|
||||
|
||||
def display_setting_name(setting_name)
|
||||
if setting_name == "setting"
|
||||
t("admin.settings.setting_name")
|
||||
else
|
||||
t("admin.settings.#{setting_name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user