Sha256: a0a0c41f8e0272740ad30f6cb12979d05a3a60b763e43fe3aa27afd2d83b35b1

Contents?: true

Size: 1.11 KB

Versions: 33

Compression:

Stored size: 1.11 KB

Contents

module Spotlight
  ##
  # Global site configuration
  class SitesController < Spotlight::ApplicationController
    before_action :authenticate_user!
    before_action :load_site
    load_and_authorize_resource

    def edit; end

    def edit_exhibits; end

    def update
      if @site.update(site_params)
        redirect_to exhibits_path, notice: t(:'helpers.submit.site.updated', model: @site.class.model_name.human.downcase)
      else
        flash[:alert] = @site.errors.full_messages.join('<br>'.html_safe)
        render action: :edit
      end
    end

    def tags
      authorize! :tag, @site

      respond_to do |format|
        format.json { render json: Spotlight::Exhibit.all_tags.map(&:name) }
      end
    end

    private

    def load_site
      @site ||= Spotlight::Site.instance
    end

    def site_params
      params.require(:site).permit(
        :title,
        :subtitle,
        masthead_attributes: masthead_params,
        exhibits_attributes: [:id, :weight]
      )
    end

    def masthead_params
      [
        :display,
        :iiif_region,
        :iiif_tilesource
      ]
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

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