%h2 = icon 'fas', 'magic' Predictions .index-cards.facts - unless crop.perennial.nil? .card.fact-card .card-body.text-center %h3 = link_to 'https://en.wikipedia.org/wiki/Annual_vs._perennial_plant_evolution', class: 'crop-longevity' do - if crop.perennial? Perennial - elsif crop.annual? Annual %strong.crop-longevity %i.far.fa-calendar - if crop.perennial == true %small living more than two years - elsif crop.perennial == false %small living and reproducing in a single year or less - if can? :wrangle, @crop %small.edit-link = bootstrap_form_for(@crop) do |f| = f.hidden_field :perennial, value: crop.annual? = f.submit :toggle - if crop.annual? && crop.median_lifespan.present? .card.fact-card .card-body.text-center %h3 Median lifespan %strong= in_weeks(crop.median_lifespan) %i.fas.fa-sun-o.fa-5x.pt-3.amber-text %span #{'week'.pluralize(in_weeks(crop.median_lifespan))} - if crop.median_days_to_first_harvest.present? = render 'layouts/fact_card', title: 'First harvest expected', value: in_weeks(crop.median_days_to_first_harvest), description: "#{'week'.pluralize(in_weeks(crop.median_days_to_first_harvest))} after planting" - if crop.annual? && crop.median_days_to_last_harvest.present? = render 'layouts/fact_card', title: "Last harvest expected", value: in_weeks(crop.median_days_to_last_harvest), description: "#{'week'.pluralize(in_weeks(crop.median_days_to_last_harvest))} after planting" - if crop.height.present? = render 'layouts/fact_card', title: 'Height', value: "#{crop.height}cm", description: nil - if crop.spread.present? = render 'layouts/fact_card', title: 'Spread', value: "#{crop.spread}cm", description: nil - if crop.row_spacing.present? = render 'layouts/fact_card', title: 'Row Spacing', value: "#{crop.row_spacing}cm", description: nil - if crop.growing_degree_days.present? = render 'layouts/fact_card', title: 'Growing Degree Days', value: crop.growing_degree_days, description: nil - if member_signed_in? && (!crop.height.present? || !crop.spread.present? || !crop.row_spacing.present? || !crop.growing_degree_days.present?) .card.fact-card .card-body.text-center %p= link_to "Add more attributes.", edit_crop_path(@crop, anchor: ":~:text=Data")