From 786963eb8fe7627739dee30ec66a2d41f169fc48 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 21 Dec 2019 17:33:59 +1300 Subject: [PATCH] Update seeds rss to expect a hash --- app/models/concerns/seed_search.rb | 15 ++++++++++----- app/views/seeds/index.rss.haml | 25 +++++++++++-------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/app/models/concerns/seed_search.rb b/app/models/concerns/seed_search.rb index 4eb690741..d2389d70d 100644 --- a/app/models/concerns/seed_search.rb +++ b/app/models/concerns/seed_search.rb @@ -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 } diff --git a/app/views/seeds/index.rss.haml b/app/views/seeds/index.rss.haml index b2044de6e..563ffae17 100644 --- a/app/views/seeds/index.rss.haml +++ b/app/views/seeds/index.rss.haml @@ -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 -

Quantity: #{seed.quantity ? seed.quantity : 'unknown' }

-

Plant before: #{seed.plant_before ? seed.plant_before : 'unknown' }

-

Organic? #{seed.organic}

-

GMO? #{seed.gmo}

-

Heirloom? #{seed.heirloom}

- - if seed.tradable? +

Quantity: #{seed['quantity'] ? seed['quantity'] : 'unknown' }

+

Plant before: #{seed['plant_before'] ? seed['plant_before'] : 'unknown' }

+

Organic? #{seed['organic']}

+

GMO? #{seed['gmo']}

+

Heirloom? #{seed['heirloom']}

+ - 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'])