From 53b7783c8f66ed4fa2e93cb4b93677843647a6b5 Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Mon, 23 Oct 2023 18:12:25 +0200 Subject: [PATCH 1/3] Support params in `ui/table/toolbar` component Updated the `SolidusAdmin::UI::Table::Toolbar::Component` to accept and render additional parameters. --- .../ui/table/toolbar/component.rb | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/admin/app/components/solidus_admin/ui/table/toolbar/component.rb b/admin/app/components/solidus_admin/ui/table/toolbar/component.rb index 70e287ef759..58c6d5f2ca2 100644 --- a/admin/app/components/solidus_admin/ui/table/toolbar/component.rb +++ b/admin/app/components/solidus_admin/ui/table/toolbar/component.rb @@ -1,14 +1,21 @@ # frozen_string_literal: true class SolidusAdmin::UI::Table::Toolbar::Component < SolidusAdmin::BaseComponent - erb_template <<~ERB -
- <%= content %> -
- ERB + def initialize(**options) + @options = options + end + + def call + tag.div( + content, + **@options, + class: " + h-14 p-2 bg-white border-b border-gray-100 + justify-start items-center gap-2 + visible:flex hidden:hidden + rounded-t-lg + #{@options[:class]} + " + ) + end end From 504490b548644f0c317fab357c1331a975471ee4 Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Mon, 23 Oct 2023 18:13:09 +0200 Subject: [PATCH 2/3] Re-add `clearSearch` js function The `clearSearch` function was previously removed, causing search clearing issues. This commit re-introduces the function, restoring its functionality. --- admin/app/components/solidus_admin/ui/table/component.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin/app/components/solidus_admin/ui/table/component.js b/admin/app/components/solidus_admin/ui/table/component.js index 6a517b13972..0c925621f85 100644 --- a/admin/app/components/solidus_admin/ui/table/component.js +++ b/admin/app/components/solidus_admin/ui/table/component.js @@ -45,6 +45,11 @@ export default class extends Controller { this.searchFormTarget.requestSubmit() } + clearSearch() { + this.searchFieldTarget.value = '' + this.search() + } + cancelSearch() { this.clearSearch() From 44c41c5848106ab55c47405a474778421dca97fd Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Mon, 23 Oct 2023 18:20:37 +0200 Subject: [PATCH 3/3] Remove redundant feedback component in `Orders` & `Products` tables Eliminated an unnecessary double rendering of the feedback component in both the Orders and Products tables. This change leverages the `page_header_actions` helper, aligning with the updates in https://github.com/solidusio/solidus/pull/5445. --- .../app/components/solidus_admin/orders/index/component.html.erb | 1 - admin/app/components/solidus_admin/orders/new/component.html.erb | 1 - .../components/solidus_admin/products/index/component.html.erb | 1 - 3 files changed, 3 deletions(-) diff --git a/admin/app/components/solidus_admin/orders/index/component.html.erb b/admin/app/components/solidus_admin/orders/index/component.html.erb index 17d95a59fbd..6539a00b9e7 100644 --- a/admin/app/components/solidus_admin/orders/index/component.html.erb +++ b/admin/app/components/solidus_admin/orders/index/component.html.erb @@ -5,7 +5,6 @@
- <%= render component("feedback").new %> <%= render component("ui/button").new( tag: :a, text: t('.create_order'), diff --git a/admin/app/components/solidus_admin/orders/new/component.html.erb b/admin/app/components/solidus_admin/orders/new/component.html.erb index 37a13c33309..350c9362d24 100644 --- a/admin/app/components/solidus_admin/orders/new/component.html.erb +++ b/admin/app/components/solidus_admin/orders/new/component.html.erb @@ -5,7 +5,6 @@ <%= page_header_title t(".create_order") %> <%= page_header_actions do %> - <%= render component("feedback").new %> <%= render component("ui/button").new(tag: :button, scheme: :secondary, text: t(".discard"), form: form_id) %> <%= render component("ui/button").new(tag: :button, text: t(".save"), form: form_id) %> <% end %> diff --git a/admin/app/components/solidus_admin/products/index/component.html.erb b/admin/app/components/solidus_admin/products/index/component.html.erb index b35b6ff4fb4..5eee57b7229 100644 --- a/admin/app/components/solidus_admin/products/index/component.html.erb +++ b/admin/app/components/solidus_admin/products/index/component.html.erb @@ -2,7 +2,6 @@ <%= page_header do %> <%= page_header_title title %> <%= page_header_actions do %> - <%= render component("feedback").new %> <%= render component("ui/button").new( tag: :a, text: t('.add_product'),