<commit_before>=content_for :title, "#{@garden.owner}'s #{@garden}"

.row
  .col-md-9

    - if can? :edit, @garden or can? :delete, @garden
      %p.btn-group
        - if can? :edit, @garden
          - if @garden.active
            = link_to "Plant something", new_planting_path(:garden_id => @garden.id), :class => 'btn btn-primary'
            = link_to "Mark as inactive", garden_path(@garden, :garden => {:active => 0}), |
              :method => :put, :class => 'btn btn-default', |
              data: { confirm: 'All plantings associated with this garden will be marked as finished. Are you sure?' }
          - else
            = link_to "Mark as active", garden_path(@garden, :garden => {:active => 1}),  :method => :put, :class => 'btn btn-default'
          = link_to 'Edit garden', edit_garden_path(@garden), :class => 'btn btn-default'
        - if can? :destroy, @garden
          = link_to 'Delete garden', @garden, method: :delete, |
            data: { confirm: 'All plantings associated with this garden will also be deleted. Are you sure?' }, :class => 'btn btn-default'

    - if ! @garden.active
      .alert.alert-warning
        This garden is inactive.
        - if can? :edit, @garden
          = link_to 'Set it to active', edit_garden_path(@garden)
          to plant something in this garden.

    %div
      :growstuff_markdown
        #{strip_tags @garden.description}

    - if @garden.photos.size > 0 or (can? :edit, @garden and can? :create, Photo)
      .row
        %h2 Photos

        %ul.thumbnails
          - @garden.photos.each do |p|
            .col-md-2.six-across
              = render :partial => 'photos/thumbnail', :locals => { :photo => p }
          - if can? :create, Photo and can? :edit, @garden
            .col-md-2
              .thumbnail(style='height: 220px')
                %p{:style => 'text-align: center; padding-top: 50px'}
                  = link_to "Add photo", new_photo_path(:type => "garden", :id => @garden.id), :class => 'btn btn-primary'

    %h3 What's planted here?
    - if @garden.plantings.current.size > 0
      .row
        - @garden.plantings.current.each.with_index do |planting_current, index_current|
          = render partial: "plantings/thumbnail", locals: {:planting => planting_current}
    - else
      %p
        Nothing is currently planted here.

    %h3 Previously planted in this garden
    - if @garden.plantings.finished.size > 0
      .row
        - @garden.plantings.finished.each.with_index do |planting_finished|
          = render partial: "plantings/thumbnail", locals: {:planting => planting_finished}
      
  .col-md-3
    %h4 About this garden
    %p
      %strong Owner:
      = link_to @garden.owner, @garden.owner
    - if ! @garden.location.blank?
      %p
        %strong Location:
        = @garden.location
    - if ! @garden.area.blank?
      %p
        %strong Area:
        = pluralize(@garden.area, @garden.area_unit)

    %h4= "#{@garden.owner}'s gardens"
    %ul
      - @garden.owner.gardens.active.each do |othergarden|
        %li<commit_msg>Fix #818 and layout of show garden page<commit_after>=content_for :title, "#{@garden.owner}'s #{@garden}"

.row
  .col-md-9
    - if can? :edit, @garden or can? :delete, @garden
      %p.btn-group
        - if can? :edit, @garden
          - if @garden.active
            = link_to "Plant something", new_planting_path(:garden_id => @garden.id), :class => 'btn btn-primary'
            = link_to "Mark as inactive", garden_path(@garden, :garden => {:active => 0}), |
              :method => :put, :class => 'btn btn-default', |
              data: { confirm: 'All plantings associated with this garden will be marked as finished. Are you sure?' }
          - else
            = link_to "Mark as active", garden_path(@garden, :garden => {:active => 1}),  :method => :put, :class => 'btn btn-default'
          = link_to 'Edit garden', edit_garden_path(@garden), :class => 'btn btn-default'
        - if can? :destroy, @garden
          = link_to 'Delete garden', @garden, method: :delete, |
            data: { confirm: 'All plantings associated with this garden will also be deleted. Are you sure?' }, :class => 'btn btn-default'

    - if ! @garden.active
      .alert.alert-warning
        This garden is inactive.
        - if can? :edit, @garden
          = link_to 'Set it to active', edit_garden_path(@garden)
          to plant something in this garden.

    %div
      :growstuff_markdown
        #{strip_tags @garden.description}
      - unless @garden.description
        .row-fluid
          %p No description available yet.

          - if can? :edit, @garden
            %p 
              Why not 
              = link_to 'tell us more.', edit_garden_path(@garden)

    - if @garden.photos.size > 0 or (can? :edit, @garden and can? :create, Photo)
      .row-fluid
        %h3 Photos
        %p= pluralize(@garden.photos.length, "photo")
        .row-fluid
          %ul.thumbnails
            - @garden.photos.each do |p|
              .col-md-2.six-across
                = render :partial => 'photos/thumbnail', :locals => { :photo => p }
        .row-fluid
          - if can? :create, Photo and can? :edit, @garden
            %p
              = link_to "Add photo", new_photo_path(:type => "garden", :id => @garden.id), :class => 'btn btn-primary'

    .row-fluid
      %h3 What's planted here?
      - if @garden.plantings.current.size > 0
        - @garden.plantings.current.each.with_index do |planting_current, index_current|
          = render partial: "plantings/thumbnail", locals: {:planting => planting_current}
      - else
        %p
          Nothing is currently planted here.

    .row-fluid
      %h3 Previously planted in this garden
      - if @garden.plantings.finished.size > 0
        - @garden.plantings.finished.each.with_index do |planting_finished|
          = render partial: "plantings/thumbnail", locals: {:planting => planting_finished}
      
  .col-md-3
    %h4 About this garden
    %p
      %strong Owner:
      = link_to @garden.owner, @garden.owner
    - if ! @garden.location.blank?
      %p
        %strong Location:
        = @garden.location
    - if ! @garden.area.blank?
      %p
        %strong Area:
        = pluralize(@garden.area, @garden.area_unit)

    %h4= "#{@garden.owner}'s gardens"
    %ul
      - @garden.owner.gardens.active.each do |othergarden|
        %li
{'fraction_non_alphanumeric': 0.13511402686660418, 'fraction_numerical': 0.005467041549515776, 'mean_word_length': 2.1402648357037766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5877790', 'n_tokens_mistral': 2096, 'n_tokens_neox': 2016, 'n_words': 546}