Class: Spotlight::TagsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spotlight/tags_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#search_action_url

Instance Method Details

#destroyObject



19
20
21
22
23
24
25
# File 'app/controllers/spotlight/tags_controller.rb', line 19

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

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/spotlight/tags_controller.rb', line 6

def index
  authorize! :tag, @exhibit
  @tags = @exhibit.owned_tags
  add_breadcrumb @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