Extract interactive map form to a component
This commit is contained in:
committed by
Javi Martín
parent
65c6189183
commit
e7223ba865
31
app/components/admin/settings/map_form_component.html.erb
Normal file
31
app/components/admin/settings/map_form_component.html.erb
Normal 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>
|
||||
2
app/components/admin/settings/map_form_component.rb
Normal file
2
app/components/admin/settings/map_form_component.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class Admin::Settings::MapFormComponent < ApplicationComponent
|
||||
end
|
||||
Reference in New Issue
Block a user