Split configuration settings into tabs
This commit is contained in:
24
app/views/admin/settings/_banner_images.html.erb
Normal file
24
app/views/admin/settings/_banner_images.html.erb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<% if @banner_imgs.present?%>
|
||||||
|
<h2><%= t("admin.settings.index.banner_imgs") %></h2>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<% @banner_imgs.each do |setting| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong><%= t("settings.#{setting.key}") %></strong>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
||||||
|
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
||||||
|
<%= f.submit(t('admin.settings.index.update_setting'), class: "button small success") %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<h3>No banner images to show.</h3>
|
||||||
|
<% end %>
|
||||||
24
app/views/admin/settings/_banner_styles.html.erb
Normal file
24
app/views/admin/settings/_banner_styles.html.erb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<% if @banner_styles.present? %>
|
||||||
|
<h2><%= t("admin.settings.index.banners") %></h2>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<% @banner_styles.each do |setting| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong><%= t("settings.#{setting.key}") %></strong>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
||||||
|
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
||||||
|
<%= f.submit(t('admin.settings.index.update_setting'), class: "button hollow") %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<h3>No banner styles to show.</h3>
|
||||||
|
<% end %>
|
||||||
23
app/views/admin/settings/_configuration.html.erb
Normal file
23
app/views/admin/settings/_configuration.html.erb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<h2><%= t("admin.settings.index.title") %></h2>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<% @settings.each do |setting| %>
|
||||||
|
<tr>
|
||||||
|
<td class="small-12 medium-4">
|
||||||
|
<strong><%= t("settings.#{setting.key}") %></strong>
|
||||||
|
</td>
|
||||||
|
<td class="small-12 medium-8">
|
||||||
|
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
||||||
|
<div class="small-12 medium-6 large-9 column">
|
||||||
|
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-6 large-3 column">
|
||||||
|
<%= f.submit(t('admin.settings.index.update_setting'), class: "button hollow expanded") %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
28
app/views/admin/settings/_feature_flags.html.erb
Normal file
28
app/views/admin/settings/_feature_flags.html.erb
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
<h2><%= t("admin.settings.index.feature_flags") %></h2>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<% @feature_flags.each do |feature_flag| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong><%= t("settings.#{feature_flag.key}") %></strong>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<%= feature_flag.enabled? ? t("admin.settings.index.features.enabled") : t("admin.settings.index.features.disabled") %>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-right">
|
||||||
|
<%= form_for(feature_flag, url: admin_setting_path(feature_flag), html: { id: "edit_#{dom_id(feature_flag)}"}) do |f| %>
|
||||||
|
|
||||||
|
<%= f.hidden_field :value, id: dom_id(feature_flag), value: (feature_flag.enabled? ? "" : "active") %>
|
||||||
|
<%= f.submit(t("admin.settings.index.features.#{feature_flag.enabled? ? 'disable' : 'enable'}"),
|
||||||
|
class: "button expanded #{feature_flag.enabled? ? 'hollow alert' : 'success'}",
|
||||||
|
data: {confirm: t("admin.actions.confirm")}) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
31
app/views/admin/settings/_filter_subnav.html.erb
Normal file
31
app/views/admin/settings/_filter_subnav.html.erb
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<ul class="tabs" data-tabs id="settings-tabs">
|
||||||
|
<li class="tabs-title is-active">
|
||||||
|
<%= link_to "#tab-configuration" do %>
|
||||||
|
<%= t("admin.settings.index.title") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="tabs-title">
|
||||||
|
<%= link_to "#tab-feature-flags" do %>
|
||||||
|
<%= t("admin.settings.index.feature_flags") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="tabs-title">
|
||||||
|
<%= link_to "#tab-banner-styles" do %>
|
||||||
|
<%= t("admin.settings.index.banners") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="tabs-title">
|
||||||
|
<%= link_to "#tab-banner-images" do %>
|
||||||
|
<%= t("admin.settings.index.banner_imgs") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="tabs-title">
|
||||||
|
<%= link_to "#tab-map-configuration" do %>
|
||||||
|
<%= t("admin.settings.index.map.title") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
8
app/views/admin/settings/_map_configuration.html.erb
Normal file
8
app/views/admin/settings/_map_configuration.html.erb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<% if feature?(:map) %>
|
||||||
|
<h2><%= t("admin.settings.index.map.title") %></h2>
|
||||||
|
<p><%= t("admin.settings.index.map.help") %></p>
|
||||||
|
|
||||||
|
<%= render "map_form" %>
|
||||||
|
<% else %>
|
||||||
|
<h3>No map to show.</h3>
|
||||||
|
<% end %>
|
||||||
@@ -1,105 +1,24 @@
|
|||||||
<h2><%= t("admin.settings.index.title") %></h2>
|
<h1>Settings</h1>
|
||||||
|
<div class="tabs-content" data-tabs-content="settings-tabs">
|
||||||
|
<%= render "filter_subnav" %>
|
||||||
|
|
||||||
<table>
|
<div class="tabs-panel is-active" id="tab-configuration">
|
||||||
<tbody>
|
<%= render "configuration" %>
|
||||||
<% @settings.each do |setting| %>
|
</div>
|
||||||
<tr>
|
|
||||||
<td class="small-12 medium-4">
|
|
||||||
<strong><%= t("settings.#{setting.key}") %></strong>
|
|
||||||
</td>
|
|
||||||
<td class="small-12 medium-8">
|
|
||||||
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
|
||||||
<div class="small-12 medium-6 large-9 column">
|
|
||||||
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
|
||||||
</div>
|
|
||||||
<div class="small-12 medium-6 large-3 column">
|
|
||||||
<%= f.submit(t('admin.settings.index.update_setting'), class: "button hollow expanded") %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2><%= t("admin.settings.index.feature_flags") %></h2>
|
<div class="tabs-panel" id="tab-feature-flags">
|
||||||
|
<%= render "feature_flags" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table>
|
<div class="tabs-panel" id="tab-banner-styles">
|
||||||
<tbody>
|
<%= render "banner_styles" %>
|
||||||
<% @feature_flags.each do |feature_flag| %>
|
</div>
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<strong><%= t("settings.#{feature_flag.key}") %></strong>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
<div class="tabs-panel" id="tab-banner-images">
|
||||||
<%= feature_flag.enabled? ? t("admin.settings.index.features.enabled") : t("admin.settings.index.features.disabled") %>
|
<%= render "banner_images" %>
|
||||||
</td>
|
</div>
|
||||||
|
|
||||||
<td class="text-right">
|
<div class="tabs-panel" id="tab-map-configuration">
|
||||||
<%= form_for(feature_flag, url: admin_setting_path(feature_flag), html: { id: "edit_#{dom_id(feature_flag)}"}) do |f| %>
|
<%= render "map_configuration" %>
|
||||||
|
</div>
|
||||||
<%= f.hidden_field :value, id: dom_id(feature_flag), value: (feature_flag.enabled? ? "" : "active") %>
|
</div>
|
||||||
<%= f.submit(t("admin.settings.index.features.#{feature_flag.enabled? ? 'disable' : 'enable'}"),
|
|
||||||
class: "button expanded #{feature_flag.enabled? ? 'hollow alert' : 'success'}",
|
|
||||||
data: {confirm: t("admin.actions.confirm")}) %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<% if @banner_styles.present? %>
|
|
||||||
<h2><%= t("admin.settings.index.banners") %></h2>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<% @banner_styles.each do |setting| %>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<strong><%= t("settings.#{setting.key}") %></strong>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
|
||||||
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
|
||||||
<%= f.submit(t('admin.settings.index.update_setting'), class: "button hollow") %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @banner_imgs.present?%>
|
|
||||||
<h2><%= t("admin.settings.index.banner_imgs") %></h2>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<% @banner_imgs.each do |setting| %>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<strong><%= t("settings.#{setting.key}") %></strong>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
|
||||||
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
|
||||||
<%= f.submit(t('admin.settings.index.update_setting'), class: "button small success") %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if feature?(:map) %>
|
|
||||||
<h2><%= t("admin.settings.index.map.title") %></h2>
|
|
||||||
<p><%= t("admin.settings.index.map.help") %></p>
|
|
||||||
|
|
||||||
<%= render "map_form" %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user