diff --git a/app/controllers/alt_styles_controller.rb b/app/controllers/alt_styles_controller.rb index 5d75d12a..619d576a 100644 --- a/app/controllers/alt_styles_controller.rb +++ b/app/controllers/alt_styles_controller.rb @@ -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 diff --git a/app/views/alt_styles/index.html.haml b/app/views/alt_styles/index.html.haml index f1f9018a..cb148549 100644 --- a/app/views/alt_styles/index.html.haml +++ b/app/views/alt_styles/index.html.haml @@ -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,