Sha256: 4d97cd7d51f5037ad6546a7f7d2c2500b080b5a8ed9ef36163847216dba931bc

Contents?: true

Size: 901 Bytes

Versions: 44

Compression:

Stored size: 901 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, anchor: '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, anchor: 'filter'
    end

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

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
blacklight-spotlight-1.5.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-1.4.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-1.4.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-1.3.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-1.2.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-1.1.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-1.0.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-1.0.0.alpha2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-1.0.0.alpha1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.34.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.34.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.33.3 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.33.2 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.33.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.33.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.32.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.31.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.30.0 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.29.1 app/controllers/spotlight/filters_controller.rb
blacklight-spotlight-0.29.0 app/controllers/spotlight/filters_controller.rb