Module: SearchHelper
- Defined in:
- app/helpers/search_helper.rb
Instance Method Summary collapse
- #days ⇒ Object
-
#group_list ⇒ Object
A-Z buttons in search page.
- #months ⇒ Object
-
#referent_labels(context_obj = @current_context_object) ⇒ Object
pass in an openurl context obj.
-
#search_date_select ⇒ Object
Date dropdowns in search page.
- #search_result_target_window ⇒ Object
- #years ⇒ Object
Instance Method Details
#days ⇒ Object
56 57 58 |
# File 'app/helpers/search_helper.rb', line 56 def days select_day(nil, {:prompt => true}, {:name => "__day", :class=>"day form-control"}) end |
#group_list ⇒ Object
A-Z buttons in search page
39 40 41 |
# File 'app/helpers/search_helper.rb', line 39 def group_list group_list ||= ('A'..'Z').to_a.push('0-9').push(t('umlaut.search.browse_other')) end |
#months ⇒ Object
52 53 54 |
# File 'app/helpers/search_helper.rb', line 52 def months select_month(nil, {:prompt => true, :use_short_month => true}, {:name => "__month", :class=>"month form-control"}) end |
#referent_labels(context_obj = @current_context_object) ⇒ Object
pass in an openurl context obj. return an OpenStruct with :atitle and :title labels
Uses i18n
Much of this duplicates Referent.type_thing_name and container_type_of_thing, although we don’t have a Referent here, that logic should be combined. TODO
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/search_helper.rb', line 16 def referent_labels(context_obj = @current_context_object) = context_obj.referent. result = OpenStruct.new type_of_thing_key = ['genre'] type_of_thing_key = context_obj.referent.format if type_of_thing_key.blank? type_of_thing_key = type_of_thing_key.downcase a_key = type_of_thing_key if a_key == "journal" && ['atitle'].present? a_key = "article" end result.atitle = I18n.t(a_key, :scope => "umlaut.citation.genre", :default => "") c_key = type_of_thing_key c_key = 'journal' if c_key == "article" c_key = 'book' if c_key == "bookitem" result.title = I18n.t(c_key, :scope => "umlaut.citation.genre", :default => "") return result end |
#search_date_select ⇒ Object
Date dropdowns in search page
44 45 46 |
# File 'app/helpers/search_helper.rb', line 44 def search_date_select years + months + days end |
#search_result_target_window ⇒ Object
5 6 7 |
# File 'app/helpers/search_helper.rb', line 5 def search_result_target_window umlaut_config.lookup!("search.result_link_target","") end |
#years ⇒ Object
48 49 50 |
# File 'app/helpers/search_helper.rb', line 48 def years select_year(nil, {:prompt => true, :start_year => Date.today.year, :end_year => 1950}, {:name => "__year", :class=>"year form-control"}) end |