Module: OtusHelper

Defined in:
app/helpers/otus_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (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, [a,b].compact.join.html_safe, class: :otu_tag)
end


28
29
30
# File 'app/helpers/otus_helper.rb', line 28

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

- (Object) otus_radial(object)



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

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

- (Object) otus_radial_disambiguate(object)



37
38
39
40
# File 'app/helpers/otus_helper.rb', line 37

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)



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

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



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

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