Sha256: 706e6596373929c05c038a4c9a414c407a900b1f52ba3491336891006f41851e

Contents?: true

Size: 895 Bytes

Versions: 18

Compression:

Stored size: 895 Bytes

Contents

module Spotlight
  # Create and update filters for an exhibit
  class FiltersController < ApplicationController
    before_action :authenticate_user!
    load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit'
    load_and_authorize_resource through: :exhibit

    def create
      if @filter.save
        flash[:notice] = t('helpers.submit.filter.updated', model: @filter.model_name.human)
      else
        flash[:alert] = @filter.errors.full_messages.join('<br/>'.html_safe)
      end
      redirect_to spotlight.edit_exhibit_path @exhibit, tab: 'filter'
    end

    def update
      unless @filter.update(filter_params)
        flash[:alert] = @filter.errors.full_messages.join('<br/>'.html_safe)
      end
      redirect_to spotlight.edit_exhibit_path @exhibit, tab: 'filter'
    end

    def filter_params
      params.require(:filter).permit(:field, :value)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.4.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.3.3 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.3.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.3.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.3.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.2.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.2.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.1.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.0.rc6 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.0.rc5 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.0.rc4 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.0.rc3 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.0.rc2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-2.0.0.rc1 app/controllers/spotlight/filters_controller.rb