Class: Spotlight::TagsController

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

Overview

CRUD actions for document tags

Instance Method Summary collapse

Methods included from Concerns::ApplicationController

#enabled_in_spotlight_view_type_configuration?, #field_enabled?

Methods included from Controller

#blacklight_config, #current_exhibit, #current_masthead, #current_masthead=, #current_site, #default_url_options, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_url, #resource_masthead?, #search_action_url, #search_facet_url, #set_exhibit_locale_scope, #set_locale

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#destroyObject



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

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



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

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