Sha256: 2eff4b5f1a42fa4a86d14dacbdba28a8522f1a14bea119116f6faeee2b4c78f2

Contents?: true

Size: 1022 Bytes

Versions: 30

Compression:

Stored size: 1022 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # CRUD actions for document tags
  class TagsController < Spotlight::ApplicationController
    before_action :authenticate_user!
    load_and_authorize_resource :exhibit, class: Spotlight::Exhibit

    def index
      authorize! :tag, @exhibit
      @tags = @exhibit.owned_tags
      add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
      add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
      add_breadcrumb t(:'spotlight.curation.sidebar.tags'), exhibit_tags_path(@exhibit)

      respond_to do |format|
        format.html
        format.json { render json: @exhibit.owned_tags.map(&:name) }
      end
    end

    def destroy
      authorize! :tag, @exhibit
      # warning: this causes every solr document with this tag to reindex.  That could be slow.
      @exhibit.owned_taggings.where(tag_id: params[:id]).destroy_all

      redirect_to exhibit_tags_path(@exhibit)
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.rc4 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.rc3 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.rc2 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.rc1 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.10 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.9 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.8 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.7 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.6 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.5 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.4 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.3 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.2 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-3.0.0.alpha.1 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-2.13.0 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-2.12.1 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-2.12.0 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-2.11.0 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-2.10.0 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-2.9.0 app/controllers/spotlight/tags_controller.rb