Class: FolderController

Inherits:
ApplicationController show all
Includes:
Blacklight::SolrHelper
Defined in:
vendor/plugins/blacklight/app/controllers/folder_controller.rb

Constant Summary

Constants included from Blacklight::SolrHelper

MaxPerPage

Instance Method Summary (collapse)

Methods included from Blacklight::SolrHelper

#facet_limit_for, #facet_limit_hash, #get_facet_pagination, #get_opensearch_response, #get_search_results, #get_single_doc_via_search, #get_solr_response_for_doc_id, #get_solr_response_for_field_values, included, #max_per_page, #solr_doc_params, #solr_facet_params, #solr_opensearch_params, #solr_param_quote, #solr_search_params

Methods inherited from ApplicationController

#current_user, #default_html_head, #error, #extra_head_content, #javascript_includes, #stylesheet_links, #user_class

Methods included from HydraAccessControlsHelper

#editor?, #reader?, #test_permission

Instance Method Details

- (Object) clear

get rid of the items in the folder



26
27
28
29
30
# File 'vendor/plugins/blacklight/app/controllers/folder_controller.rb', line 26

def clear
  flash[:notice] = "Cleared Folder"
  session[:folder_document_ids] = []
  redirect_to folder_index_path
end

- (Object) create

add a document_id to the folder



11
12
13
14
15
16
# File 'vendor/plugins/blacklight/app/controllers/folder_controller.rb', line 11

def create
  session[:folder_document_ids] = session[:folder_document_ids] || []
  session[:folder_document_ids] << params[:id] 
  flash[:notice] = "#{params[:title] || "Item"} successfully added to Folder"
  redirect_to :back
end

- (Object) destroy

remove a document_id from the folder



19
20
21
22
23
# File 'vendor/plugins/blacklight/app/controllers/folder_controller.rb', line 19

def destroy
  session[:folder_document_ids].delete(params[:id])
  flash[:notice] = "#{params[:title] || "Item"} successfully removed from Folder"
  redirect_to :back
end

- (Object) index

fetch the documents that match the ids in the folder



6
7
8
# File 'vendor/plugins/blacklight/app/controllers/folder_controller.rb', line 6

def index
  @response, @documents = get_solr_response_for_field_values("id",session[:folder_document_ids] || [])
end