Extract map configuration tab partial to a component

This commit is contained in:
Senén Rodero Rodríguez
2024-01-18 16:44:07 +01:00
committed by Javi Martín
parent 6876f080a2
commit f56dc654f3
3 changed files with 15 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
<% if feature?(:map) %>
<h2><%= t("admin.settings.index.map.title") %></h2>
<%= render Admin::Settings::TableComponent.new(setting_name: "setting") do %>
<% settings.each do |key| %>
<%= render Admin::Settings::RowComponent.new(key, tab: tab) %>
<% end %>
<% end %>
<p><%= t("admin.settings.index.map.help") %></p>
<%= render Admin::Settings::MapFormComponent.new(tab: tab) %>
<% else %>
<div class="callout primary">
<%= t("admin.settings.index.map.how_to_enable") %>
</div>
<% end %>

View File

@@ -0,0 +1,13 @@
class Admin::Settings::MapTabComponent < ApplicationComponent
def tab
"#tab-map-configuration"
end
def settings
%w[
map.latitude
map.longitude
map.zoom
]
end
end