-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Turbo for live search in
ui/table
component
This enhancement enables live search functionality in the products list table and in general in the `ui/table` component, allowing users to search for products without reloading the page.
- Loading branch information
1 parent
5374fb6
commit 8a6e494
Showing
9 changed files
with
106 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
admin/app/components/solidus_admin/ui/table/pagination/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
|
||
export default class extends Controller { | ||
static targets = ["prevButton", "nextButton"] | ||
static values = { turboFrameId: String } | ||
|
||
connect() { | ||
const turboFrame = this.element.closest('turbo-frame') | ||
this.turboFrameIdValue = turboFrame ? turboFrame.id : null | ||
|
||
this.prevButtonTarget.dataset.turboFrame = this.turboFrameIdValue | ||
this.prevButtonTarget.dataset.turboAction = "replace" | ||
|
||
this.nextButtonTarget.dataset.turboFrame = this.turboFrameIdValue | ||
this.nextButtonTarget.dataset.turboAction = "replace" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
import "@hotwired/turbo-rails" | ||
import "solidus_admin/controllers" | ||
console.log("Hello from application.js") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const debounce = (func, wait) => { | ||
let timeout | ||
|
||
return () => { | ||
clearTimeout(timeout) | ||
timeout = setTimeout(func, wait) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters