"
- data-map-center-longitude="<%= Setting["map_longitude"] %>"
- data-map-zoom="<%= Setting["map_zoom"] %>"
+ 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-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">
@@ -17,9 +17,9 @@
<%= 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"] %>
+ <%= hidden_field_tag :latitude, Setting["map.latitude"] %>
+ <%= hidden_field_tag :longitude, Setting["map.longitude"] %>
+ <%= hidden_field_tag :zoom, Setting["map.zoom"] %>
<%= submit_tag t("admin.settings.index.map.form.submit"),
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index 656e102ea..bfbd5f9bd 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -1188,6 +1188,7 @@ en:
update: Map configuration updated succesfully.
form:
submit: Update
+ how_to_enable: 'To show the map to users you must enable "Proposals and budget investments geolocation" on "Features" tab.'
setting: Feature
setting_actions: Actions
setting_name: Setting
diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml
index 363c3b875..ab4b34803 100644
--- a/config/locales/en/settings.yml
+++ b/config/locales/en/settings.yml
@@ -52,12 +52,6 @@ en:
related_content_score_threshold_description: "According to the rating of votes in a related content, hides content that users mark as unrelated"
hot_score_period_in_days: "Period (days) used by the filter 'most active'"
hot_score_period_in_days_description: "The filter 'most active' used in multiple sections will be based on the votes during the last X days"
- map_latitude: "Latitude"
- map_latitude_description: "Latitude to show the map position"
- map_longitude: "Longitude"
- map_longitude_description: "Longitude to show the position of the map"
- map_zoom: "Zoom"
- map_zoom_description: "Zoom to show the map position"
mailer_from_name: "Sender email name"
mailer_from_name_description: "This name will appear as sender name in emails sent from the application"
mailer_from_address: "Sender email address"
@@ -124,3 +118,10 @@ en:
public_stats_description: "Display public stats in the Administration panel"
help_page: "Help page"
help_page_description: 'Displays a Help menu that contains a page with an info section about each enabled feature. Also custom pages and menus can be created in the "Custom pages" and "Custom content blocks" sections'
+ map:
+ latitude: "Latitude"
+ latitude_description: "Latitude to show the map position"
+ longitude: "Longitude"
+ longitude_description: "Longitude to show the position of the map"
+ zoom: "Zoom"
+ zoom_description: "Zoom to show the map position"
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 36fc3d59b..037620ab8 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -1187,6 +1187,7 @@ es:
update: La configuración del mapa se ha guardado correctamente.
form:
submit: Actualizar
+ how_to_enable: 'Para mostrar el mapa a los usuarios se debe de activar "Geolocalización de propuestas y proyectos de gasto" en la pestaña "Funcionalidades".'
setting: Funcionalidad
setting_actions: Acciones
setting_name: Configuración
diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml
index 33f1c9d80..6a251102c 100644
--- a/config/locales/es/settings.yml
+++ b/config/locales/es/settings.yml
@@ -52,12 +52,6 @@ es:
related_content_score_threshold_description: "Según la puntuación de votos en un contenido relacionado, oculta el contenido que los usuarios marquen como no relacionado"
hot_score_period_in_days: "Periodo (días) usado para el filtro 'Más Activos'"
hot_score_period_in_days_description: "El filtro 'Más Activos' usado en diferentes secciones se basará en los votos de los últimos X días"
- map_latitude: "Latitud"
- map_latitude_description: "Latitud para mostrar la posición del mapa"
- map_longitude: "Longitud"
- map_longitude_description: "Longitud para mostrar la posición del mapa"
- map_zoom: "Zoom"
- map_zoom_description: "Zoom para mostrar la posición del mapa"
mailer_from_name: "Nombre email remitente"
mailer_from_name_description: "Este nombre aparecerá como nombre del remitente en los emails enviados desde la aplicación"
mailer_from_address: "Dirección email remitente"
@@ -124,3 +118,10 @@ es:
public_stats_description: "Muestra las estadísticas públicas en el panel de Administración"
help_page: "Página de ayuda"
help_page_description: 'Muestra un menú Ayuda que contiene una página con una sección de información sobre cada funcionalidad habilitada. También se pueden crear páginas y menús personalizados en las secciones "Personalizar páginas" y "Personalizar bloques"'
+ map:
+ latitude: "Latitud"
+ latitude_description: "Latitud para mostrar la posición del mapa"
+ longitude: "Longitud"
+ longitude_description: "Longitud para mostrar la posición del mapa"
+ zoom: "Zoom"
+ zoom_description: "Zoom para mostrar la posición del mapa"
diff --git a/db/dev_seeds/budgets.rb b/db/dev_seeds/budgets.rb
index f0f842d73..dc96d658c 100644
--- a/db/dev_seeds/budgets.rb
+++ b/db/dev_seeds/budgets.rb
@@ -151,9 +151,9 @@ end
section "Geolocating Investments" do
Budget.find_each do |budget|
budget.investments.each do |investment|
- MapLocation.create(latitude: Setting["map_latitude"].to_f + rand(-10..10)/100.to_f,
- longitude: Setting["map_longitude"].to_f + rand(-10..10)/100.to_f,
- zoom: Setting["map_zoom"],
+ MapLocation.create(latitude: Setting["map.latitude"].to_f + rand(-10..10)/100.to_f,
+ longitude: Setting["map.longitude"].to_f + rand(-10..10)/100.to_f,
+ zoom: Setting["map.zoom"],
investment_id: investment.id)
end
end
diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb
index 6cecac651..5d4abbb6b 100644
--- a/db/dev_seeds/settings.rb
+++ b/db/dev_seeds/settings.rb
@@ -59,9 +59,9 @@ section "Creating Settings" do
"transparent and democratic government")
Setting.create(key: "meta_keywords", value: "citizen participation, open government")
Setting.create(key: "min_age_to_participate", value: "16")
- Setting.create(key: "map_latitude", value: 40.41)
- Setting.create(key: "map_longitude", value: -3.7)
- Setting.create(key: "map_zoom", value: 10)
+ Setting.create(key: "map.latitude", value: 40.4332002)
+ Setting.create(key: "map.longitude", value: -3.7009591)
+ Setting.create(key: "map.zoom", value: 10)
Setting.create(key: "featured_proposals_number", value: 3)
Setting.create(key: "proposal_notification_minimum_interval_in_days", value: 0)
Setting.create(key: "direct_message_max_per_day", value: 3)
diff --git a/db/seeds.rb b/db/seeds.rb
index acd473e00..72e800f8d 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -106,9 +106,9 @@ Setting["min_age_to_participate"] = 16
Setting["featured_proposals_number"] = 3
# City map feature default configuration (Greenwich)
-Setting["map_latitude"] = 51.48
-Setting["map_longitude"] = 0.0
-Setting["map_zoom"] = 10
+Setting["map.latitude"] = 51.48
+Setting["map.longitude"] = 0.0
+Setting["map.zoom"] = 10
# Related content
Setting["related_content_score_threshold"] = -0.3
diff --git a/spec/features/admin/settings_spec.rb b/spec/features/admin/settings_spec.rb
index 954365d89..41d573299 100644
--- a/spec/features/admin/settings_spec.rb
+++ b/spec/features/admin/settings_spec.rb
@@ -37,6 +37,9 @@ feature "Admin settings" do
visit admin_settings_path
find("#map-tab").click
+ expect(page).to have_content 'To show the map to users you must enable ' \
+ '"Proposals and budget investments geolocation" ' \
+ 'on "Features" tab.'
expect(page).not_to have_css("#admin-map")
end
@@ -48,6 +51,9 @@ feature "Admin settings" do
find("#map-tab").click
expect(page).to have_css("#admin-map")
+ expect(page).not_to have_content 'To show the map to users you must enable ' \
+ '"Proposals and budget investments geolocation" ' \
+ 'on "Features" tab.'
end
scenario "Should show successful notice" do