Extract settings forms to partials

This commit is contained in:
Julian Herrero
2019-05-14 18:32:13 +02:00
parent 90c1d681d0
commit b4e8395bd6
4 changed files with 16 additions and 15 deletions

View File

@@ -0,0 +1,6 @@
<%= form_for(feature, url: admin_setting_path(feature), html: { id: "edit_#{dom_id(feature)}"}) do |f| %>
<%= 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"}",
data: {confirm: t("admin.actions.confirm")}) %>
<% end %>

View File

@@ -32,13 +32,7 @@
</td> </td>
<td class="text-right"> <td class="text-right">
<%= form_for(feature, url: admin_setting_path(feature), html: { id: "edit_#{dom_id(feature)}"}) do |f| %> <%= render "admin/settings/featured_settings_form", feature: feature %>
<%= 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"}",
data: {confirm: t("admin.actions.confirm")}) %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@@ -0,0 +1,8 @@
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
<div class="small-12 medium-6 large-8 column">
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
</div>
<div class="small-12 medium-6 large-4 column">
<%= f.submit(t("admin.settings.index.update_setting"), class: "button hollow expanded") %>
</div>
<% end %>

View File

@@ -16,14 +16,7 @@
</span> </span>
</td> </td>
<td class="small-6"> <td class="small-6">
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %> <%= render "admin/settings/settings_form", setting: setting %>
<div class="small-12 medium-6 large-8 column">
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
</div>
<div class="small-12 medium-6 large-4 column">
<%= f.submit(t("admin.settings.index.update_setting"), class: "button hollow expanded") %>
</div>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>