Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Admin] Fix ui/table/toolbar & restore clearSearch & Streamline feedback rendering #5449

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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