Move featured settings form partial to a component
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<%= form_for(feature, url: admin_setting_path(feature), html: { id: "edit_#{dom_id(feature)}" }) do |f| %>
|
||||
<%= f.hidden_field :tab, value: tab if defined?(tab) %>
|
||||
<%= f.hidden_field :tab, value: tab if tab %>
|
||||
<%= f.hidden_field :value, id: dom_id(feature), value: (feature.enabled? ? "" : "active") %>
|
||||
<%= f.submit(t("admin.settings.index.features.#{feature.enabled? ? "disable" : "enable"}"),
|
||||
class: "button expanded #{feature.enabled? ? "hollow alert" : "success"}",
|
||||
@@ -0,0 +1,8 @@
|
||||
class Admin::Settings::FeaturedSettingsFormComponent < ApplicationComponent
|
||||
attr_reader :feature, :tab
|
||||
|
||||
def initialize(feature, tab: nil)
|
||||
@feature = feature
|
||||
@tab = tab
|
||||
end
|
||||
end
|
||||
@@ -32,7 +32,7 @@
|
||||
</td>
|
||||
|
||||
<td class="text-right">
|
||||
<%= render "admin/settings/featured_settings_form", feature: feature, tab: tab %>
|
||||
<%= render Admin::Settings::FeaturedSettingsFormComponent.new(feature, tab: tab) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user