4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'app/controllers/catalog/index_controller.rb', line 4
def show
super
@current_path = index_catalog_path
@subfamilies = ::Subfamily.ordered_by_name
@url_parameters = {:q => params[:q], :search_type => params[:search_type], :hide_tribes => params[:hide_tribes]}
setup_formicidae and return if @search_results.blank? && params[:id].blank?
if params[:id] =~ /^no_/
@taxon = params[:id]
else
@taxon = Taxon.find params[:id]
@taxonomic_history = @taxon.taxonomic_history
end
case @taxon
when 'no_subfamily', Subfamily
@selected_subfamily = @taxon
if @selected_subfamily == 'no_subfamily'
setup_formicidae
@genera = Genus.without_subfamily
elsif params[:hide_tribes]
@genera = @selected_subfamily.genera
else
@tribes = @selected_subfamily.tribes
end
when 'no_tribe', Tribe
@selected_tribe = @taxon
if params[:hide_tribes] && @selected_tribe == 'no_tribe'
@taxon = ::Subfamily.find params[:subfamily]
@selected_subfamily = @taxon
@genera = @selected_subfamily.genera
elsif params[:hide_tribes]
@taxon = @selected_tribe.subfamily
@selected_subfamily = @taxon
@genera = @selected_subfamily.genera
elsif @selected_tribe == 'no_tribe'
@selected_subfamily = ::Subfamily.find params[:subfamily]
@tribes = @selected_subfamily.tribes
@genera = @selected_subfamily.genera.without_tribe
else
@tribes = @selected_tribe.siblings
@genera = @selected_tribe.genera
@selected_subfamily = @selected_tribe.subfamily
end
when Genus
@selected_genus = @taxon
select_subfamily_and_tribes
select_genera
@species = @selected_genus.species
when Species
@selected_species = @taxon
@selected_genus = @selected_species.genus
@species = @selected_species.siblings
select_subfamily_and_tribes
select_genera
end
@url_parameters[:subfamily] = @selected_subfamily
@taxon_header_name ||= @taxon.full_label if @taxon.kind_of? Taxon
@taxon_statistics ||= @taxon.statistics if @taxon.kind_of? Taxon
end
|