app/controllers/spotlight/searches_controller.rb in blacklight-spotlight-0.23.0 vs app/controllers/spotlight/searches_controller.rb in blacklight-spotlight-0.24.0

- old
+ new

@@ -14,13 +14,14 @@ def create @search.attributes = search_params @search.query_params = query_params if @search.save - redirect_to :back, notice: t(:'helpers.submit.search.created', model: @search.class.model_name.human.downcase) + redirect_back fallback_location: fallback_url, + notice: t(:'helpers.submit.search.created', model: @search.class.model_name.human.downcase) else - redirect_to :back, alert: @search.errors.full_messages.join('<br>'.html_safe) + redirect_back fallback_location: fallback_url, alert: @search.errors.full_messages.join('<br>'.html_safe) end end def index respond_to do |format| @@ -62,11 +63,11 @@ notice = if @exhibit.update batch_search_params t(:'helpers.submit.search.batch_updated', model: Spotlight::Search.model_name.human.pluralize) else t(:'helpers.submit.search.batch_error', model: Spotlight::Search.model_name.human.pluralize.downcase) end - redirect_to :back, notice: notice + redirect_back fallback_location: fallback_url, notice: notice end def show redirect_to exhibit_browse_url(@search.exhibit, @search) end @@ -115,8 +116,12 @@ authorize! :curate, @exhibit if @exhibit end def blacklisted_search_session_params [:commit, :counter, :total, :search_id, :page, :per_page, :authenticity_token, :utf8, :action, :controller] + end + + def fallback_url + spotlight.exhibit_searches_path(current_exhibit) end end end