Use admin table settings component to render featured settings

Now, with the same template we can render all kind of settings.
This commit is contained in:
Senén Rodero Rodríguez
2023-11-22 21:32:37 +01:00
committed by Javi Martín
parent e7223ba865
commit 6a64f38d17
13 changed files with 96 additions and 106 deletions

View File

@@ -8,11 +8,29 @@ class Admin::Settings::TableComponent < ApplicationComponent
@tab = tab
end
def display_setting_name(setting_name)
if setting_name == "setting"
def key_header
if setting_name == "feature"
t("admin.settings.setting")
elsif setting_name == "setting"
t("admin.settings.setting_name")
else
t("admin.settings.#{setting_name}")
end
end
def value_header
if setting_name == "feature"
t("admin.settings.index.features.enabled")
else
t("admin.settings.setting_value")
end
end
def table_class
if settings.all?(&:feature?)
"featured-settings-table"
else
"mixed-settings-table"
end
end
end