Extract interactive map form to a component

This commit is contained in:
Senén Rodero Rodríguez
2023-11-27 14:15:03 +01:00
committed by Javi Martín
parent 65c6189183
commit e7223ba865
3 changed files with 3 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
<div class="row">
<div class="small-12 column">
<div id="admin-map" class="map"
data-map
data-map-center-latitude="<%= Setting["map.latitude"] %>"
data-map-center-longitude="<%= Setting["map.longitude"] %>"
data-map-zoom="<%= Setting["map.zoom"] %>"
data-map-tiles-provider="<%= Rails.application.secrets.map_tiles_provider %>"
data-map-tiles-provider-attribution="<%= Rails.application.secrets.map_tiles_provider_attribution %>"
data-marker-editable="true"
data-marker-latitude="<%= Setting["map.latitude"] %>"
data-marker-longitude="<%= Setting["map.longitude"] %>"
data-latitude-input-selector="#latitude"
data-longitude-input-selector="#longitude"
data-zoom-input-selector="#zoom">
</div>
<%= form_tag admin_update_map_path, method: :put, id: "map-form" do |f| %>
<%= hidden_field_tag :latitude, Setting["map.latitude"] %>
<%= hidden_field_tag :longitude, Setting["map.longitude"] %>
<%= hidden_field_tag :zoom, Setting["map.zoom"] %>
<div class="small-12 medium-6 large-4 margin-top">
<%= submit_tag t("admin.settings.index.map.form.submit"),
class: "button hollow expanded" %>
</div>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,2 @@
class Admin::Settings::MapFormComponent < ApplicationComponent
end