Class: TagsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- TagsController
- Includes:
- Blacklight::SolrHelper
- Defined in:
- app/controllers/tags_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/tags_controller.rb', line 45 def create @response, @documents = get_solr_response_for_field_values("id",params[:catalog_id]) @document = @documents.first #@document.tag_list << params[:tags].split(",").map(&:strip) if current_user current_user.tag(@document, :with => params[:tags], :on => 'tags') else User.new.tag(@document, :with => params[:tags], :on => 'tags') end @document.save rescue nil respond_to do |format| format.html { redirect_to (:catalog_id => @document.id) } format.json { render :json => @document.tag_list } end end |
#destroy ⇒ Object
69 70 71 72 |
# File 'app/controllers/tags_controller.rb', line 69 def destroy @tag = ActsAsTaggableOn::Tag.find_by_name(params[:id]) @tag.destroy end |
#edit ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/controllers/tags_controller.rb', line 37 def edit @tag = ActsAsTaggableOn::Tag.find_by_name(params[:id]) respond_to do |format| format.html end end |
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/tags_controller.rb', line 4 def index @response, @documents = get_solr_response_for_field_values("id",params[:catalog_id]) @document = @documents.first @tags = @document.owner_tag_list_on(nil, :tags) respond_to do |format| format.html end end |
#new ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/tags_controller.rb', line 26 def new @response, @documents = get_solr_response_for_field_values("id",params[:catalog_id]) @document = @documents.first @tags = @document.owner_tag_list_on(nil, :tags) respond_to do |format| format.html end end |
#show ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/tags_controller.rb', line 15 def show @response, @documents = get_solr_response_for_field_values("id",params[:catalog_id]) @document = @documents.first @tags = @document.owner_tag_list_on(nil, :tags) respond_to do |format| format.html end end |
#update ⇒ Object
63 64 65 66 67 |
# File 'app/controllers/tags_controller.rb', line 63 def update @response, @documents = get_solr_response_for_field_values("id",params[:catalog_id]) @document = @documents.first end |