Update seeds rss to expect a hash

This commit is contained in:
Brenda Wallace
2019-12-21 17:33:59 +13:00
parent 6b1f85fe72
commit 786963eb8f
2 changed files with 21 additions and 19 deletions

View File

@@ -18,17 +18,22 @@ module SeedSearch
def search_data
{
slug: slug,
crop_slug: crop.slug,
crop_name: crop.name,
crop_id: crop_id,
crop_name: crop.name,
crop_slug: crop.slug,
gmo: gmo,
has_photos: photos.size.positive?,
heirloom: heirloom,
organic: organic,
owner_id: owner_id,
owner_name: owner.login_name,
tradable_to: tradable_to,
tradeable: tradable?,
parent_planting: parent_planting,
photos_count: photos.size,
has_photos: photos.size.positive?,
plant_before: plant_before,
quantity: quantity,
thumbnail_url: default_photo&.thumbnail_url,
tradable_to: tradable_to,
tradeable: tradable?,
finished: finished?,
created_at: created_at.to_i
}

View File

@@ -6,20 +6,17 @@
%link= seeds_url
- @seeds.each do |seed|
%item
%title #{seed.owner}'s #{seed.crop} seeds
%pubdate= seed.created_at.to_s(:rfc822)
%title #{seed['owner_name']}'s #{seed['crop_name']} seeds
%pubdate= seed['created_at'].to_s(:rfc822)
%description
:escaped
<p>Quantity: #{seed.quantity ? seed.quantity : 'unknown' }</p>
<p>Plant before: #{seed.plant_before ? seed.plant_before : 'unknown' }</p>
<p>Organic? #{seed.organic}</p>
<p>GMO? #{seed.gmo}</p>
<p>Heirloom? #{seed.heirloom}</p>
- if seed.tradable?
<p>Quantity: #{seed['quantity'] ? seed['quantity'] : 'unknown' }</p>
<p>Plant before: #{seed['plant_before'] ? seed['plant_before'] : 'unknown' }</p>
<p>Organic? #{seed['organic']}</p>
<p>GMO? #{seed['gmo']}</p>
<p>Heirloom? #{seed['heirloom']}</p>
- if seed['tradable']
%p
Will trade #{seed.tradable_to} from #{seed.owner.location ? seed.owner.location : 'unknown location'}
:escaped_markdown
#{ strip_tags seed.description }
%link= seed_url(seed)
%guid= seed_url(seed)
Will trade #{seed['tradable_to']} from #{@owner.location ? @owner.location : 'unknown location'}
%link= seed_url(slug: seed['slug'])
%guid= seed_url(slug: seed['slug'])