Module: OtusHelper

Defined in:
app/helpers/otus_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) label_for_otu(otu)



24
25
26
27
28
29
# File 'app/helpers/otus_helper.rb', line 24

def label_for_otu(otu)
  return nil if otu.nil?
  [otu.name, 
   label_for_taxon_name(otu.taxon_name)
  ].compact.join(': ')
end

- (String) otu_autocomplete_selected_tag(otu)

Returns no HTML inside <input>

Returns:

  • (String)

    no HTML inside <input>



12
13
14
15
16
17
# File 'app/helpers/otus_helper.rb', line 12

def otu_autocomplete_selected_tag(otu)
  return nil if otu.nil? || (otu.new_record? && !otu.changed?)
  [otu.name, 
   Utilities::Strings.nil_wrap('[',taxon_name_autocomplete_selected_tag(otu.taxon_name), ']')
  ].compact.join(' ')
end


19
20
21
22
# File 'app/helpers/otus_helper.rb', line 19

def otu_link(otu)
  return nil if otu.nil?
  link_to(otu_tag(otu).html_safe, otu)
end

- (Object) otu_tag(otu)



3
4
5
6
7
8
# File 'app/helpers/otus_helper.rb', line 3

def otu_tag(otu)
  return nil if otu.nil?
  a = (:span, otu.name, class: :otu_tag_otu_name) if otu.name
  b = (:span, full_taxon_name_tag(otu.taxon_name).html_safe, class: :otu_tag_taxon_name) if otu.taxon_name_id
  (:span, [b,a].compact.join.html_safe, class: :otu_tag)
end


35
36
37
# File 'app/helpers/otus_helper.rb', line 35

def otus_link_list_tag(otus)
  otus.collect { |o| link_to(o.name, o) }.join(',')
end

- (Object) otus_radial(object)



49
50
51
# File 'app/helpers/otus_helper.rb', line 49

def otus_radial(object)
  (:div, '', 'data-global-id' => object.to_global_id.to_s, 'data-otu-radial' => 'true')
end

- (Object) otus_radial_disambiguate(object)



44
45
46
47
# File 'app/helpers/otus_helper.rb', line 44

def otus_radial_disambiguate(object)
  otu = object.metamorphosize
  (:div, '', 'data-taxon-name' => object_tag(otu), 'data-redirect' => 'false', 'data-taxon-id' => otu.id, 'data-otu-button' => 'true')
end

- (Object) otus_redirect(object)



39
40
41
42
# File 'app/helpers/otus_helper.rb', line 39

def otus_redirect(object)
  otu = object.metamorphosize
  (:div, '', 'data-taxon-name' => object_tag(otu), 'data-redirect' => 'true', 'data-taxon-id' => otu.id, 'data-otu-button' => 'true')
end

- (Object) otus_search_form



31
32
33
# File 'app/helpers/otus_helper.rb', line 31

def otus_search_form
  render('/otus/quick_search_form')
end