Module: CatalogHelper

Defined in:
app/helpers/catalog_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) format_statistics(statistics, include_invalid = true)



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

def format_statistics statistics, include_invalid = true
  Formatters::CatalogFormatter.format_statistics statistics, :include_invalid => include_invalid
end


18
19
20
21
# File 'app/helpers/catalog_helper.rb', line 18

def hide_link name, selected, url_parameters
  hide_param = "hide_#{name}".to_sym
  link_to 'hide', index_catalog_path(selected, url_parameters.merge(hide_param => true)), :class => :hide
end

- (Object) make_catalog_search_results_columns(items)



52
53
54
55
# File 'app/helpers/catalog_helper.rb', line 52

def make_catalog_search_results_columns items
  column_count = 3
  items.snake column_count
end

- (Object) search_selector(current_search_type)



57
58
59
60
# File 'app/helpers/catalog_helper.rb', line 57

def search_selector current_search_type
  select_tag :search_type,
    options_for_select(['matching', 'beginning with', 'containing'], current_search_type || 'beginning with')
end


23
24
25
26
27
# File 'app/helpers/catalog_helper.rb', line 23

def show_child_link params, name, selected, url_parameters
  hide_child_param = "hide_#{name}".to_sym
  return unless params[hide_child_param]
  link_to "show #{name}", index_catalog_path(selected, url_parameters.merge(hide_child_param => nil))
end

- (Object) snake_taxon_columns(items)



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/helpers/catalog_helper.rb', line 37

def snake_taxon_columns items
  column_count = items.count / 26.0
  css_class = 'taxon_item'
  if column_count < 1
    column_count = 1
  else
    column_count = column_count.ceil
  end
  if column_count >= 4
    column_count = 4
    css_class << ' teensy'
  end
  return items.snake(column_count), css_class
end

- (Object) status_labels



29
30
31
# File 'app/helpers/catalog_helper.rb', line 29

def status_labels
  Formatters::CatalogFormatter.status_labels
end


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

def taxon_link taxon, selected, url_parameters
  if taxon =~ /^no_/
    classes = 'valid'
    classes << ' selected' if taxon == selected
    link_to "(#{taxon.gsub(/_/, ' ')})", index_catalog_path(taxon, url_parameters), :class => classes
  else
    label_and_classes = Formatters::CatalogFormatter.taxon_label_and_css_classes taxon, :selected => taxon == selected
    link_to label_and_classes[:label], index_catalog_path(taxon, url_parameters), :class => label_and_classes[:css_classes]
  end
end

- (Object) taxonomic_history(taxon)



62
63
64
# File 'app/helpers/catalog_helper.rb', line 62

def taxonomic_history taxon
  Formatters::CatalogFormatter.format_taxonomic_history taxon
end