Move map tiles provider server and map tiles attribution to secrets.
This commit is contained in:
@@ -15,12 +15,11 @@ App.Map =
|
|||||||
markerLongitude = $(element).data('marker-longitude')
|
markerLongitude = $(element).data('marker-longitude')
|
||||||
zoom = $(element).data('map-zoom')
|
zoom = $(element).data('map-zoom')
|
||||||
mapTilesProvider = $(element).data('map-tiles-provider')
|
mapTilesProvider = $(element).data('map-tiles-provider')
|
||||||
mapAttributionSelector = $(element).data('map-tiles-attribution-selector')
|
mapAttribution = $(element).data('map-tiles-provider-attribution')
|
||||||
latitudeInputSelector = $(element).data('latitude-input-selector')
|
latitudeInputSelector = $(element).data('latitude-input-selector')
|
||||||
longitudeInputSelector = $(element).data('longitude-input-selector')
|
longitudeInputSelector = $(element).data('longitude-input-selector')
|
||||||
zoomInputSelector = $(element).data('zoom-input-selector')
|
zoomInputSelector = $(element).data('zoom-input-selector')
|
||||||
removeMarkerSelector = $(element).data('marker-remove-selector')
|
removeMarkerSelector = $(element).data('marker-remove-selector')
|
||||||
attribution = $(mapAttributionSelector)
|
|
||||||
editable = $(element).data('marker-editable')
|
editable = $(element).data('marker-editable')
|
||||||
marker = null;
|
marker = null;
|
||||||
markerIcon = L.divIcon(
|
markerIcon = L.divIcon(
|
||||||
@@ -68,7 +67,7 @@ App.Map =
|
|||||||
|
|
||||||
mapCenterLatLng = new (L.LatLng)(mapCenterLatitude, mapCenterLongitude)
|
mapCenterLatLng = new (L.LatLng)(mapCenterLatitude, mapCenterLongitude)
|
||||||
map = L.map(element.id).setView(mapCenterLatLng, zoom)
|
map = L.map(element.id).setView(mapCenterLatLng, zoom)
|
||||||
L.tileLayer(mapTilesProvider, attribution: attribution.html()).addTo map
|
L.tileLayer(mapTilesProvider, attribution: mapAttribution).addTo map
|
||||||
|
|
||||||
if markerLatitude && markerLongitude
|
if markerLatitude && markerLongitude
|
||||||
marker = createMarker(markerLatitude, markerLongitude)
|
marker = createMarker(markerLatitude, markerLongitude)
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ module MapLocationsHelper
|
|||||||
"#{prefix}_map_location_attributes_#{attribute}"
|
"#{prefix}_map_location_attributes_#{attribute}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def map_location_attribution_id(map_location)
|
|
||||||
"attribution-#{dom_id(map_location)}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def map_location_remove_marker_link_id(map_location)
|
def map_location_remove_marker_link_id(map_location)
|
||||||
"remove-marker-link-#{dom_id(map_location)}"
|
"remove-marker-link-#{dom_id(map_location)}"
|
||||||
end
|
end
|
||||||
@@ -33,18 +29,10 @@ module MapLocationsHelper
|
|||||||
map_location,
|
map_location,
|
||||||
class: "map",
|
class: "map",
|
||||||
data: prepare_map_settings(map_location, editable, parent_class)
|
data: prepare_map_settings(map_location, editable, parent_class)
|
||||||
map += map_attributtion(map_location)
|
|
||||||
map += map_location_remove_marker(map_location, remove_marker_label) if editable
|
map += map_location_remove_marker(map_location, remove_marker_label) if editable
|
||||||
map
|
map
|
||||||
end
|
end
|
||||||
|
|
||||||
def map_attributtion(map_location, klass = nil)
|
|
||||||
content = "©#{link_to("OpenStreetMap", "http://osm.org/copyright")} contributors".html_safe
|
|
||||||
content_tag :div, id: map_location_attribution_id(map_location), class: "map-attributtion #{klass}" do
|
|
||||||
content
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def map_location_remove_marker(map_location, text)
|
def map_location_remove_marker(map_location, text)
|
||||||
content_tag :div, class: "small-12 column text-right" do
|
content_tag :div, class: "small-12 column text-right" do
|
||||||
content_tag :a,
|
content_tag :a,
|
||||||
@@ -63,8 +51,8 @@ module MapLocationsHelper
|
|||||||
map_center_latitude: map_location_latitude(map_location),
|
map_center_latitude: map_location_latitude(map_location),
|
||||||
map_center_longitude: map_location_longitude(map_location),
|
map_center_longitude: map_location_longitude(map_location),
|
||||||
map_zoom: map_location_zoom(map_location),
|
map_zoom: map_location_zoom(map_location),
|
||||||
map_tiles_attribution_selector: map_location_attribution_id(map_location),
|
map_tiles_provider: Rails.application.secrets.map_tiles_provider,
|
||||||
map_tiles_provider: "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
map_tiles_provider_attribution: Rails.application.secrets.map_tiles_provider_attribution,
|
||||||
marker_editable: editable,
|
marker_editable: editable,
|
||||||
marker_latitude: map_location.latitude,
|
marker_latitude: map_location.latitude,
|
||||||
marker_longitude: map_location.longitude,
|
marker_longitude: map_location.longitude,
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
data-map-center-latitude="<%= Setting["map_latitude"] %>"
|
data-map-center-latitude="<%= Setting["map_latitude"] %>"
|
||||||
data-map-center-longitude="<%= Setting["map_longitude"] %>"
|
data-map-center-longitude="<%= Setting["map_longitude"] %>"
|
||||||
data-map-zoom="<%= Setting["map_zoom"] %>"
|
data-map-zoom="<%= Setting["map_zoom"] %>"
|
||||||
data-map-tiles-attribution-selector="#admin-map-attribution"
|
data-map-tiles-provider="<%= Rails.application.secrets.map_tiles_provider %>"
|
||||||
data-map-tiles-provider="//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
data-map-tiles-provider-attribution="<%= Rails.application.secrets.map_tiles_provider_attribution %>"
|
||||||
data-marker-editable="true"
|
data-marker-editable="true"
|
||||||
data-marker-latitude="<%= Setting["map_latitude"] %>"
|
data-marker-latitude="<%= Setting["map_latitude"] %>"
|
||||||
data-marker-longitude="<%= Setting["map_longitude"] %>"
|
data-marker-longitude="<%= Setting["map_longitude"] %>"
|
||||||
@@ -14,9 +14,6 @@
|
|||||||
data-longitude-input-selector="#longitude"
|
data-longitude-input-selector="#longitude"
|
||||||
data-zoom-input-selector="#zoom">
|
data-zoom-input-selector="#zoom">
|
||||||
</div>
|
</div>
|
||||||
<div id="admin-map-attribution" class="map-attributtion">
|
|
||||||
© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= form_tag admin_update_map_path, method: :put, id: 'map-form' do |f| %>
|
<%= form_tag admin_update_map_path, method: :put, id: 'map-form' do |f| %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
default: &default
|
default: &default
|
||||||
secret_key_base: "56792feef405a59b18ea7db57b4777e855103882b926413d4afdfb8c0ea8aa86ea6649da4e729c5f5ae324c0ab9338f789174cf48c544173bc18fdc3b14262e4"
|
secret_key_base: "56792feef405a59b18ea7db57b4777e855103882b926413d4afdfb8c0ea8aa86ea6649da4e729c5f5ae324c0ab9338f789174cf48c544173bc18fdc3b14262e4"
|
||||||
|
map_tiles_provider: "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||||
|
map_tiles_provider_attribution: "© <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors"
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *default
|
<<: *default
|
||||||
@@ -36,6 +38,9 @@ production: &production
|
|||||||
rollbar_server_token: ""
|
rollbar_server_token: ""
|
||||||
server_name: ""
|
server_name: ""
|
||||||
|
|
||||||
|
map_tiles_provider: "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||||
|
map_tiles_provider_attribution: "© <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors"
|
||||||
|
|
||||||
preproduction:
|
preproduction:
|
||||||
server_name: ""
|
server_name: ""
|
||||||
<<: *production
|
<<: *production
|
||||||
|
|||||||
Reference in New Issue
Block a user