From 5815389cb8c3b356281095b5863a4d0e5607ef7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= Date: Tue, 8 Aug 2017 11:56:46 +0200 Subject: [PATCH] Rename map settings keys --- app/controllers/admin/settings_controller.rb | 6 +++--- app/helpers/map_locations_helper.rb | 6 +++--- app/views/admin/settings/_map_form.html.erb | 16 ++++++++-------- config/locales/en/settings.yml | 3 +++ config/locales/es/settings.yml | 3 +++ db/dev_seeds.rb | 6 +++--- db/seeds.rb | 6 +++--- 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index 2d69ff19a..14dfc6658 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -15,9 +15,9 @@ class Admin::SettingsController < Admin::BaseController end def update_map - Setting["map.latitude"] = params[:latitude].to_f - Setting["map.longitude"] = params[:longitude].to_f - Setting["map.zoom"] = params[:zoom].to_i + Setting["map_latitude"] = params[:latitude].to_f + Setting["map_longitude"] = params[:longitude].to_f + Setting["map_zoom"] = params[:zoom].to_i redirect_to admin_settings_path, notice: t("admin.settings.index.map.flash.update") end diff --git a/app/helpers/map_locations_helper.rb b/app/helpers/map_locations_helper.rb index 1df7a861c..e0350773c 100644 --- a/app/helpers/map_locations_helper.rb +++ b/app/helpers/map_locations_helper.rb @@ -5,15 +5,15 @@ module MapLocationsHelper end def map_location_latitude(map_location) - map_location.present? && map_location.latitude.present? ? map_location.latitude : Setting["map.latitude"] + map_location.present? && map_location.latitude.present? ? map_location.latitude : Setting["map_latitude"] end def map_location_longitude(map_location) - map_location.present? && map_location.longitude.present? ? map_location.longitude : Setting["map.longitude"] + map_location.present? && map_location.longitude.present? ? map_location.longitude : Setting["map_longitude"] end def map_location_zoom(map_location) - map_location.present? && map_location.zoom.present? ? map_location.zoom : Setting["map.zoom"] + map_location.present? && map_location.zoom.present? ? map_location.zoom : Setting["map_zoom"] end def map_location_input_id(prefix, attribute) diff --git a/app/views/admin/settings/_map_form.html.erb b/app/views/admin/settings/_map_form.html.erb index beac8e87b..1f74698f1 100644 --- a/app/views/admin/settings/_map_form.html.erb +++ b/app/views/admin/settings/_map_form.html.erb @@ -2,14 +2,14 @@
" - 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-attribution-selector="#admin-map-attribution" data-map-tiles-provider="//{s}.tile.osm.org/{z}/{x}/{y}.png" 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"> @@ -20,9 +20,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/settings.yml b/config/locales/en/settings.yml index 81ddd57d9..eaf610f4d 100644 --- a/config/locales/en/settings.yml +++ b/config/locales/en/settings.yml @@ -41,6 +41,9 @@ en: legislation: Legislation community: Community on proposals and investments map: Proposals and budget investments geolocation + map_latitude: Latitude + map_longitude: Longitude + map_zoom: Zoom mailer_from_name: Origin email name mailer_from_address: Origin email address meta_description: "Site description (SEO)" diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml index e6cfde3b1..b23c6e688 100644 --- a/config/locales/es/settings.yml +++ b/config/locales/es/settings.yml @@ -41,6 +41,9 @@ es: legislation: Legislación community: Comunidad en propuestas y proyectos de inversión map: Geolocalización de propuestas y proyectos de inversión + map_latitude: Latitud + map_longitude: Longitud + map_zoom: Zoom mailer_from_name: Nombre email remitente mailer_from_address: Dirección email remitente meta_description: "Descripción del sitio (SEO)" diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 45b0ed27b..fcd86c44a 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -48,9 +48,9 @@ Setting.create(key: 'meta_keywords', value: 'citizen participation, open governm Setting.create(key: 'verification_offices_url', value: 'http://oficinas-atencion-ciudadano.url/') Setting.create(key: 'min_age_to_participate', value: '16') Setting.create(key: 'proposal_improvement_path', value: nil) -Setting.create(key: 'map.latitude', value: 51.48) -Setting.create(key: 'map.longitude', value: 0) -Setting.create(key: 'map.zoom', value: 10) +Setting.create(key: 'map_latitude', value: 51.48) +Setting.create(key: 'map_longitude', value: 0.0) +Setting.create(key: 'map_zoom', value: 10) puts " ✅" print "Creating Geozones" diff --git a/db/seeds.rb b/db/seeds.rb index 13a532a92..a2f25e340 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -111,6 +111,6 @@ Setting['min_age_to_participate'] = 16 Setting['proposal_improvement_path'] = nil # City map feature default configuration (Greenwich) -Setting['map.latitude'] = 51.48 -Setting['map.longitude'] = 0 -Setting['map.zoom'] = 10 +Setting['map_latitude'] = 51.48 +Setting['map_longitude'] = 0.0 +Setting['map_zoom'] = 10