Fix map settings redirection
This commit is contained in:
committed by
Javi Martín
parent
cb91a7421d
commit
91c3bde36b
@@ -20,6 +20,7 @@
|
|||||||
<%= hidden_field_tag :latitude, Setting["map.latitude"] %>
|
<%= hidden_field_tag :latitude, Setting["map.latitude"] %>
|
||||||
<%= hidden_field_tag :longitude, Setting["map.longitude"] %>
|
<%= hidden_field_tag :longitude, Setting["map.longitude"] %>
|
||||||
<%= hidden_field_tag :zoom, Setting["map.zoom"] %>
|
<%= hidden_field_tag :zoom, Setting["map.zoom"] %>
|
||||||
|
<%= hidden_field_tag :tab, tab if tab %>
|
||||||
|
|
||||||
<div class="small-12 medium-6 large-4 margin-top">
|
<div class="small-12 medium-6 large-4 margin-top">
|
||||||
<%= submit_tag t("admin.settings.index.map.form.submit"),
|
<%= submit_tag t("admin.settings.index.map.form.submit"),
|
||||||
|
|||||||
@@ -1,2 +1,7 @@
|
|||||||
class Admin::Settings::MapFormComponent < ApplicationComponent
|
class Admin::Settings::MapFormComponent < ApplicationComponent
|
||||||
|
attr_reader :tab
|
||||||
|
|
||||||
|
def initialize(tab: nil)
|
||||||
|
@tab = tab
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Admin::SettingsController < Admin::BaseController
|
|||||||
Setting["map.latitude"] = params[:latitude].to_f
|
Setting["map.latitude"] = params[:latitude].to_f
|
||||||
Setting["map.longitude"] = params[:longitude].to_f
|
Setting["map.longitude"] = params[:longitude].to_f
|
||||||
Setting["map.zoom"] = params[:zoom].to_i
|
Setting["map.zoom"] = params[:zoom].to_i
|
||||||
redirect_to admin_settings_path, notice: t("admin.settings.index.map.flash.update")
|
redirect_to request_referer, notice: t("admin.settings.index.map.flash.update")
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_content_types
|
def update_content_types
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<p><%= t("admin.settings.index.map.help") %></p>
|
<p><%= t("admin.settings.index.map.help") %></p>
|
||||||
|
|
||||||
<%= render Admin::Settings::MapFormComponent.new %>
|
<%= render Admin::Settings::MapFormComponent.new(tab: "#tab-map-configuration") %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="callout primary">
|
<div class="callout primary">
|
||||||
<%= t("admin.settings.index.map.how_to_enable") %>
|
<%= t("admin.settings.index.map.how_to_enable") %>
|
||||||
|
|||||||
@@ -222,6 +222,17 @@ describe "Admin settings", :admin do
|
|||||||
expect(page).to have_current_path(admin_settings_path)
|
expect(page).to have_current_path(admin_settings_path)
|
||||||
expect(page).to have_css("div#tab-map-configuration.is-active")
|
expect(page).to have_css("div#tab-map-configuration.is-active")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "On #tab-map-configuration when using the interactive map" do
|
||||||
|
visit admin_settings_path(anchor: "tab-map-configuration")
|
||||||
|
within "#map-form" do
|
||||||
|
click_button "Update"
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(page).to have_content("Map configuration updated successfully.")
|
||||||
|
expect(page).to have_current_path(admin_settings_path)
|
||||||
|
expect(page).to have_css("div#tab-map-configuration.is-active")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "On #tab-proposals" do
|
scenario "On #tab-proposals" do
|
||||||
|
|||||||
Reference in New Issue
Block a user