Sha256: 448cf2204d88bb672929aa882d1dcc9eae53144334ad96f67557b5ca9448cf5b

Contents?: true

Size: 959 Bytes

Versions: 5

Compression:

Stored size: 959 Bytes

Contents

module Spotlight
  class TagsController < Spotlight::ApplicationController
    before_filter :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 { |x| x.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

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-0.3.1 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-0.3.0 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-0.2.0 app/controllers/spotlight/tags_controller.rb
blacklight-spotlight-0.1.0 app/controllers/spotlight/tags_controller.rb