mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-24 16:58:35 -04:00
Add filtering for tradeable seeds (#4111)
* feat: Add filtering for tradeable seeds This change introduces a new feature to filter seeds based on their tradeability. - Adds a link on the homepage to view all tradeable seeds. - Modifies the seeds controller to support filtering by `tradeable_to`, allowing multiple values to be selected. - Adds links to the seeds index page to filter by the various `tradeable_to` values. * Update index.html.haml --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6ae2de7e47
commit
d383c8e2e4
@@ -19,6 +19,10 @@ class SeedsController < DataController
|
||||
where['parent_planting'] = @planting.id
|
||||
end
|
||||
|
||||
if params[:tradeable_to].present?
|
||||
where['tradeable_to'] = params[:tradeable_to]
|
||||
end
|
||||
|
||||
@show_all = (params[:all] == '1')
|
||||
where['finished'] = false unless @show_all
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@
|
||||
%section.seeds
|
||||
= cute_icon
|
||||
= render 'seeds'
|
||||
%p.text-right= link_to "#{t('home.seeds.view_all')} »", seeds_path, class: 'btn btn-block'
|
||||
%p.text-right
|
||||
= link_to "#{t('home.seeds.view_all')} »", seeds_path(tradeable_to: ['locally', 'nationally', 'internationally']), class: 'btn btn-block'
|
||||
.col-12.col-lg-6
|
||||
%section.discussion.text-center
|
||||
= cute_icon
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
= check_box_tag 'active', 'all', @show_all
|
||||
include finished
|
||||
%hr/
|
||||
%section.filters
|
||||
%h2 Tradeable
|
||||
%ul.nav.flex-column
|
||||
%li.nav-item= link_to "All tradable seeds", seeds_path(tradeable_to: ['locally', 'nationally', 'internationally'])
|
||||
- Seed::TRADABLE_TO_VALUES.each do |value|
|
||||
- unless value == 'nowhere'
|
||||
%li.nav-item= link_to value.capitalize, seeds_path(tradeable_to: value)
|
||||
%hr/
|
||||
- if @owner
|
||||
= render @owner
|
||||
- if @crop
|
||||
|
||||
Reference in New Issue
Block a user