Module: ExtractsHelper
- Defined in:
- app/helpers/extracts_helper.rb
Instance Method Summary collapse
- #extract_autocomplete_tag(extract) ⇒ Object
- #extract_link(extract) ⇒ Object
-
#extract_made_tag(extract) ⇒ String, nil\ no HTML
String, nil\ no HTML.
- #extract_origin_labels(extract) ⇒ Object
- #extract_origin_tags(extract) ⇒ Object
- #extract_otu_labels(extract) ⇒ Object
-
#extract_tag(extract) ⇒ Object
TODO: reference identifiers/origin objects etc.
- #extracts_search_form ⇒ Object
- #label_for_extract(extract) ⇒ Object
-
#label_for_extract_container(extract) ⇒ Object
TODO: expand when schemes are concentrated on.
Instance Method Details
#extract_autocomplete_tag(extract) ⇒ Object
40 41 42 43 44 45 |
# File 'app/helpers/extracts_helper.rb', line 40 def extract_autocomplete_tag(extract) return nil if extract.nil? [simple_identifier_list_tag(extract), (extract), ].join(' ').html_safe end |
#extract_link(extract) ⇒ Object
26 27 28 29 |
# File 'app/helpers/extracts_helper.rb', line 26 def extract_link(extract) return nil if extract.nil? link_to(extract_tag(extract), extract) end |
#extract_made_tag(extract) ⇒ String, nil\ no HTML
Returns String, nil\ no HTML.
49 50 51 52 53 |
# File 'app/helpers/extracts_helper.rb', line 49 def extract_made_tag(extract) [extract.year_made, extract.month_made, extract.day_made].compact.join('-') end |
#extract_origin_labels(extract) ⇒ Object
59 60 61 62 63 |
# File 'app/helpers/extracts_helper.rb', line 59 def extract_origin_labels(extract) a = extract.old_objects.collect{|o| label_for(o)} a.unshift 'Origin' if !a.nil? a ? a.join(': ') + '.' : nil end |
#extract_origin_tags(extract) ⇒ Object
65 66 67 68 69 |
# File 'app/helpers/extracts_helper.rb', line 65 def (extract) a = extract.old_objects.collect{|o| object_tag(o)} a.unshift 'Origin' if !a.nil? a ? a.join(': ') + '.' : nil end |
#extract_otu_labels(extract) ⇒ Object
55 56 57 |
# File 'app/helpers/extracts_helper.rb', line 55 def extract_otu_labels(extract) extract.referenced_otus.collect{|o| label_for_otu(o)}.join('; ') end |
#extract_tag(extract) ⇒ Object
TODO: reference identifiers/origin objects etc.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/helpers/extracts_helper.rb', line 4 def extract_tag(extract) return nil if extract.nil? e = [] if extract.old_objects.any? e.push ' from: ' e.push extract.old_objects.collect{|o| object_link(o) } else "#{extract.id} (no origin)" end return "Extract " + extract.id.to_s if e.empty? e.join.html_safe end |
#extracts_search_form ⇒ Object
71 72 73 |
# File 'app/helpers/extracts_helper.rb', line 71 def extracts_search_form render('/extracts/quick_search_form') end |
#label_for_extract(extract) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/helpers/extracts_helper.rb', line 31 def label_for_extract(extract) return nil if extract.nil? [ extract_origin_labels(extract), # extract_otu_labels(extract), extract_made_tag(extract), identifier_list_labels(extract) ].compact.join('; ') end |
#label_for_extract_container(extract) ⇒ Object
TODO: expand when schemes are concentrated on.
21 22 23 24 |
# File 'app/helpers/extracts_helper.rb', line 21 def label_for_extract_container(extract) return nil if extract.nil? extract.dwc_catalog_number || extract.id end |