From 0277bc94f37dedd46a7f778d5bed0e8aeb8fdf22 Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Thu, 18 Apr 2024 17:05:37 -0400 Subject: [PATCH] Small redesign of transaction filters (#650) --- app/javascript/controllers/tabs_controller.js | 5 +- app/views/transactions/_search_form.html.erb | 71 ++++++++++++------- .../search_form/_amount_filter.html.erb | 2 +- .../search_form/_date_filter.html.erb | 4 ++ .../search_form/_merchant_filter.html.erb | 2 +- .../search_form/_type_filter.html.erb | 4 ++ 6 files changed, 60 insertions(+), 28 deletions(-) create mode 100644 app/views/transactions/search_form/_date_filter.html.erb create mode 100644 app/views/transactions/search_form/_type_filter.html.erb diff --git a/app/javascript/controllers/tabs_controller.js b/app/javascript/controllers/tabs_controller.js index 15332871..16838e2a 100644 --- a/app/javascript/controllers/tabs_controller.js +++ b/app/javascript/controllers/tabs_controller.js @@ -16,7 +16,10 @@ export default class extends Controller { } select(event) { - this.updateClasses(event.target.dataset.id); + const element = event.target.closest("[data-id]"); + if (element) { + this.updateClasses(element.dataset.id); + } } onTurboLoad = () => { diff --git a/app/views/transactions/_search_form.html.erb b/app/views/transactions/_search_form.html.erb index 86bfb07d..c595540c 100644 --- a/app/views/transactions/_search_form.html.erb +++ b/app/views/transactions/_search_form.html.erb @@ -11,32 +11,53 @@ <%= lucide_icon("list-filter", class: "w-5 h-5 text-gray-500") %>

Filter

-