Sha256: 42a81dc852a330ff481c751dad2b564f9e25dff45b49abf8960a6d38d187578c

Contents?: true

Size: 908 Bytes

Versions: 59

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

59 entries across 59 versions & 1 rubygems

Version Path
blacklight-spotlight-3.6.0.beta7 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.5.0.3 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta6 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta5 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta4 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta3 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.6.0.beta1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.5.0.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.5.0.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.5.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.4.4.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.4.4 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.4.3 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.4.2.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.4.2.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.4.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.4.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.4.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.3.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-3.2.0 app/controllers/spotlight/filters_controller.rb