mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-31 12:40:59 -05:00
Add css class to show finished/zombie/harvesting etc
This commit is contained in:
@@ -101,6 +101,10 @@ p.stats
|
||||
.badge-harvest
|
||||
background-color: $blue
|
||||
|
||||
.planting-zombie
|
||||
.planting-predicted-finished
|
||||
background-color: $beige
|
||||
|
||||
.planting
|
||||
.planting-badges
|
||||
position: absolute
|
||||
|
||||
@@ -42,4 +42,14 @@ module PlantingsHelper
|
||||
return unless planting.planted_at.present? && planting.first_harvest_predicted_at.present?
|
||||
(planting.first_harvest_predicted_at - Time.zone.today).to_i
|
||||
end
|
||||
|
||||
def planting_classes(planting)
|
||||
classes = []
|
||||
classes << 'planting-growing' if planting.growing?
|
||||
classes << 'planting-finished' if planting.finished?
|
||||
classes << 'planting-harvest-time' if planting.harvest_time?
|
||||
classes << 'planting-predicted-finished' if planting.should_be_finished?
|
||||
classes << 'planting-zombie' if planting.zombie?
|
||||
classes.join(' ')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
= render 'plantings/badges', planting: planting
|
||||
.hover-wrapper
|
||||
.thumbnail
|
||||
.planting-thumbnail
|
||||
.planting-thumbnail{class: planting_classes(planting)}
|
||||
= link_to image_tag(planting_image_path(planting), alt: planting.crop.name, class: 'img'), planting_path(planting)
|
||||
= render 'plantings/progress', planting: planting, show_explanation: false
|
||||
.planting-name
|
||||
|
||||
Reference in New Issue
Block a user