views/taxon.haml
- if @taxon
%article.taxon
%header.taxon__header
%h1
%a{ href: eol_page_url(@taxon) }
= "%s %s" % [ @taxon.rank, @taxon.name ]
%dl.nomenclature
- unless @taxon.english_vernacular_name.to_s.empty?
%dt.nomenclature__label--common-name English common name
%dd.nomenclature__datum--common-name
%a{ href: eol_page_url(@taxon) }= @taxon.english_vernacular_name
- unless @taxon.classification_summary.empty?
%dt.nomenclature__label--classification Classification
%dd.nomenclature__datum--classification
= @taxon.classification_summary.map{ |t| "<a href='#{taxon_path(t)}'>#{t.name}</a>" }.join(" > ")
- unless @taxon.source.to_s.empty?
%dt.nomenclature__label--reference Ref:
%dd.nomenclature__datum--reference
%a{ href: '/about' }= @taxon.source
%section.taxon__information
%header.information__header
%h2 Taxonomic information
- if @taxon.image
- attribution = image_attribution(@taxon.image).to_s
- license_html = license(@taxon.image[:license]).to_s
%figure.information__media
%a{ href: eol_dato_url(@taxon)}
%img{ src: @taxon.image[:eolThumbnailURL], alt: "Image of #{@taxon.name}" }
- unless (attribution.empty? && license_html.empty?)
%figcaption
- if @taxon.image[:title] && ! @taxon.image[:title].empty?
%p= @taxon.image[:title]
- unless attribution.empty?
%p= attribution
= license_html
%section.taxon__assessment
%header.assessment__header
%h2 Assessment
- if @taxon.family?
%table.assessment__measurements
%caption.measurements__caption= "Assessment of knowledge about #{@taxon.name}"
%thead
%tr
%th.measurement__label--source{ scope: 'col' } Source
%th.measurement__label--value{ scope: 'col' } Count
%th.measurement__label--score{ scope: 'col' } % score
%tbody
- Ggi::ClassificationImporter::MEASUREMENT_URIS_TO_LABELS.each do |uri, label|
- measurement = @taxon.measurements.select{|m| m[:measurementType] == uri}.first rescue nil
- score = measurement.nil? ? 0 : formatted_score(measurement[:score])
%tr{ class: "assessment__measurement--#{score_qualifier(score)}" }
%th.measurement__datum--source{ scope: 'row' }= measurement_source[uri]
%td.measurement__datum--value
= measurement.nil? ? 0 : measurement[:measurementValue]
%td.measurement__datum--score= score
- taxon_score_formatted = formatted_score(@taxon.score)
%tr{ class: "assessment__measurement--#{score_qualifier(taxon_score_formatted)}" }
%th.measurement__datum--source{ scope: 'row' }
%span
= @taxon.family? ? 'GGI score' : 'GGI score:'
%a.info{ title: 'Explanation of score', href: '/help' } ?
%td.measurement__datum--value
%td.measurement__datum--score= taxon_score_formatted
- else
.assessment_summary
%dl
- taxon_score_formatted = formatted_score(@taxon.score)
%dt.assessment_summary__label--score{ class: "assessment_summary__label--#{score_qualifier(taxon_score_formatted)}" }
%span
= @taxon.family? ? 'GGI score' : 'GGI score:'
%a.info{ title: 'Explanation of score', href: '/help' } ?
%dd.assessment_summary__datum--score{ class: "assessment_summary__label--#{score_qualifier(taxon_score_formatted)}" }
%span= taxon_score_formatted
- unless @taxon.family?
%dt.assessment_summary__label--family_count
%span Number of families:
%dd.assessment_summary__datum--family_count
%span= @taxon.number_of_families
%p For a more detailed assessment of knowledge, choose a family.
- else
%p Taxon information is missing