app/controllers/spotlight/exhibits_controller.rb in blacklight-spotlight-1.5.1 vs app/controllers/spotlight/exhibits_controller.rb in blacklight-spotlight-2.0.0.rc1

- old
+ new

@@ -1,10 +1,11 @@ module Spotlight ## # Administrative CRUD actions for an exhibit class ExhibitsController < Spotlight::ApplicationController before_action :authenticate_user!, except: [:index] + before_action :set_tab, only: [:edit, :update] include Blacklight::SearchHelper load_and_authorize_resource def index @@ -61,11 +62,13 @@ build_initial_exhibit_contact_emails end def update if @exhibit.update(exhibit_params) - redirect_to edit_exhibit_path(@exhibit), notice: t(:'helpers.submit.exhibit.updated', model: @exhibit.class.model_name.human.downcase) + redirect_to edit_exhibit_path(@exhibit, tab: @tab), + notice: t(:'helpers.submit.exhibit.updated', + model: @exhibit.class.model_name.human.downcase) else flash[:alert] = @exhibit.errors.full_messages.join('<br>'.html_safe) render action: :edit end end @@ -87,11 +90,16 @@ :title, :subtitle, :description, :published, :tag_list, - contact_emails_attributes: [:id, :email] + contact_emails_attributes: [:id, :email], + languages_attributes: [:id, :public] ) + end + + def set_tab + @tab = params[:tab] end def create_params params.require(:exhibit).permit( :title,