Growstuff/growstuff

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

Summary

Maintainability
Test Coverage
- content_for :title, "#{ENV['GROWSTUFF_SITE_NAME']} community near #{@place}"
- content_for :opengraph do
  = tag("meta", property: "og:title", content: "#{ENV['GROWSTUFF_SITE_NAME']} community near #{@place}")
  = tag("meta", property: "og:type", content: "website")
  = tag("meta", property: "og:url", content: request.original_url)
  = tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])


%h1 #{ENV['GROWSTUFF_SITE_NAME']} community near #{@place}
= render partial: 'search_form'

%section.map#placesmap{ style: "height:300px" }

%section.members
  %h2#members= "Nearby members"

  - if @nearby_members.any?
    .index-cards.members
      - @nearby_members.first(30).each do |member|
        = render partial: "members/thumbnail", locals: { member: member }
  - else
    %p No nearby members
  = link_to "View all members >>", members_path

%section.seeds
  %h2#seeds Seeds available for trade near #{@place}
  - crop_id = []
  - @nearby_members.first(10).each do |member|
    - member.seeds.first(5).each do |seed|
      - crop_id.push seed.crop.id
  - if crop_id.present?
    .index-cards.crops
      - crop_id.uniq.first(20).each do |crop|
        = render partial: "crops/thumbnail", locals: { crop: Crop.find(crop) }
  - else
    %p No nearby seeds found
  = link_to "View all seeds >>", seeds_path

%section#plantings
  %h2 Recent plantings near #{@place}

  - plantings = []
  - @nearby_members.first(10).each do |member|
    - member.plantings.first(5).each do |planting|
      - plantings << planting
  - if plantings.any?
    .index-cards.plantings
      - plantings.first(10).each.with_index do |planting, index|
        = render partial: "plantings/card", locals: { planting: planting, index: index }
  - else
    %p No nearby plantings found
  = link_to "View all plantings >>", plantings_path