osu-cascades/ecotone-web

View on GitHub
app/views/biodiversity_reports/show.html.haml

Summary

Maintainability
Test Coverage
- content_for_title("Biodiversity Report ##{@biodiversity_report.id}")
- content_for(:subnav) do
  .btn-public
    = link_to('« Reports', biodiversity_reports_path, class: 'button primary', method: 'get')
  - if @biodiversity_report.editable_by?(current_user)
    .btn-admin
      = link_to(content_tag(:i, '', :class => "icon-edit"), edit_biodiversity_report_path(@biodiversity_report), class: 'btn-icon')
      - if current_user&.admin?
        = link_to(content_tag(:i, '', :class => "icon-trash"), @biodiversity_report, method: :delete, data: { confirm: "Delete Biodiversity Report #{@biodiversity_report.id}?" }, class: 'btn-icon')
.content
  = render 'layouts/image_carousel', entity: @biodiversity_report
  .info
    %h2.heading#table-heading Information
    %table.table#vertical-table
      %thead
        %th.citation.italic{colspan: '2'}= last_updated(@biodiversity_report)
      %tbody
        %tr
          %th{scope: 'row'} Collection Date
          %td= @biodiversity_report.datestamp
        %tr
          %th{scope: 'row'} Author
          %td= link_to(@biodiversity_report.author)
        %tr
          %th{scope: 'row'} Plot
          %td= link_to(@biodiversity_report.plot)
        %tr
          %th{scope: 'row'} Temperature
          %td= @biodiversity_report.temperature
        %tr
          %th{scope: 'row'} Species Richness
          %td= @biodiversity_report.species_richness
        %tr
          %th{scope: 'row'} Diversity Index
          %td= @biodiversity_report.diversity_index
        %tr
          %th{scope: 'row'} Species Evenness
          %td= @biodiversity_report.species_evenness
        %tr
          %th{scope: 'row'} Biomass Estimate
          %td= @biodiversity_report.biomass_estimate

- if @biodiversity_reports
  .space
  %h2.center Past Biodiversity Report Data       
  .info
    %section
      %table.table.list
        %thead
          %tr
            %th{scope: 'col'} Plot
            %th{scope: 'col'} Measured On
            %th{scope: 'col'} Temperature
            %th{scope: 'col'} Species Richness
            %th{scope: 'col'} Diversity Index
        %tbody
          - @biodiversity_reports.each do |report| 
            -if report.plot_id == @biodiversity_report.plot_id && report.id != @biodiversity_report.id && report.measured_on <= @biodiversity_report.measured_on
              %tr{:onclick => "location.href='#{url_for(report)}'"}
                %td= report.plot
                %td= report.measured_on.to_formatted_s(:long)
                %td= report.temperature
                %td= report.species_richness
                %td= report.diversity_index