Sha256: 096d5d3514fac714a3411d1f31847139fe7d21197c0f265f1b31c713536c2b20

Contents?: true

Size: 1.52 KB

Versions: 18

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # Edit and update an exhibit's appearance
  class AppearancesController < Spotlight::ApplicationController
    before_action :authenticate_user!
    load_and_authorize_resource id_param: :exhibit_id, instance_name: 'exhibit', class: 'Spotlight::Exhibit', parent: false

    def update
      if @exhibit.update(exhibit_params)
        notice = t(:'helpers.submit.spotlight_default.updated', model: @exhibit.class.model_name.human.downcase)
        redirect_to edit_exhibit_appearance_path(@exhibit), notice: notice
      else
        render 'edit'
      end
    end

    def edit
      add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
      add_breadcrumb t(:'spotlight.configuration.sidebar.header'), exhibit_dashboard_path(@exhibit)
      add_breadcrumb t(:'spotlight.configuration.sidebar.appearance'), edit_exhibit_appearance_path(@exhibit)
    end

    protected

    def exhibit_params
      params.require(:exhibit).permit(:theme,
                                      main_navigations_attributes: [:id, :display, :label, :weight],
                                      masthead_attributes: featured_image_params,
                                      thumbnail_attributes: featured_image_params)
    end

    def featured_image_params
      [
        :iiif_region, :iiif_tilesource,
        :iiif_manifest_url, :iiif_canvas_id,
        :iiif_image_id,
        :display,
        :source,
        :image,
        :document_global_id
      ]
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-3.0.0.alpha.1 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.13.0 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.12.1 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.12.0 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.11.0 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.10.0 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.9.0 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.8.0 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.7.2 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.7.1 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.7.0 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.6.1.1 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.6.1 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.6.0 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.5.2 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.5.1 app/controllers/spotlight/appearances_controller.rb
blacklight-spotlight-2.5.0 app/controllers/spotlight/appearances_controller.rb