mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-24 16:58:35 -04:00
Remove table display on plantings#show, replace with boxes
This commit is contained in:
@@ -38,12 +38,13 @@ h3
|
||||
max-width: 100%
|
||||
height: auto
|
||||
|
||||
.avatar
|
||||
border-radius: 50%
|
||||
z-index: 2
|
||||
position: relative
|
||||
|
||||
.profile-sidebar
|
||||
margin-top: -5rem
|
||||
.avatar
|
||||
border-radius: 50%
|
||||
z-index: 2
|
||||
position: relative
|
||||
|
||||
.profile-activity
|
||||
background: white
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
font-size: 150%
|
||||
top: -0.5em
|
||||
.planting-quick-actions
|
||||
position: absolute
|
||||
position: absolute
|
||||
left: 142px
|
||||
top: 6px
|
||||
.planting-thumbnail-photo
|
||||
@@ -36,3 +36,19 @@
|
||||
text-align: left
|
||||
dd
|
||||
margin-left: auto
|
||||
|
||||
.fact
|
||||
text-align: center
|
||||
height: 180px
|
||||
border: 1px solid lighten($green, 20%)
|
||||
border-radius: 30%
|
||||
background: $white
|
||||
margin: 1em
|
||||
strong
|
||||
font-size: 3em
|
||||
font-align: center
|
||||
h3
|
||||
span
|
||||
display: block
|
||||
img
|
||||
height: 50%
|
||||
|
||||
@@ -14,6 +14,9 @@ class PhotosController < ApplicationController
|
||||
if params[:crop_slug]
|
||||
@crop = Crop.find params[:crop_slug]
|
||||
@photos = Photo.by_crop(@crop)
|
||||
elsif params[:planting_id]
|
||||
@planting = Planting.find params[:planting_id]
|
||||
@photos = @planting.photos
|
||||
else
|
||||
@photos = Photo.all
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ class PlantingsController < ApplicationController
|
||||
|
||||
@plantings = @plantings.joins(:owner, :crop, :garden)
|
||||
.order(created_at: :desc)
|
||||
.includes(:crop, :owner, :garden)
|
||||
.includes(:owner, :garden, crop: :parent)
|
||||
.paginate(page: params[:page])
|
||||
|
||||
@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_s(:number)}.csv"
|
||||
|
||||
@@ -10,9 +10,11 @@ class SeedsController < ApplicationController
|
||||
def index
|
||||
@owner = Member.find_by(slug: params[:member_slug]) if params[:member_slug].present?
|
||||
@crop = Crop.find_by(slug: params[:crop_slug]) if params[:crop_slug].present?
|
||||
@planting = Planting.find_by(slug: params[:planting_id]) if params[:planting_id].present?
|
||||
|
||||
@seeds = @seeds.where(owner: @owner) if @owner.present?
|
||||
@seeds = @seeds.where(crop: @crop) if @crop.present?
|
||||
@seeds = @seeds.where(parent_planting: @planting) if @planting.present?
|
||||
@seeds = @seeds.order(created_at: :desc).includes(:owner, :crop).paginate(page: params[:page])
|
||||
|
||||
@filename = csv_filename
|
||||
|
||||
@@ -31,4 +31,12 @@ module IconsHelper
|
||||
def photo_icon
|
||||
icon('fas', 'camera-retro')
|
||||
end
|
||||
|
||||
def planted_from_icon(planted_from)
|
||||
planted_from
|
||||
end
|
||||
|
||||
def sunniness_icon(sunniness)
|
||||
image_tag("sunniness_#{sunniness}.png", class: 'img')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,6 +45,13 @@ module PlantingsHelper
|
||||
(planting.first_harvest_predicted_at - Time.zone.today).to_i
|
||||
end
|
||||
|
||||
def days_from_now_to_last_harvest(planting)
|
||||
return unless planting.planted_at.present? && planting.last_harvest_predicted_at.present?
|
||||
|
||||
(planting.last_harvest_predicted_at - Time.zone.today).to_i
|
||||
end
|
||||
|
||||
|
||||
def planting_classes(planting)
|
||||
classes = []
|
||||
classes << 'planting-growing' if planting.growing?
|
||||
|
||||
@@ -35,7 +35,7 @@ class Harvest < ApplicationRecord
|
||||
## Relationships
|
||||
belongs_to :crop
|
||||
belongs_to :plant_part
|
||||
belongs_to :planting, optional: true
|
||||
belongs_to :planting, optional: true, counter_cache: true
|
||||
|
||||
##
|
||||
## Scopes
|
||||
|
||||
@@ -39,9 +39,16 @@
|
||||
.col-md-6
|
||||
= render partial: "crops/index_card", locals: { crop: @harvest.crop }
|
||||
|
||||
%h2 Notes
|
||||
- if @harvest.description.present?
|
||||
%h2 Notes
|
||||
:growstuff_markdown
|
||||
#{ @harvest.description != "" ? strip_tags(@harvest.description) : "No description given." }
|
||||
|
||||
:growstuff_markdown
|
||||
#{ @harvest.description != "" ? strip_tags(@harvest.description) : "No description given." }
|
||||
|
||||
= render 'photos/item_photos', item: @harvest, type: 'harvest', photos: @photos
|
||||
%hr/
|
||||
- if @harvest.photos.size.positive?
|
||||
.row
|
||||
.col-md-6= render @harvest.default_photo
|
||||
.col-md-6
|
||||
= link_to 'View all photos >>', planting_photos_path(@harvest), class: 'pull-right'
|
||||
- @harvest.photos.order(date_taken: :desc).limit(3).each do |photo|
|
||||
= render('photos/thumbnail', photo: photo)
|
||||
@@ -2,6 +2,6 @@
|
||||
- if can?(:edit, @photo) && can?(:destroy, @photo)
|
||||
%p
|
||||
- if can?(:edit, @photo)
|
||||
= edit_button(@photo)
|
||||
= edit_button(edit_photo_path(@photo))
|
||||
- if can?(:destroy, @photo)
|
||||
= delete_button(@photo)
|
||||
|
||||
1
app/views/photos/_photo.haml
Normal file
1
app/views/photos/_photo.haml
Normal file
@@ -0,0 +1 @@
|
||||
= image_tag(photo.fullsize_url, alt: photo.title, class: 'img img-responsive')
|
||||
@@ -1,15 +1,15 @@
|
||||
- content_for :title, "Photos"
|
||||
|
||||
- if @crop
|
||||
%h2= @crop.name
|
||||
|
||||
%p Most recent photos added to #{ENV['GROWSTUFF_SITE_NAME']}.
|
||||
- content_for :title do
|
||||
- if @crop
|
||||
Photos of #{@crop.name}
|
||||
- elsif @planting.present?
|
||||
Photos of #{@planting}
|
||||
- else
|
||||
Most recent photos added to #{ENV['GROWSTUFF_SITE_NAME']}.
|
||||
|
||||
.pagination
|
||||
= page_entries_info @photos
|
||||
= will_paginate @photos
|
||||
|
||||
|
||||
.row
|
||||
- @photos.each do |p|
|
||||
.col-md-2.six-across
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
.row
|
||||
.col-md-8
|
||||
%p= image_tag(@photo.fullsize_url, alt: @photo.title, class: 'img img-responsive')
|
||||
%p= render @photo
|
||||
|
||||
.col-md-4
|
||||
= render 'photos/actions', photo: @photo
|
||||
@@ -27,7 +27,7 @@
|
||||
%p= link_to "View on Flickr", @photo.link_url
|
||||
- if @photo.associations?
|
||||
= render "photo_associations", locals: { photo: @photo }
|
||||
|
||||
|
||||
- if @crops.size.positive?
|
||||
- @crops.each do |crop|
|
||||
= render 'crops/index_card', crop: crop
|
||||
|
||||
@@ -1,46 +1,47 @@
|
||||
.panel.panel-success.planting-thumbnail
|
||||
.panel-heading
|
||||
%h3.panel-title
|
||||
= link_to planting.crop.name, planting_path(planting)
|
||||
- if can? :edit, planting
|
||||
%a.pull-right{ href: edit_planting_path(planting), role: "button", id: "edit_garden_glyphicon" }
|
||||
%span.glyphicon.glyphicon-pencil{ title: "Edit" }
|
||||
.panel-body
|
||||
.row
|
||||
.col-xs-12.col-md-4
|
||||
= link_to image_tag(planting_image_path(planting),
|
||||
alt: planting.crop_id, class: 'img img-responsive'),
|
||||
planting
|
||||
.col-xs-12.col-md-8
|
||||
%dl.dl-horizontal.planting-attributes
|
||||
%dt Owner:
|
||||
%dd= link_to planting.owner.login_name, planting.owner
|
||||
%dt Garden:
|
||||
%dd= link_to planting.garden&.name, planting.garden
|
||||
%dt Planted on:
|
||||
%dd= planting.planted_at
|
||||
- if planting.quantity
|
||||
%dt Quantity:
|
||||
%dd= display_planting_quantity(planting)
|
||||
- if planting.finished?
|
||||
%dt Finished on:
|
||||
%dd= display_finished(planting)
|
||||
.card
|
||||
.panel.panel-success.planting-thumbnail
|
||||
.panel-heading
|
||||
%h3.panel-title
|
||||
= link_to planting.crop.name, planting_path(planting)
|
||||
- if can? :edit, planting
|
||||
%a.pull-right{ href: edit_planting_path(planting), role: "button", id: "edit_garden_glyphicon" }
|
||||
%span.glyphicon.glyphicon-pencil{ title: "Edit" }
|
||||
.panel-body
|
||||
.row
|
||||
.col-xs-12.col-md-4
|
||||
= link_to image_tag(planting_image_path(planting),
|
||||
alt: planting.crop_id, class: 'img img-responsive'),
|
||||
planting
|
||||
.col-xs-12.col-md-8
|
||||
%dl.dl-horizontal.planting-attributes
|
||||
%dt Owner:
|
||||
%dd= link_to planting.owner.login_name, planting.owner
|
||||
%dt Garden:
|
||||
%dd= link_to planting.garden&.name, planting.garden
|
||||
%dt Planted on:
|
||||
%dd= planting.planted_at
|
||||
- if planting.quantity
|
||||
%dt Quantity:
|
||||
%dd= display_planting_quantity(planting)
|
||||
- if planting.finished?
|
||||
%dt Finished on:
|
||||
%dd= display_finished(planting)
|
||||
|
||||
- unless planting.sunniness.blank?
|
||||
%dt Sun/shade?:
|
||||
%dd
|
||||
- sunniness = planting.sunniness.blank? ? "not specified" : planting.sunniness
|
||||
= image_tag("sunniness_#{sunniness}.png", size: "25x25", alt: sunniness, title: sunniness)
|
||||
= " (#{sunniness})"
|
||||
|
||||
- unless planting.planted_from.blank?
|
||||
%dt Planted from:
|
||||
%dd= display_planted_from(planting)
|
||||
- unless planting.sunniness.blank?
|
||||
%dt Sun/shade?:
|
||||
%dd
|
||||
- sunniness = planting.sunniness.blank? ? "not specified" : planting.sunniness
|
||||
= image_tag("sunniness_#{sunniness}.png", size: "25x25", alt: sunniness, title: sunniness)
|
||||
= " (#{sunniness})"
|
||||
|
||||
- unless planting.planted_from.blank?
|
||||
%dt Planted from:
|
||||
%dd= display_planted_from(planting)
|
||||
|
||||
%dt Finish expected:
|
||||
%dd= planting.finish_predicted_at if planting.finish_predicted_at.present?
|
||||
%p= render 'plantings/progress', planting: planting, show_explanation: true
|
||||
.row
|
||||
.col-md-12
|
||||
= render 'plantings/actions', planting: planting
|
||||
|
||||
%dt Finish expected:
|
||||
%dd= planting.finish_predicted_at if planting.finish_predicted_at.present?
|
||||
%p= render 'plantings/progress', planting: planting, show_explanation: true
|
||||
.row
|
||||
.col-md-12
|
||||
= render 'plantings/actions', planting: planting
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
%h2 Seeds saved from this planting
|
||||
- if planting.active? && can?(:create, Seed) && can?(:edit, planting)
|
||||
= link_to new_planting_seed_path(planting), class: 'btn btn-default' do
|
||||
%span.glyphicon.glyphicon-heart{ title: "Add photo" }
|
||||
Save seeds
|
||||
|
||||
- if planting.child_seeds.size.positive?
|
||||
.row
|
||||
@@ -8,7 +12,3 @@
|
||||
- else
|
||||
%p No seeds saved
|
||||
|
||||
- if planting.active? && can?(:create, Seed) && can?(:edit, planting)
|
||||
= link_to new_planting_seed_path(planting), class: 'btn btn-primary' do
|
||||
%span.glyphicon.glyphicon-heart{ title: "Add photo" }
|
||||
Save seeds
|
||||
|
||||
95
app/views/plantings/_facts.haml
Normal file
95
app/views/plantings/_facts.haml
Normal file
@@ -0,0 +1,95 @@
|
||||
.planting
|
||||
|
||||
- if planting.parent_seed
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Parent seed
|
||||
%strong
|
||||
= link_to @planting.parent_seed, seed_path(@planting.parent_seed)
|
||||
- if planting.finished
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Planted
|
||||
%strong=planting_icon
|
||||
%span= planting.planted_at.to_formatted_s(:short)
|
||||
|
||||
- if planting.planted_at.present? && ! planting.finished?
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Planted
|
||||
%strong #{planting.days_since_planted}
|
||||
%span days ago
|
||||
%span= planting.planted_at.to_formatted_s(:short)
|
||||
|
||||
- unless planting.finished?
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Growing
|
||||
%strong
|
||||
%i.fas.fa-seedling
|
||||
%span= planting.planted_at.to_formatted_s(:short)
|
||||
|
||||
- if planting.planted_from.present?
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Grown from
|
||||
%strong=planted_from_icon(planting.planted_from)
|
||||
- if planting.quantity.to_i.positive?
|
||||
%span #{pluralize((planting.quantity.to_i), planting.planted_from)}
|
||||
|
||||
- if planting.sunniness.present?
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Grown in
|
||||
%strong
|
||||
= link_to planting.garden do
|
||||
= sunniness_icon(planting.sunniness)
|
||||
%span= planting.sunniness
|
||||
|
||||
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3
|
||||
- if planting.finished?
|
||||
Harvests
|
||||
- else
|
||||
Harvesting
|
||||
%strong
|
||||
= link_to planting_harvests_path(planting) do
|
||||
= harvest_icon
|
||||
%span
|
||||
= planting.first_harvest_date&.to_formatted_s(:short) || planting&.first_harvest_predicted_at&.to_formatted_s(:short)
|
||||
%span #{planting.harvests.size} harvests
|
||||
|
||||
- if planting.crop.perennial
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Perennial
|
||||
%strong
|
||||
%i.fas.fa-tree
|
||||
- else
|
||||
- if !planting.finished? && planting.finish_is_predicatable?
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
- days = days_from_now_to_finished(planting)
|
||||
- if days.positive?
|
||||
%h3 Finishes
|
||||
%strong #{days}
|
||||
%span days to go
|
||||
- else
|
||||
%h3 Finish
|
||||
%strong #{days * -1}
|
||||
%span days ago
|
||||
%span= planting.finish_predicted_at&.to_formatted_s(:short)
|
||||
|
||||
- if planting.child_seeds.size.positive?
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Seeds saved
|
||||
%strong
|
||||
= link_to planting_seeds_path(planting) do
|
||||
= seed_icon
|
||||
%span=planting.child_seeds&.first&.created_at&.to_date&.to_formatted_s(:short)
|
||||
%span #{pluralize(planting.child_seeds.size, 'packet')} of seed
|
||||
|
||||
|
||||
- if planting.finished?
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h3 Finished
|
||||
%strong=finished_icon
|
||||
%span=planting.finished_at&.to_formatted_s(:short)
|
||||
|
||||
- elsif planting.percentage_grown
|
||||
.fact.col-lg-2.col-md-3.col-sm-6.col-xs-12
|
||||
%h2 Progress
|
||||
%strong #{sprintf '%.0f', planting.percentage_grown}%
|
||||
@@ -1,4 +1,8 @@
|
||||
%h2 Harvests
|
||||
%h2 Harvests from this planting
|
||||
- if planting.active? && can?(:edit, planting)
|
||||
= link_to new_planting_harvest_path(planting), class: 'btn btn-default' do
|
||||
%span.glyphicon.glyphicon-leaf{ title: "Harvest" }
|
||||
Add Harvest
|
||||
- if planting.harvests.empty?
|
||||
%p No harvests
|
||||
- else
|
||||
@@ -7,7 +11,3 @@
|
||||
.col-xs-6.col-sm-4.col-md-3
|
||||
= render 'harvests/thumbnail', harvest: harvest
|
||||
|
||||
- if planting.active? && can?(:edit, planting)
|
||||
= link_to new_planting_harvest_path(planting), class: 'btn btn-primary' do
|
||||
%span.glyphicon.glyphicon-leaf{ title: "Harvest" }
|
||||
Harvest
|
||||
|
||||
16
app/views/plantings/_owner.haml
Normal file
16
app/views/plantings/_owner.haml
Normal file
@@ -0,0 +1,16 @@
|
||||
.row
|
||||
.col-md-6
|
||||
%h4
|
||||
Planted by
|
||||
= link_to @planting.owner, @planting.owner
|
||||
= link_to "view all #{@planting.owner}'s plantings", member_gardens_path(@planting.owner)
|
||||
|
||||
%p
|
||||
Planted in
|
||||
= link_to @planting.garden, @planting.garden
|
||||
- if @planting.owner.location
|
||||
%p
|
||||
%small
|
||||
View other plantings, members and more near
|
||||
= link_to @planting.owner.location, place_path(@planting.owner.location, anchor: "plantings")
|
||||
.col-md-6= render "members/avatar", member: @planting.owner
|
||||
6
app/views/plantings/_planting.haml
Normal file
6
app/views/plantings/_planting.haml
Normal file
@@ -0,0 +1,6 @@
|
||||
- if local_assigns[:full]
|
||||
- cache planting do
|
||||
= render 'plantings/card', planting: planting
|
||||
- else
|
||||
- cache planting do
|
||||
= render 'plantings/thumbnail', planting: planting
|
||||
@@ -1,4 +1,4 @@
|
||||
.planting
|
||||
.planting.col-md-2
|
||||
.planting-thumbnail
|
||||
= render 'plantings/quick_actions', planting: planting
|
||||
= render 'plantings/badges', planting: planting
|
||||
|
||||
@@ -13,11 +13,7 @@
|
||||
= page_entries_info @plantings
|
||||
= will_paginate @plantings
|
||||
|
||||
.card-row
|
||||
- unless @plantings.empty?
|
||||
- @plantings.each.with_index do |planting|
|
||||
.card
|
||||
= render partial: "plantings/card", locals: { planting: planting }
|
||||
.row= render @plantings || "empty_list"
|
||||
|
||||
.pagination
|
||||
= page_entries_info @plantings
|
||||
|
||||
@@ -12,80 +12,34 @@
|
||||
- content_for :buttonbar do
|
||||
= render 'plantings/actions', planting: @planting
|
||||
|
||||
.row.planting
|
||||
.col-xs-12.col-sm-6
|
||||
%dl.dl-horizontal.planting-attributes
|
||||
%dt Owner:
|
||||
%dd
|
||||
= link_to @planting.owner, @planting.owner
|
||||
—
|
||||
= link_to "view all #{@planting.owner}'s plantings", member_plantings_path(@planting.owner)
|
||||
.planting
|
||||
.row
|
||||
.col-xs-12.col-sm-8
|
||||
.row
|
||||
= render 'facts', planting: @planting
|
||||
%hr/
|
||||
- if @planting.photos.size.positive?
|
||||
.row
|
||||
.col-sm-8
|
||||
= render 'plantings/badges', planting: @planting
|
||||
= render @planting.default_photo
|
||||
.col-sm-4
|
||||
= link_to 'View all photos >>', planting_photos_path(@planting), class: 'pull-right'
|
||||
- @planting.photos.order(date_taken: :desc).limit(3).each do |photo|
|
||||
= render('photos/thumbnail', photo: photo)
|
||||
|
||||
%dt Planted on:
|
||||
%dd= @planting.planted_at ? @planting.planted_at : "not specified"
|
||||
.col-xs-12.col-sm-4.pull-right
|
||||
= render "crops/index_card", crop: @planting.crop
|
||||
= render 'plantings/owner', planting: @planting
|
||||
|
||||
%dt Where:
|
||||
%dd
|
||||
= link_to "#{@planting.owner}'s", @planting.owner
|
||||
= link_to @planting.garden, @planting.garden
|
||||
- if @planting.owner.location.present?
|
||||
(#{@planting.owner.location})
|
||||
%dt Quantity:
|
||||
%dd= display_planting_quantity(@planting)
|
||||
|
||||
%dt Planted from:
|
||||
%dd
|
||||
- if @planting.parent_seed
|
||||
= link_to @planting.parent_seed, seed_path(@planting.parent_seed)
|
||||
- else
|
||||
= display_planted_from(@planting)
|
||||
|
||||
%dt Sun or shade?
|
||||
%dd
|
||||
- sunniness = @planting.sunniness.blank? ? "not specified" : @planting.sunniness
|
||||
= image_tag("sunniness_#{sunniness}.png", size: "25x25", alt: sunniness, title: sunniness)
|
||||
= sunniness
|
||||
|
||||
- unless @planting.crop.perennial
|
||||
%dt Predicted finish:
|
||||
%dd
|
||||
- if @planting.finish_predicted_at.present?
|
||||
= @planting.finish_predicted_at
|
||||
- elsif @planting.planted_at.blank?
|
||||
%strong Set planted date to get predictions
|
||||
- if @planting.finished?
|
||||
%dt Finished:
|
||||
%dd= display_finished(@planting)
|
||||
- if @planting.crop.median_lifespan.present?
|
||||
%dt Expected Lifespan:
|
||||
%dd #{@planting.crop.median_lifespan} days
|
||||
- if @planting.lifespan.present?
|
||||
%dt Actual Lifespan:
|
||||
%dd #{@planting.lifespan} days
|
||||
- if @planting.days_to_first_harvest.present?
|
||||
%dt First Harvest:
|
||||
%dd #{@planting.days_to_first_harvest} days after planting
|
||||
- if @planting.days_to_last_harvest.present?
|
||||
%dt Last Harvest:
|
||||
%dd #{@planting.days_to_last_harvest} days after planting
|
||||
|
||||
%dt Progress
|
||||
%dd= render 'plantings/progress', planting: @planting, show_explanation: true
|
||||
|
||||
.col-xs-12.col-sm-6
|
||||
= render partial: "crops/index_card", locals: { crop: @planting.crop }
|
||||
- if @planting.owner.location
|
||||
%p
|
||||
%small
|
||||
View other plantings, members and more near
|
||||
= link_to @planting.owner.location, place_path(@planting.owner.location, anchor: "plantings")
|
||||
.row
|
||||
.col-md-6
|
||||
- if @planting.description
|
||||
%h2 Notes
|
||||
:growstuff_markdown
|
||||
#{ @planting.description != "" ? strip_tags(@planting.description) : "No description given." }
|
||||
= render 'plantings/harvests', planting: @planting
|
||||
= render 'plantings/descendants', planting: @planting
|
||||
.col-md-6
|
||||
= render 'photos/item_photos', item: @planting, type: 'planting', photos: @photos
|
||||
.row
|
||||
.col-md-12
|
||||
- if @planting.description
|
||||
%h2 Notes
|
||||
:growstuff_markdown
|
||||
#{ @planting.description != "" ? strip_tags(@planting.description) : "No description given." }
|
||||
.row
|
||||
.col-md-6.col-sm-12
|
||||
= render 'plantings/harvests', planting: @planting
|
||||
.col-md-6.col-sm-12
|
||||
= render 'plantings/descendants', planting: @planting
|
||||
|
||||
9
db/migrate/20190326224347_add_harvests_count.rb
Normal file
9
db/migrate/20190326224347_add_harvests_count.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class AddHarvestsCount < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :plantings, :harvests_count, :integer, default: 0
|
||||
Planting.reset_column_information
|
||||
Planting.pluck(:id).each do |planting_id|
|
||||
Planting.reset_counters(planting_id, :harvests)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2019_03_26_063855) do
|
||||
ActiveRecord::Schema.define(version: 2019_03_26_224347) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -400,6 +400,7 @@ ActiveRecord::Schema.define(version: 2019_03_26_063855) do
|
||||
t.integer "days_to_first_harvest"
|
||||
t.integer "days_to_last_harvest"
|
||||
t.integer "parent_seed_id"
|
||||
t.integer "harvests_count", default: 0
|
||||
t.index ["slug"], name: "index_plantings_on_slug", unique: true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user