Growstuff/growstuff

View on GitHub
app/views/crops/_info.haml

Summary

Maintainability
Test Coverage
.row.crop-info
  .col-md-9
    %h1
      = crop_icon(@crop)
      %strong.crop-name= @crop.name.titleize
      - unless @crop.approved?
        %badge.badge-warning=@crop.approval_status
      %small.text-muted= @crop.default_scientific_name
    - if @crop.sowing_method.present?
      %p
        %strong How to sow #{@crop.name}:
        = @crop.sowing_method
    - if @crop.sun_requirements.present?
      %p
        %strong Sun requirement for #{@crop}:
        Plant in #{@crop.sun_requirements}
    %p.text-muted
      - if !@crop.plantings.empty?
        #{@crop.name.titleize} has been planted
        = pluralize(@crop.plantings.size, "time")
        by #{ENV['GROWSTUFF_SITE_NAME']} members.
      - else
        Nobody is growing this yet. You could be the first!
    - if @crop.description.present?
      %p= simple_format @crop.description
  .col-md-3
    = image_tag crop_image_path(@crop),
      class: 'img-responsive shadow rounded crop-hero-photo', alt: "Image of #{@crop.name}"