Sha256: 42a81dc852a330ff481c751dad2b564f9e25dff45b49abf8960a6d38d187578c

Contents?: true

Size: 908 Bytes

Versions: 58

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

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
      flash[:alert] = @filter.errors.full_messages.join('<br/>'.html_safe) unless @filter.update(filter_params)
      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

58 entries across 58 versions & 1 rubygems

Version Path
blacklight-spotlight-4.3.6 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.3.5 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.3.4 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.3.3 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.3.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.3.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.3.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.2.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.1.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.1.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.1.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.0.3 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.0.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.0.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-4.0.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta10 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta9 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta8 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.5.0.4 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta7 app/controllers/spotlight/filters_controller.rb