Extract map configuration tab partial to a component
This commit is contained in:
committed by
Javi Martín
parent
6876f080a2
commit
f56dc654f3
17
app/components/admin/settings/map_tab_component.html.erb
Normal file
17
app/components/admin/settings/map_tab_component.html.erb
Normal 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 %>
|
||||
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
|
||||
Reference in New Issue
Block a user