60 lines
1.1 KiB
JavaScript
60 lines
1.1 KiB
JavaScript
// 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...")
|
|
}
|
|
|
|
}
|