Added:
- toolbar and fixes
This commit is contained in:
59
assets/controllers/toolbar_controller.js
Normal file
59
assets/controllers/toolbar_controller.js
Normal file
@@ -0,0 +1,59 @@
|
||||
// assets/controllers/toolbar_controller.js
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["dropdown"]
|
||||
static values = {
|
||||
currentSort: String,
|
||||
currentOrder: String
|
||||
}
|
||||
|
||||
refresh() {
|
||||
console.log("Refreshing...")
|
||||
}
|
||||
|
||||
syncRss() {
|
||||
console.log("Syncing RSS...")
|
||||
}
|
||||
|
||||
search() {
|
||||
console.log("Searching...")
|
||||
}
|
||||
|
||||
import() {
|
||||
console.log("Importing...")
|
||||
}
|
||||
|
||||
editMangas() {
|
||||
console.log("Editing mangas...")
|
||||
}
|
||||
|
||||
showOptions() {
|
||||
console.log("Showing options...")
|
||||
}
|
||||
|
||||
changeView() {
|
||||
console.log("Changing view...")
|
||||
}
|
||||
|
||||
sort(event) {
|
||||
event.preventDefault()
|
||||
const sortOption = event.currentTarget.dataset.sortOption
|
||||
let order = 'asc'
|
||||
|
||||
if (sortOption === this.currentSortValue && this.currentOrderValue === 'asc') {
|
||||
order = 'desc'
|
||||
}
|
||||
|
||||
const url = new URL(window.location)
|
||||
url.searchParams.set('sort', sortOption)
|
||||
url.searchParams.set('order', order)
|
||||
|
||||
window.location = url.toString()
|
||||
}
|
||||
|
||||
filter() {
|
||||
console.log("Filtering...")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user