Add series name filter to Alt Styles filter form
Right now this just is Nostalgic, but I'll label the rest soon!
This commit is contained in:
parent
0b72b5568c
commit
2a9818b2d1
2 changed files with 5 additions and 0 deletions
|
@ -8,13 +8,16 @@ class AltStylesController < ApplicationController
|
|||
@all_colors = @all_alt_styles.map(&:color).uniq.sort_by(&:name)
|
||||
@all_species = @all_alt_styles.map(&:species).uniq.sort_by(&:name)
|
||||
|
||||
@all_series_names = @all_alt_styles.map(&:series_name).uniq.sort
|
||||
@all_color_names = @all_colors.map(&:human_name)
|
||||
@all_species_names = @all_species.map(&:human_name)
|
||||
|
||||
@series_name = params[:series]
|
||||
@color = find_color
|
||||
@species = find_species
|
||||
|
||||
@alt_styles = @all_alt_styles.includes(:swf_assets)
|
||||
@alt_styles.where!(series_name: @series_name) if @series_name.present?
|
||||
@alt_styles.merge!(@color.alt_styles) if @color
|
||||
@alt_styles.merge!(@species.alt_styles) if @species
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
class: "rainbow-pool-filters" do |f|
|
||||
%fieldset
|
||||
%legend Filter by:
|
||||
= f.select :series, @all_series_names,
|
||||
selected: @series_name, include_blank: "Style…"
|
||||
= f.select :color, @all_color_names,
|
||||
selected: @color&.human_name, include_blank: "Color…"
|
||||
= f.select :species, @all_species_names,
|
||||
|
|
Loading…
Reference in a new issue