Skip to content

Commit

Permalink
Merge pull request #5449 from nebulab/rainerd/fix-toolbar-component-p…
Browse files Browse the repository at this point in the history
…arams

[Admin] Fix `ui/table/toolbar` & restore `clearSearch` & Streamline `feedback` rendering
  • Loading branch information
rainerdema authored Oct 24, 2023
2 parents b2a6f41 + 44c41c5 commit d71c222
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
</h1>

<div class="ml-auto flex gap-2 items-center">
<%= render component("feedback").new %>
<%= render component("ui/button").new(
tag: :a,
text: t('.create_order'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
5 changes: 5 additions & 0 deletions admin/app/components/solidus_admin/ui/table/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export default class extends Controller {
this.searchFormTarget.requestSubmit()
}

clearSearch() {
this.searchFieldTarget.value = ''
this.search()
}

cancelSearch() {
this.clearSearch()

Expand Down
27 changes: 17 additions & 10 deletions admin/app/components/solidus_admin/ui/table/toolbar/component.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# frozen_string_literal: true

class SolidusAdmin::UI::Table::Toolbar::Component < SolidusAdmin::BaseComponent
erb_template <<~ERB
<div 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
">
<%= content %>
</div>
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

0 comments on commit d71c222

Please sign in to comment.