diff --git a/app/assets/javascripts/map.js.coffee b/app/assets/javascripts/map.js.coffee index 241093d75..562b035e0 100644 --- a/app/assets/javascripts/map.js.coffee +++ b/app/assets/javascripts/map.js.coffee @@ -74,7 +74,7 @@ App.Map = openMarkerPopup = (e) -> marker = e.target - $.ajax 'investments/' + marker.options['id'] + '/json_data', + $.ajax '/investments/' + marker.options['id'] + '/json_data', type: 'GET' dataType: 'json' success: (data) -> diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index a2e3ed6bf..88738c072 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -881,7 +881,7 @@ footer { .sidebar-map { .map { - z-index: -1; + z-index: 0; } } diff --git a/app/models/map_location.rb b/app/models/map_location.rb index d141c167d..892ba8f20 100644 --- a/app/models/map_location.rb +++ b/app/models/map_location.rb @@ -22,7 +22,7 @@ class MapLocation < ActiveRecord::Base map = new map.zoom = Budget::Heading::OSM_DISTRICT_LEVEL_ZOOM map.latitude = heading.latitude.to_f if heading.latitude.present? - map.longitude = heading.longitude.to_f if heading.latitude.present? + map.longitude = heading.longitude.to_f if heading.longitude.present? map end diff --git a/app/views/admin/budget_groups/edit.html.erb b/app/views/admin/budget_groups/edit.html.erb index 4ed1ad7f9..0730a4206 100644 --- a/app/views/admin/budget_groups/edit.html.erb +++ b/app/views/admin/budget_groups/edit.html.erb @@ -1,3 +1,3 @@ <%= render "header", action: "edit" %> -<%= render "form", path: admin_budget_group_path(@budget, @group), action: "edit" %> +<%= render "form", path: admin_budget_group_path(@budget, @group), action: "submit" %> diff --git a/app/views/admin/budget_headings/_form.html.erb b/app/views/admin/budget_headings/_form.html.erb index ebc5aa2ae..f11ecb230 100644 --- a/app/views/admin/budget_headings/_form.html.erb +++ b/app/views/admin/budget_headings/_form.html.erb @@ -32,8 +32,14 @@ label: t("admin.budget_headings.form.longitude"), maxlength: 22, placeholder: "longitude" %> +

+ <%= t("admin.budget_headings.form.coordinates_info") %> +

<%= f.check_box :allow_custom_content, label: t("admin.budget_headings.form.allow_content_block") %> +

+ <%= t("admin.budget_headings.form.content_blocks_info") %> +

<%= f.submit t("admin.budget_headings.form.#{action}"), class: "button success" %> <% end %> diff --git a/app/views/admin/budget_headings/edit.html.erb b/app/views/admin/budget_headings/edit.html.erb index a01fa70a4..124d07510 100644 --- a/app/views/admin/budget_headings/edit.html.erb +++ b/app/views/admin/budget_headings/edit.html.erb @@ -1,3 +1,3 @@ <%= render "header", action: "edit" %> -<%= render "form", path: admin_budget_group_heading_path(@budget, @group, @heading), action: "edit" %> +<%= render "form", path: admin_budget_group_heading_path(@budget, @group, @heading), action: "submit" %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index edff8acf7..5db9d0755 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -151,9 +151,11 @@ en: amount: "Amount" population: "Population (optional)" population_info: "Budget Heading population field is used for Statistic purposes at the end of the Budget to show for each Heading that represents an area with population what percentage voted. The field is optional so you can leave it empty if it doesn't apply." - latitude: "Latitude" - longitude: "Longitude" + latitude: "Latitude (optional)" + longitude: "Longitude (optional)" + coordinates_info: "If latitude and longitude are provided, the investments page for this heading will include a map. This map will be centered using those coordinates." allow_content_block: "Allow content block" + content_blocks_info: "If allow content block is checked, you will be able to create custom content related to this heading from the section Settings > Custom content blocks. This content will appear on the investments page for this heading." create: "Create new heading" edit: "Edit heading" submit: "Save heading" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index c099bce58..f43cefd02 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -151,9 +151,11 @@ es: amount: "Cantidad" population: "Población (opcional)" population_info: "El campo población de las partidas presupuestarias se usa con fines estadísticos únicamente, con el objetivo de mostrar el porcentaje de votos habidos en cada partida que represente un área con población. Es un campo opcional, así que puedes dejarlo en blanco si no aplica." - latitude: "Latitud" - longitude: "Longitud" + latitude: "Latitud (opcional)" + longitude: "Longitud (opcional)" + coordinates_info: "Si se añaden los campos latitud y longitud, en la página de proyectos de esta partida aparecerá un mapa, que estará centrado en esas coordenadas." allow_content_block: "Permitir bloque de contenidos" + content_blocks_info: "Si se permite el bloque de contenidos, se tendrá la oportunidad de crear bloques de contenido relativos a esta partida desde la sección Configuración > Personalizar bloques. Este contenido aparecerá en la página de proyectos de esta partida." create: "Crear nueva partida" edit: "Editar partida" submit: "Guardar partida" diff --git a/spec/features/admin/budget_groups_spec.rb b/spec/features/admin/budget_groups_spec.rb index 2d465a224..414f3618a 100644 --- a/spec/features/admin/budget_groups_spec.rb +++ b/spec/features/admin/budget_groups_spec.rb @@ -154,7 +154,7 @@ feature "Admin budget groups" do fill_in "Group name", with: "Districts" select "2", from: "Maximum number of headings in which a user can vote" - click_button "Edit group" + click_button "Save group" expect(page).to have_content "Group updated successfully" @@ -170,7 +170,7 @@ feature "Admin budget groups" do expect(page).to have_field "Group name", with: "All City" fill_in "Group name", with: "Districts" - click_button "Edit group" + click_button "Save group" expect(page).not_to have_content "Group updated successfully" expect(page).to have_css("label.error", text: "Group name") diff --git a/spec/features/admin/budget_headings_spec.rb b/spec/features/admin/budget_headings_spec.rb index 5b300c7bb..7094ab9de 100644 --- a/spec/features/admin/budget_headings_spec.rb +++ b/spec/features/admin/budget_headings_spec.rb @@ -147,8 +147,8 @@ feature "Admin budget headings" do expect(page).to have_field "Heading name", with: heading.name expect(page).to have_field "Amount", with: heading.price expect(page).to have_field "Population (optional)", with: heading.population - expect(page).to have_field "Longitude", with: heading.longitude - expect(page).to have_field "Latitude", with: heading.latitude + expect(page).to have_field "Longitude (optional)", with: heading.longitude + expect(page).to have_field "Latitude (optional)", with: heading.latitude expect(find_field("Allow content block")).not_to be_checked end @@ -170,17 +170,17 @@ feature "Admin budget headings" do expect(page).to have_field "Heading name", with: "All City" expect(page).to have_field "Amount", with: 1000 expect(page).to have_field "Population (optional)", with: 10000 - expect(page).to have_field "Longitude", with: 20.50 - expect(page).to have_field "Latitude", with: -10.50 + expect(page).to have_field "Longitude (optional)", with: 20.50 + expect(page).to have_field "Latitude (optional)", with: -10.50 expect(find_field("Allow content block")).to be_checked fill_in "Heading name", with: "Districts" fill_in "Amount", with: "2000" fill_in "Population (optional)", with: "20000" - fill_in "Longitude", with: "-40.47" - fill_in "Latitude", with: "25.25" + fill_in "Longitude (optional)", with: "-40.47" + fill_in "Latitude (optional)", with: "25.25" uncheck "Allow content block" - click_button "Edit heading" + click_button "Save heading" expect(page).to have_content "Heading updated successfully" @@ -188,8 +188,8 @@ feature "Admin budget headings" do expect(page).to have_field "Heading name", with: "Districts" expect(page).to have_field "Amount", with: 2000 expect(page).to have_field "Population (optional)", with: 20000 - expect(page).to have_field "Longitude", with: -40.47 - expect(page).to have_field "Latitude", with: 25.25 + expect(page).to have_field "Longitude (optional)", with: -40.47 + expect(page).to have_field "Latitude (optional)", with: 25.25 expect(find_field("Allow content block")).not_to be_checked end @@ -200,7 +200,7 @@ feature "Admin budget headings" do expect(page).to have_field "Heading name", with: "All City" fill_in "Heading name", with: "Districts" - click_button "Edit heading" + click_button "Save heading" expect(page).not_to have_content "Heading updated successfully" expect(page).to have_css("label.error", text: "Heading name")