Allow redirect to remote census configuration tab
Currently after each update of any Settings is redirected to the first tab by default. As this new tab remote_census_configuation has a lot of fields to fill in it is a bit uncomfortable to have to go back to the tab after each update. - Add hidden field :tag to set current tag value - After update add tag value to request.referer - To avoid errors when partial call has not param :tag, add the "define?" method on hidden_field value.
This commit is contained in:
@@ -23,7 +23,7 @@ class Admin::SettingsController < Admin::BaseController
|
||||
def update
|
||||
@setting = Setting.find(params[:id])
|
||||
@setting.update(settings_params)
|
||||
redirect_to request.referer, notice: t("admin.settings.flash.updated")
|
||||
redirect_to request_referer, notice: t("admin.settings.flash.updated")
|
||||
end
|
||||
|
||||
def update_map
|
||||
@@ -53,4 +53,8 @@ class Admin::SettingsController < Admin::BaseController
|
||||
params.permit(:jpg, :png, :gif, :pdf, :doc, :docx, :xls, :xlsx, :csv, :zip)
|
||||
end
|
||||
|
||||
def request_referer
|
||||
return request.referer + params[:setting][:tab] if params[:setting][:tab]
|
||||
request.referer
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user