Refactor Admin settings tabs

- Rename partial views for tabs.
- Extract tables settings to reuse across the tabs.
This commit is contained in:
Julian Herrero
2019-03-13 12:16:25 +01:00
parent 9ed6aae348
commit c0d2776e8d
6 changed files with 21 additions and 19 deletions

View File

@@ -0,0 +1,31 @@
<table>
<thead>
<tr>
<th><%= t("admin.settings.setting_name") %></th>
<th><%= t("admin.settings.setting_value") %></th>
</tr>
</thead>
<tbody>
<% settings.each do |setting| %>
<tr>
<td class="small-6">
<strong><%= t("settings.#{setting.key}") %></strong>
<br>
<span class="small">
<%= t("settings.#{setting.key}_description", default: t("admin.settings.no_description")) %>
</span>
</td>
<td class="small-6">
<%= 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 %>
</td>
</tr>
<% end %>
</tbody>
</table>