Module: Atrium::CollectionsHelper

Included in:
ApplicationHelper, ApplicationController, CollectionsHelper
Defined in:
app/helpers/atrium/collections_helper.rb

Instance Method Summary collapse

Instance Method Details

#get_saved_itemsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/atrium/collections_helper.rb', line 30

def get_saved_items
  saved_items=Atrium.saved_items_for(current_user)
  items=[]
  saved_items.each { |item|
    temp={}
    temp[:id]=item.document_id
    temp[:title]=item.title
    #temp[item.document_id]=item.title
    items<<temp
  }
  logger.debug(saved_items.inspect)
  items
end

#get_saved_searchObject



26
27
28
# File 'app/helpers/atrium/collections_helper.rb', line 26

def get_saved_search
  Atrium.saved_searches_for(current_user)
end

#saved_searches_for_selectObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/atrium/collections_helper.rb', line 3

def saved_searches_for_select
  get_saved_search.collect do |search|
    query_params = {}

    begin
      query_params[:q] = search[:query_params].fetch(:q)
    rescue NoMethodError, KeyError
    end

    begin
      query_params[:f] = search[:query_params].fetch(:f)
    rescue NoMethodError, KeyError
    end

    [
      strip_tags(
        Atrium.query_param_beautifier(self,query_params).gsub("<"," <")
      ),
      search[:id]
    ]
  end
end