Growstuff/growstuff

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

Summary

Maintainability
Test Coverage
- content_for :title do
  = ENV['GROWSTUFF_SITE_NAME']

- if member_signed_in?
  .row
    .col-lg-8.col-md-12
      %h1.display-4= t('.welcome', site_name: ENV['GROWSTUFF_SITE_NAME'], member_name: current_member)

      %p= render 'stats', cached: true
    .col
      %p
        - if current_member.plantings.active.any?
          = link_to member_path(current_member, anchor: "#content"), class: 'btn btn-dark' do
            = planting_icon
            Track my plantings
      %p
        = link_to member_gardens_path(current_member), class: 'btn btn-dark' do
          = garden_icon
          Show me my garden
- else
  .hidden-xs
    %section.jumbotron= render 'blurb', cached: true
.row
  .col-xl-9.col-12
    %section.crops
      %h2= t('home.crops.our_crops')
      = render 'crops'
      = link_to "#{t('home.crops.view_all')} »", crops_path, class: 'btn btn-block'
  .col-xl-3.col-12
    %section.recent-crops.card
      - cache cache_key_for(Crop, 'recent') do
        %h2= t('.recently_added')
        %p.card-body
          != CropSearchService.recent(30).map { |c| link_to(c['name'], crop_path(slug: c['slug'])) }.join(", ")
  .col-xl-4.col
    %section.plantings
      = cute_icon
      =render 'plantings'
      %p.text-right= link_to "#{t('home.plantings.view_all')} »", plantings_path, class: 'btn btn-block'
  .col-xl-4.col
    %section.harvests
      = cute_icon
      = render 'harvests'
      %p.text-right= link_to "#{t('home.harvests.view_all')} »", harvests_path, class: 'btn btn-block'
  .col-xl-4.col
    %section.activities
      = cute_icon
      = render 'activities'
      %p.text-right= link_to "#{t('home.activities.view_all')} »", activities_path, class: 'btn btn-block'
  .col-12.col-md-6
    %section.seeds
      = cute_icon
      = render 'seeds'
      %p.text-right= link_to "#{t('home.seeds.view_all')} »", seeds_path, class: 'btn btn-block'
  .col-12.col-lg-6
    %section.discussion.text-center
      = cute_icon
      = render 'discuss', cached: true
  .col-12.col-lg-6
    %section.members
      = cute_icon
      = render 'members', cached: true