Class: CatalogController

Inherits:
ApplicationController show all
Includes:
Blacklight::Catalog, BlacklightAdvancedSearch::ParseBasicQ, Hydra::Controller::ControllerBehavior
Defined in:
app/controllers/catalog_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#show_action_bar?, #sufia, with_themed_layout

Instance Method Details

#indexObject



43
44
45
46
47
48
# File 'app/controllers/catalog_controller.rb', line 43

def index
  super
  recent
  #also grab my recent docs too
  recent_me
end

#recentObject



50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/catalog_controller.rb', line 50

def recent
  if user_signed_in?
    # grab other people's documents
    (resp, doc_list) = get_search_results(:q =>'{!lucene q.op=AND df=depositor_t}-'+current_user.user_key, :sort=>"system_create_dt desc", :rows=>3)
  else
    # grab any documents we do not know who you are
    (resp, doc_list) = get_search_results(:q =>'', :sort=>"system_create_dt desc", :rows=>3)
  end
  @recent_documents = doc_list[0..3]
end

#recent_meObject



61
62
63
64
65
66
67
68
# File 'app/controllers/catalog_controller.rb', line 61

def recent_me
  if user_signed_in?
    (resp, doc_list) = get_search_results(:q =>'{!lucene q.op=AND df=depositor_t}'+current_user.user_key, :sort=>"system_create_dt desc", :rows=>3)
    @recent_user_documents = doc_list[0..3]
  else
     @recent_user_documents = nil
  end
end