Module: Otus::CatalogHelper

Defined in:
app/helpers/otus/catalog_helper.rb

Instance Method Summary collapse

Instance Method Details

#history_otu(otu, r, c, target = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/otus/catalog_helper.rb', line 22

def history_otu(otu, r, c, target = nil)
  name = otu_tag(otu)
  body = nil
  css = nil
  soft_validation = nil

  if target
    body = link_to(name, browse_taxa_task_path(otu_id: otu.id) )
  else
    body = name 
  end

  if otu == r
    css = 'history__reference_otu'
  else
    css = 'history__related_otu' 
    soft_validation = soft_validation_alert_tag(otu)
  end

  (:span, body + soft_validation.to_s, class: [css, original_citation_css(otu, c), :history__otu ]) 
end

#otu_catalog_entry_item_tag(catalog_entry_item) ⇒ Object



3
4
5
# File 'app/helpers/otus/catalog_helper.rb', line 3

def otu_catalog_entry_item_tag(catalog_entry_item)
  otu_catalog_line_tag(catalog_entry_item, catalog_entry_item.base_object) # base object might be wrong!! (reference_otu from entry instead)
end

#otu_catalog_line_tag(otu_catalog_entry_item, reference_otu) ⇒ Object

target = :browse_nomenclature_task_path



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/otus/catalog_helper.rb', line 7

def otu_catalog_line_tag(otu_catalog_entry_item, reference_otu) # target = :browse_nomenclature_task_path 
  i = otu_catalog_entry_item
  t = i.base_object
  c = i.citation
  r = reference_otu

  [ history_otu(t, r, c),        # the subject, or protonym
    history_in(c&.source),       # citation for related name
    history_pages(c),           # pages for citation of related name
    history_citation_notes(c), # Notes on the citation
    history_topics(c)           # Topics on the citation
  ].compact.join.html_safe

end