Extract map configuration tab partial to a component
This commit is contained in:
committed by
Javi Martín
parent
6876f080a2
commit
f56dc654f3
@@ -1,9 +1,8 @@
|
|||||||
<% if feature?(:map) %>
|
<% if feature?(:map) %>
|
||||||
<h2><%= t("admin.settings.index.map.title") %></h2>
|
<h2><%= t("admin.settings.index.map.title") %></h2>
|
||||||
|
|
||||||
<% tab = "#tab-map-configuration" %>
|
|
||||||
<%= render Admin::Settings::TableComponent.new(setting_name: "setting") do %>
|
<%= render Admin::Settings::TableComponent.new(setting_name: "setting") do %>
|
||||||
<% %w[map.latitude map.longitude map.zoom].each do |key| %>
|
<% settings.each do |key| %>
|
||||||
<%= render Admin::Settings::RowComponent.new(key, tab: tab) %>
|
<%= render Admin::Settings::RowComponent.new(key, tab: tab) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
13
app/components/admin/settings/map_tab_component.rb
Normal file
13
app/components/admin/settings/map_tab_component.rb
Normal 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
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-map-configuration">
|
<div class="tabs-panel" id="tab-map-configuration">
|
||||||
<%= render "map_configuration_tab" %>
|
<%= render Admin::Settings::MapTabComponent.new %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-images-and-documents">
|
<div class="tabs-panel" id="tab-images-and-documents">
|
||||||
|
|||||||
Reference in New Issue
Block a user