mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-12 12:42:08 -04:00
use object instead of hash for displaying crops
This commit is contained in:
1 parent
ace0977c75
commit
aea0d5877d
5 files changed
+9
-24
No files matched your search
@@ -6,7 +6,7 @@
|
||||
crop
|
||||
.card-body
|
||||
%h3.card-title
|
||||
%strong= link_to crop, crop
|
||||
%strong= link_to crop.name, crop_path(slug: crop.slug)
|
||||
= crop.default_scientific_name
|
||||
.d-flex.justify-content-between
|
||||
- if crop.annual? && crop.median_lifespan.present?
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
.card.crop-thumbnail
|
||||
= link_to crop_path(slug: crop['slug']) do
|
||||
|
||||
= image_tag(crop['thumbnail_url'] ? crop['thumbnail_url'] : placeholder_image,
|
||||
alt: crop['name'],
|
||||
class: 'img img-card')
|
||||
|
||||
.text
|
||||
%h3.crop-name
|
||||
= link_to crop['name'], crop_path(slug: crop['slug'])
|
||||
%h5.crop-sci-name
|
||||
|
||||
= crop['scientific_name']
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
- cache crop do
|
||||
.card.crop-thumbnail
|
||||
= link_to image_tag(crop_image_path(crop),
|
||||
= link_to image_tag(crop.thumbnail_url ? crop.thumbnail_url : placeholder_image,
|
||||
alt: crop.name,
|
||||
class: 'img img-card'),
|
||||
crop
|
||||
crop_path(slug: crop.slug)
|
||||
|
||||
.text
|
||||
%h3.crop-name= link_to crop, crop
|
||||
%h3.crop-name= link_to crop.name, crop_path(slug: crop.slug)
|
||||
%h5.crop-sci-name
|
||||
|
||||
= crop.scientific_names.first&.name
|
||||
= crop.scientific_names.first
|
||||
@@ -22,8 +22,8 @@
|
||||
%h2= t('.title')
|
||||
= will_paginate @crops
|
||||
.index-cards
|
||||
- @crops.each do |crop|
|
||||
= render 'crops/search_result', crop: crop
|
||||
- @crops.each do |c|
|
||||
= render 'crops/thumbnail', crop: c
|
||||
|
||||
= will_paginate @crops
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- cache cache_key_for(Crop, 'homepage'), expires_in: 1.day do
|
||||
.index-cards
|
||||
- CropSearchService.random_with_photos(16).each do |crop|
|
||||
= render 'crops/search_result', crop: crop
|
||||
- CropSearchService.random_with_photos(16).each do |c|
|
||||
= render 'crops/thumbnail', crop: c
|
||||
Reference in new issue
Block a user