From 6ced72e10a6ac084590923834002c1cb319beaa4 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Wed, 8 Jan 2025 15:51:28 -0800 Subject: [PATCH] Better grouping for alt style series names in the filter dropdown --- app/assets/stylesheets/alt_styles/index.sass | 10 ++++++++++ app/models/alt_style.rb | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/alt_styles/index.sass b/app/assets/stylesheets/alt_styles/index.sass index 5c6c3d86..f2586027 100644 --- a/app/assets/stylesheets/alt_styles/index.sass +++ b/app/assets/stylesheets/alt_styles/index.sass @@ -1,3 +1,13 @@ +@import "../partials/clean/constants" + +// Prefer to break the name at certain points. .rainbow-pool-list .name span display: inline-block + +// De-emphasize Prismatic styles, in browsers that support it. +.rainbow-pool-filters + select[name="series"] + option[value*=": "] + color: $soft-text-color + font-style: italic diff --git a/app/models/alt_style.rb b/app/models/alt_style.rb index 7ca0d921..26f2d0c0 100644 --- a/app/models/alt_style.rb +++ b/app/models/alt_style.rb @@ -106,7 +106,9 @@ class AltStyle < ApplicationRecord end def self.all_series_names - distinct.where.not(series_name: nil).pluck(:series_name).sort + # Sort by the part *after* the colon, then before (if any). + distinct.where.not(series_name: nil).pluck(:series_name). + sort_by { |series_name| series_name.split(': ', 2).reverse } end def self.all_supported_colors