osu-cascades/ecotone-web

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

Summary

Maintainability
Test Coverage
- content_for_title(@user.name.titleize)
- content_for(:subnav) do
  .btn-public
    = link_to('« Users', users_path, class: 'button primary', title: 'List of all users', method: 'get')
  - if current_user&.admin?
    .btn-admin
      = link_to(content_tag(:i, '', :class => "icon-trash"), @user, method: :delete, data: { confirm: "Delete #{@user.name}?" }, class: 'btn-icon', title: "Delete #{@plant}")
.email.center.italic= @user.email

%section.small-table
  %table.table.list#reports
    %thead
      %tr
        %th{scope: 'col'} Report
        %th{scope: 'col'} Collection Date
    %tbody
      - @user.biodiversity_reports.order('measured_on DESC').each do |report|
        %tr{:onclick => "location.href='#{url_for(report)}'"}
          %td= report.to_s
          %td= report.datestamp