osu-cascades/ecotone-web

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

Summary

Maintainability
Test Coverage
- content_for_title("Tree Sample ##{@tree_sample.id}")
- content_for(:subnav) do
  .btn-public
    = link_to('« Samples', tree_samples_path, class: 'button primary', method: 'get')
  - if @tree_sample.editable_by?(current_user)
    .btn-admin
      = link_to(content_tag(:i, '', :class => "icon-edit"), edit_tree_sample_path(@tree_sample), class: 'btn-icon')
      - if current_user&.admin?
        = link_to(content_tag(:i, '', :class => "icon-trash"), @tree_sample, method: :delete, data: { confirm: "Delete tree sample #{@tree_sample.id}?" }, class: 'btn-icon')
.content
  = render 'layouts/image_carousel', entity: @tree_sample
  .info
    %h2.heading#table-heading Information
    %table.table#vertical-table
      %thead
        %th.citation.italic{colspan: '2'}= last_updated(@tree_sample)
      %tbody
        %tr
          %th{scope: 'row'} Collection Date
          %td= @tree_sample.datestamp
        %tr
          %th{scope: 'row'} Plot
          %td= link_to("#{@tree_sample.plot}", @tree_sample.plot)
        %tr
          %th{scope: 'row'} Species
          %td= link_to("#{@tree_sample.plant.common_name.titleize}", @tree_sample.plant)
        %tr
          %th{scope: 'row'} Tag Number
          %td= @tree_sample.tag_number
        %tr
          %th{scope: 'row'} Growth Stage
          %td= @tree_sample.growth_stage.capitalize
        %tr
          %th{scope: 'row'} DBH
          %td= "#{@tree_sample.dbh} cm"
        %tr
          %th{scope: 'row'} Lower Canopy Height
          %td= "#{@tree_sample.lower_canopy_height} m"
        %tr
          %th{scope: 'row'} Upper Canopy Height
          %td= "#{@tree_sample.upper_canopy_height} m"
        %tr
          %th{scope: 'row'} Latitude N
          %td= "#{@tree_sample.latitude}°"
        %tr
          %th{scope: 'row'} Longitude W
          %td= "#{@tree_sample.longitude}°"