From c5e384cc68fc84367bca7a8e8e443cfd542662ea Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 25 Jun 2025 14:38:23 -0500 Subject: [PATCH 01/14] These aren't actually in the events namespace, use utility class --- app/assets/stylesheets/events.css | 4 ---- app/views/cards/index/_closure_filter.html.erb | 2 +- app/views/cards/index/_workflow_filter.html.erb | 2 +- app/views/events/_filter.html.erb | 2 +- app/views/filters/_assignees.html.erb | 2 +- app/views/filters/_creators.html.erb | 2 +- app/views/filters/_indexed_by.html.erb | 2 +- app/views/filters/_stages.html.erb | 2 +- app/views/filters/_tags.html.erb | 2 +- 9 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/assets/stylesheets/events.css b/app/assets/stylesheets/events.css index 6a52349fe..1d7f2264c 100644 --- a/app/assets/stylesheets/events.css +++ b/app/assets/stylesheets/events.css @@ -122,10 +122,6 @@ text-align: center; } - .events__popup { - margin-block-start: var(--block-space-half); - } - /* Event /* ------------------------------------------------------------------------ */ diff --git a/app/views/cards/index/_closure_filter.html.erb b/app/views/cards/index/_closure_filter.html.erb index 258e20d4a..da5b5bf22 100644 --- a/app/views/cards/index/_closure_filter.html.erb +++ b/app/views/cards/index/_closure_filter.html.erb @@ -3,7 +3,7 @@ Recently closed - Closed with reason… diff --git a/app/views/cards/index/_workflow_filter.html.erb b/app/views/cards/index/_workflow_filter.html.erb index 49f2cc31b..d453917d5 100644 --- a/app/views/cards/index/_workflow_filter.html.erb +++ b/app/views/cards/index/_workflow_filter.html.erb @@ -7,7 +7,7 @@ <% end %> - In stage(s)… diff --git a/app/views/events/_filter.html.erb b/app/views/events/_filter.html.erb index 8a42c1c3f..8b3281289 100644 --- a/app/views/events/_filter.html.erb +++ b/app/views/events/_filter.html.erb @@ -13,7 +13,7 @@ Fizzy <% end %> - <%= tag.dialog class: "fizzy-dialog filter events__popup popup popup--animated panel flex-column align-start fill-white", + <%= tag.dialog class: "fizzy-dialog filter margin-block-start-half popup popup--animated panel flex-column align-start fill-white", data: { action: "turbo:before-cache@document->dialog#close keydown->navigable-list#navigate filter:changed->navigable-list#reset toggle->filter#filter", controller: "filter navigable-list", diff --git a/app/views/filters/_assignees.html.erb b/app/views/filters/_assignees.html.erb index 2b4d684ee..7c6b42d78 100644 --- a/app/views/filters/_assignees.html.erb +++ b/app/views/filters/_assignees.html.erb @@ -12,7 +12,7 @@ - + Assigned to… <%= form_with url: cards_path, method: :get, class: "popup__list", data: { controller: "form" } do |form| %> diff --git a/app/views/filters/_creators.html.erb b/app/views/filters/_creators.html.erb index 5c9e48b83..79eb105fa 100644 --- a/app/views/filters/_creators.html.erb +++ b/app/views/filters/_creators.html.erb @@ -11,7 +11,7 @@ - Added by… diff --git a/app/views/filters/_indexed_by.html.erb b/app/views/filters/_indexed_by.html.erb index bc87053b5..8144e9afb 100644 --- a/app/views/filters/_indexed_by.html.erb +++ b/app/views/filters/_indexed_by.html.erb @@ -6,7 +6,7 @@ - Sort by… diff --git a/app/views/filters/_stages.html.erb b/app/views/filters/_stages.html.erb index db44cbd32..8561f6364 100644 --- a/app/views/filters/_stages.html.erb +++ b/app/views/filters/_stages.html.erb @@ -10,7 +10,7 @@ - In stage… diff --git a/app/views/filters/_tags.html.erb b/app/views/filters/_tags.html.erb index b3b964784..476fd98cc 100644 --- a/app/views/filters/_tags.html.erb +++ b/app/views/filters/_tags.html.erb @@ -10,7 +10,7 @@ - + Tagged… <%= form_with url: cards_path, method: :get, class: "popup__list", data: { controller: "form" } do |form| %> From 2ed101e46848b7b3c7d27b504bd287bec82be28a Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 25 Jun 2025 14:38:35 -0500 Subject: [PATCH 02/14] Unnecessary --- app/assets/stylesheets/filters.css | 11 ----------- app/views/filters/_dialog.html.erb | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/app/assets/stylesheets/filters.css b/app/assets/stylesheets/filters.css index 7701e72c9..2cfa945a1 100644 --- a/app/assets/stylesheets/filters.css +++ b/app/assets/stylesheets/filters.css @@ -94,17 +94,6 @@ } } - .panel:is(.filter__popup) { - --panel-size: 100ch; - --panel-padding: var(--block-space); - - inline-size: auto !important; - min-inline-size: var(--panel-size); - max-block-size: calc(90dvh - (2 * var(--block-space-double))); - max-inline-size: calc(100dvw - (2 * var(--block-space-double))); - z-index: 1; - } - .quick-filter { &:has(input:not(.default-value):checked) { .input--select { diff --git a/app/views/filters/_dialog.html.erb b/app/views/filters/_dialog.html.erb index 6c67335d5..fd9d91b94 100644 --- a/app/views/filters/_dialog.html.erb +++ b/app/views/filters/_dialog.html.erb @@ -1,5 +1,5 @@ <%# Don't delete this file just yet, it's coming back soon. %> - +
From ae12a7294c205aa049855b48f59f0c7d369aeeaf Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 25 Jun 2025 19:00:47 -0500 Subject: [PATCH 03/14] New UI for exposing filter options and saving/deleting them --- app/assets/stylesheets/filters.css | 5 ++- app/controllers/concerns/filter_scoped.rb | 1 + app/controllers/filters_controller.rb | 2 +- app/views/events/_filter.html.erb | 2 +- .../filter/_custom_collections.html.erb | 7 ++-- app/views/filters/_assignees.html.erb | 6 +++- app/views/filters/_creators.html.erb | 6 +++- app/views/filters/_indexed_by.html.erb | 8 +++-- app/views/filters/_settings.html.erb | 34 +++++++++++++++++-- app/views/filters/_stages.html.erb | 6 +++- app/views/filters/_tags.html.erb | 6 +++- 11 files changed, 69 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/filters.css b/app/assets/stylesheets/filters.css index 2cfa945a1..d89ad57f1 100644 --- a/app/assets/stylesheets/filters.css +++ b/app/assets/stylesheets/filters.css @@ -1,8 +1,11 @@ @layer components { .filters { + view-transition-name: "filters"; + z-index: var(--z-popup); + #header:has(&) { position: relative; - z-index: 1; + z-index: var(--z-popup); } .btn { diff --git a/app/controllers/concerns/filter_scoped.rb b/app/controllers/concerns/filter_scoped.rb index 074dd967b..ff796db27 100644 --- a/app/controllers/concerns/filter_scoped.rb +++ b/app/controllers/concerns/filter_scoped.rb @@ -9,6 +9,7 @@ module FilterScoped DEFAULT_PARAMS = { indexed_by: "latest" } def set_filter + @expand_all = params[:expand_all] @filter = Current.user.filters.from_params params.reverse_merge(**DEFAULT_PARAMS).permit(*Filter::PERMITTED_PARAMS) end end diff --git a/app/controllers/filters_controller.rb b/app/controllers/filters_controller.rb index ba34c1622..e6255f19f 100644 --- a/app/controllers/filters_controller.rb +++ b/app/controllers/filters_controller.rb @@ -12,7 +12,7 @@ class FiltersController < ApplicationController if request.referer == root_url redirect_to root_path else - redirect_to cards_path(@filter.as_params) + redirect_to cards_path end end diff --git a/app/views/events/_filter.html.erb b/app/views/events/_filter.html.erb index 8b3281289..489ec2772 100644 --- a/app/views/events/_filter.html.erb +++ b/app/views/events/_filter.html.erb @@ -25,12 +25,12 @@ <%= render "events/filter/header" %> - Collections <%= form_with url: events_path, method: :get, class: "popup__list", data: { controller: "form" } do |form| %> <% if Current.user.collections.many? %> diff --git a/app/views/events/filter/_custom_collections.html.erb b/app/views/events/filter/_custom_collections.html.erb index 26dad7da2..0c1ee2fa5 100644 --- a/app/views/events/filter/_custom_collections.html.erb +++ b/app/views/events/filter/_custom_collections.html.erb @@ -1,11 +1,12 @@ - +<% end %> diff --git a/app/views/filters/_assignees.html.erb b/app/views/filters/_assignees.html.erb index 7c6b42d78..99666633c 100644 --- a/app/views/filters/_assignees.html.erb +++ b/app/views/filters/_assignees.html.erb @@ -1,4 +1,4 @@ -<% if filter.assignees.any? %> +<% if filter.assignees.any? || @expand_all %>
- - Assigned to… - <%= form_with url: cards_path, method: :get, class: "popup__list", - data: { controller: "form" } do |form| %> - <% filter.as_params.except(:assignee_ids, :assignment_status).each do |key, value| %> - <%= filter_hidden_field_tag key, value %> - <% end %> + <%= tag.dialog class: "margin-block-start-half popup panel flex-column align-start gap-half fill-white shadow txt-small", data: { + action: "turbo:before-cache@document->dialog#close keydown->navigable-list#navigate filter:changed->navigable-list#reset toggle->filter#filter", + aria: { label: "Assigned to…", aria_description: "Assigned to…" }, + controller: "filter navigable-list", + dialog_target: "dialog", + navigable_list_focus_on_selection_value: false, + navigable_list_actionable_items_value: true } do %> + Assigned to… - <% if @expand_all %> - <%= hidden_field_tag :expand_all, @expand_all %> - <% end %> - - <%= link_to cards_path(filter.as_params.except(:assignee_ids, :assignment_status).merge(expand_all: @expand_all)), class: "btn popup__item" do %> - Deselect all - <% end %> - - - - <% User.active.order(:name).each do |user| %> - - <% end %> + <% if User.active.many? %> + <%= text_field_tag :search, nil, placeholder: "Filter…", class: "input input--transparent txt-small", autofocus: true, + type: "search", autocorrect: "off", autocomplete: "off", data: { "1p-ignore": "true", filter_target: "input", action: "input->filter#filter" } %> <% end %> - + + + <% end %>
<% end %> diff --git a/app/views/filters/_creators.html.erb b/app/views/filters/_creators.html.erb index 3db8d63d6..9ba8954e7 100644 --- a/app/views/filters/_creators.html.erb +++ b/app/views/filters/_creators.html.erb @@ -4,57 +4,59 @@ - - Added by… - <%= form_with url: cards_path, method: :get, class: "popup__list", - data: { controller: "form" } do |form| %> - <% filter.as_params.except(:creator_ids).each do |key, value| %> - <%= filter_hidden_field_tag key, value %> - <% end %> + <%= tag.dialog class: "margin-block-start-half popup panel flex-column align-start gap-half fill-white shadow txt-small", data: { + action: "turbo:before-cache@document->dialog#close keydown->navigable-list#navigate filter:changed->navigable-list#reset toggle->filter#filter", + aria: { label: "Added by…", aria_description: "Added by…" }, + controller: "filter navigable-list", + dialog_target: "dialog", + navigable_list_focus_on_selection_value: false, + navigable_list_actionable_items_value: true } do %> + Added by… - <% if @expand_all %> - <%= hidden_field_tag :expand_all, @expand_all %> - <% end %> - - <%= link_to cards_path(filter.as_params.except(:creator_ids).merge(expand_all: @expand_all)), class: "btn popup__item" do %> - Deselect all - <% end %> - - - - <% User.active.without(Current.user).order(:name).each do |user| %> - - <% end %> + <% if User.active.many? %> + <%= text_field_tag :search, nil, placeholder: "Filter…", class: "input input--transparent txt-small", autofocus: true, + type: "search", autocorrect: "off", autocomplete: "off", data: { "1p-ignore": "true", filter_target: "input", action: "input->filter#filter" } %> <% end %> - + + + <% end %>
<% end %> diff --git a/app/views/filters/_indexed_by.html.erb b/app/views/filters/_indexed_by.html.erb index 091252cf5..37a22388f 100644 --- a/app/views/filters/_indexed_by.html.erb +++ b/app/views/filters/_indexed_by.html.erb @@ -1,36 +1,44 @@ <% if !filter.indexed_by.latest? || @expand_all %> -
+
" data-controller="dialog" data-action="keydown.esc->dialog#close click@document->dialog#closeOnClickOutside"> - - Sort by… - <%= form_with url: cards_path, method: :get, class: "popup__list", - data: { controller: "form" } do |form| %> - <% filter.as_params.except(:indexed_by).each do |key, value| %> - <%= filter_hidden_field_tag key, value %> - <% end %> - - <% if @expand_all %> - <%= hidden_field_tag :expand_all, @expand_all %> - <% end %> - + <%= tag.dialog class: "margin-block-start-half popup panel flex-column align-start gap-half fill-white shadow txt-small", data: { + action: "turbo:before-cache@document->dialog#close keydown->navigable-list#navigate", + aria: { label: "Sort by…", aria_description: "Sort by…" }, + controller: "navigable-list", + dialog_target: "dialog", + navigable_list_focus_on_selection_value: false, + navigable_list_actionable_items_value: true } do %> + Sort by… + + + + <% end %>
<% end %> diff --git a/app/views/filters/_tags.html.erb b/app/views/filters/_tags.html.erb index 2cc76c340..665d1f048 100644 --- a/app/views/filters/_tags.html.erb +++ b/app/views/filters/_tags.html.erb @@ -3,42 +3,59 @@ - - Tagged… - <%= form_with url: cards_path, method: :get, class: "popup__list", - data: { controller: "form" } do |form| %> - <% filter.as_params.except(:tag_ids).each do |key, value| %> - <%= filter_hidden_field_tag key, value %> - <% end %> + <%= tag.dialog class: "margin-block-start-half popup panel flex-column align-start gap-half fill-white shadow txt-small", data: { + action: "turbo:before-cache@document->dialog#close keydown->navigable-list#navigate filter:changed->navigable-list#reset toggle->filter#filter", + aria: { label: "Tagged…", aria_description: "Tagged…" }, + controller: "filter navigable-list", + dialog_target: "dialog", + navigable_list_focus_on_selection_value: false, + navigable_list_actionable_items_value: true } do %> + Tagged… - <% if @expand_all %> - <%= hidden_field_tag :expand_all, @expand_all %> - <% end %> - - <%= link_to cards_path(filter.as_params.except(:tag_ids).merge(expand_all: @expand_all)), class: "btn popup__item" do %> - Clear all - <% end %> - - <% Tag.order(:title).each do |tag| %> - - <% end %> + <% if Tag.many? %> + <%= text_field_tag :search, nil, placeholder: "Filter…", class: "input input--transparent txt-small", autofocus: true, + type: "search", autocorrect: "off", autocomplete: "off", data: { "1p-ignore": "true", filter_target: "input", action: "input->filter#filter" } %> <% end %> - + + + <% end %>
<% end %> From c85b22b28fb068509111b1ecb172ba58d99219b9 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 26 Jun 2025 17:09:57 -0500 Subject: [PATCH 09/14] Improve summary display in menu --- app/helpers/filters_helper.rb | 6 +++++- app/models/filter/summarized.rb | 14 +++++--------- .../events/filter/_custom_collections.html.erb | 5 ++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/helpers/filters_helper.rb b/app/helpers/filters_helper.rb index 7b5f5e51f..f06efe62e 100644 --- a/app/helpers/filters_helper.rb +++ b/app/helpers/filters_helper.rb @@ -21,9 +21,13 @@ module FiltersHelper hidden_field_tag name, value, id: nil end + def filter_selected_collections_sentence(filter) + filter.collections.collect { "#{it.name}" }.uniq.sort.to_sentence + end + def filter_selected_collections_label(filter) selected_collections = if filter.collections.any? - filter.collections.collect { "#{it.name}" }.uniq.sort.to_sentence + filter_selected_collections_sentence(filter) else "all collections" end diff --git a/app/models/filter/summarized.rb b/app/models/filter/summarized.rb index c08607f32..e56a2dd10 100644 --- a/app/models/filter/summarized.rb +++ b/app/models/filter/summarized.rb @@ -1,16 +1,18 @@ module Filter::Summarized def summary - [ index_summary, tag_summary, assignee_summary, creator_summary, stage_summary, terms_summary ].compact.to_sentence + " #{collection_summary}" + [ index_summary, tag_summary, assignee_summary, creator_summary, stage_summary, terms_summary ].compact.to_sentence end private def index_summary - indexed_by.humanize + unless indexed_by.latest? + indexed_by.humanize + end end def tag_summary if tags.any? - "tagged #{tags.map(&:hashtag).to_choice_sentence}" + "#{tags.map(&:hashtag).to_choice_sentence}" end end @@ -28,12 +30,6 @@ module Filter::Summarized end end - def collection_summary - if collections.any? - "in #{collections.pluck(:name).to_choice_sentence}" - end - end - def terms_summary if terms.any? "matching #{terms.map { |term| %Q("#{term}") }.to_sentence}" diff --git a/app/views/events/filter/_custom_collections.html.erb b/app/views/events/filter/_custom_collections.html.erb index 0c1ee2fa5..9a6b793d8 100644 --- a/app/views/events/filter/_custom_collections.html.erb +++ b/app/views/events/filter/_custom_collections.html.erb @@ -4,7 +4,10 @@ From c6bb0326cd4a83f317da5c425f1d2b80551e7e75 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 26 Jun 2025 17:31:44 -0500 Subject: [PATCH 10/14] Update summary tests --- test/models/filter_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/models/filter_test.rb b/test/models/filter_test.rb index 6dec75089..4ebe17434 100644 --- a/test/models/filter_test.rb +++ b/test/models/filter_test.rb @@ -114,16 +114,16 @@ class FilterTest < ActiveSupport::TestCase end test "summary" do - assert_equal "Newest, tagged #mobile, and assigned to JZ ", filters(:jz_assignments).summary + assert_equal "Newest, #mobile, and assigned to JZ", filters(:jz_assignments).summary filters(:jz_assignments).update!(stages: workflow_stages(:qa_triage, :qa_in_progress)) - assert_equal "Newest, tagged #mobile, assigned to JZ, and staged in Triage or In progress ", filters(:jz_assignments).summary + assert_equal "Newest, #mobile, assigned to JZ, and staged in Triage or In progress", filters(:jz_assignments).summary filters(:jz_assignments).update!(stages: [], assignees: [], tags: [], collections: [ collections(:writebook) ]) - assert_equal "Newest in Writebook", filters(:jz_assignments).summary + assert_equal "Newest", filters(:jz_assignments).summary filters(:jz_assignments).update!(indexed_by: "stalled") - assert_equal "Stalled in Writebook", filters(:jz_assignments).summary + assert_equal "Stalled", filters(:jz_assignments).summary end test "get a clone with some changed params" do From 1cb9ccdf151f6594f97c8f7e1246e1b358ae92d8 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 26 Jun 2025 17:57:30 -0500 Subject: [PATCH 11/14] Comparing params is fragile, use `id` for saved filters --- app/controllers/concerns/filter_scoped.rb | 6 +++++- app/controllers/filters_controller.rb | 2 +- app/views/events/filter/_custom_collections.html.erb | 2 +- app/views/filters/_settings.html.erb | 5 ++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controllers/concerns/filter_scoped.rb b/app/controllers/concerns/filter_scoped.rb index ff796db27..3d5f1fc91 100644 --- a/app/controllers/concerns/filter_scoped.rb +++ b/app/controllers/concerns/filter_scoped.rb @@ -10,6 +10,10 @@ module FilterScoped def set_filter @expand_all = params[:expand_all] - @filter = Current.user.filters.from_params params.reverse_merge(**DEFAULT_PARAMS).permit(*Filter::PERMITTED_PARAMS) + if params[:filter_id].present? + @filter = Current.user.filters.find(params[:filter_id]) + else + @filter = Current.user.filters.from_params params.reverse_merge(**DEFAULT_PARAMS).permit(*Filter::PERMITTED_PARAMS) + end end end diff --git a/app/controllers/filters_controller.rb b/app/controllers/filters_controller.rb index 1d0ff6b47..cbb44963b 100644 --- a/app/controllers/filters_controller.rb +++ b/app/controllers/filters_controller.rb @@ -3,7 +3,7 @@ class FiltersController < ApplicationController def create @filter = Current.user.filters.remember filter_params - redirect_to cards_path(@filter.as_params) + redirect_to cards_path(filter_id: @filter.id) end def destroy diff --git a/app/views/events/filter/_custom_collections.html.erb b/app/views/events/filter/_custom_collections.html.erb index 9a6b793d8..5b577df75 100644 --- a/app/views/events/filter/_custom_collections.html.erb +++ b/app/views/events/filter/_custom_collections.html.erb @@ -2,7 +2,7 @@ Saved filters <% @filters.each do |filter| %>