Growstuff/growstuff

View on GitHub
app/views/harvests/index.html.haml

Summary

Maintainability
Test Coverage
- content_for(:title) do
  = title('harvests', @owner, @crop, @planting)
- content_for :breadcrumbs do
  - if @owner
    %li.breadcrumb-item= link_to 'Harvests', harvests_path
    %li.breadcrumb-item.active= link_to "#{@owner}'s harvests", harvests_path(owner: @owner)
  - else
    %li.breadcrumb-item.active= link_to "Harvests", harvests_path
.row
  .col-md-2
    %h1
      = harvest_icon
      = title('harvests', @owner, @crop, @planting)
    = render 'layouts/nav', model: Harvest
    %hr/
    - if @owner
      = render @owner
    %section.open-data
      %h2 Open Data
      %p= t('label.data')
      - ['csv', 'json', 'rss'].each do |format|
        .badge.badge-info
          = link_to (@owner ? member_harvests_path(@owner, format: format) : harvests_path(format: format)) do
            = icon 'fas', format.to_s
            = format.upcase
      .badge.badge-success= link_to 'API Methods', '/api-docs'
  .col-md-10
    %section
      %h2= title('harvests', @owner, @crop, @planting)
      = will_paginate @harvests
      - if @harvests.blank?
        %p No harvests recorded yet
      .index-cards
        - @harvests.each do |h|
          = render 'harvests/card', harvest: h
      = will_paginate @harvests