Module: SearchHelper

Defined in:
app/helpers/search_helper.rb

Instance Method Summary collapse

Instance Method Details

#dateObject

Date dropdowns in search page



47
48
49
# File 'app/helpers/search_helper.rb', line 47

def date
  years + months + days
end

#daysObject



59
60
61
# File 'app/helpers/search_helper.rb', line 59

def days
  select_day(nil, {:prompt => true}, {:name => "__day", :class=>"day input-small"})
end

#group_listObject

A-Z buttons in search page



42
43
44
# File 'app/helpers/search_helper.rb', line 42

def group_list
  group_list ||= ('A'..'Z').to_a.push('0-9').push('Other')  
end

#monthsObject



55
56
57
# File 'app/helpers/search_helper.rb', line 55

def months
  select_month(nil, {:prompt => true, :use_short_month => true}, {:name => "__month", :class=>"month input-small"})
end

#referent_labels(context_obj = @current_context_object) ⇒ Object

pass in an openurl context obj. return an OpenStruct with atitle_label, title_label



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/helpers/search_helper.rb', line 11

def referent_labels(context_obj = @current_context_object)
  ref_meta = context_obj.referent.
  result = OpenStruct.new
  if ref_meta['genre'].blank?
    case @current_context_object.referent.format 
    when  'book'
      result.atitle = 'Chapter/Part Title'
    when @current_context_object.referent.format == 'journal'
      result.atitle = 'Article Title'
    end
    result.title = 'Title'      
  else
    case ref_meta["genre"]
    when /article|journal|issue/
      result.atitle = 'Article Title'
      result.title = 'Journal Title'
    when /bookitem|book/
      result.atitle = 'Chapter/Part Title'
      result.title = 'Book Title'
    when /proceeding|conference/
      result.atitle = 'Proceeding Title'
      result.title = 'Conference Name'
    when 'report'
      result.atitle = 'Report Title'
      result.title = 'Report'
    end
  end
  return result    
end

#search_result_target_windowObject



5
6
7
# File 'app/helpers/search_helper.rb', line 5

def search_result_target_window
  umlaut_config.lookup!("search.result_link_target","")
end

#yearsObject



51
52
53
# File 'app/helpers/search_helper.rb', line 51

def years
  select_year(nil, {:prompt => true, :start_year => Date.today.year, :end_year => 1950}, {:name => "__year", :class=>"year input-small"})
end