- Monitoring chapters
- possibilities for ToolBarButton.html.twig to have tailwind classes see ChapterListToolbar.php
- Makefile scheduler command
- Makefile make:message command
This commit is contained in:
Jérémy Guillot
2024-07-20 19:40:48 +02:00
parent 7fc2f15f6b
commit ff59aa5d77
21 changed files with 818 additions and 283 deletions

View File

@@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
import { visit } from "@hotwired/turbo"
export default class extends Controller {
static targets = ["dropdown", "icon"]
static targets = ["dropdown", "icon", "text"]
static values = {
currentSort: String,
currentOrder: String,
@@ -51,6 +51,40 @@ export default class extends Controller {
console.log("Importing...");
}
monitoring(event){
const mangaId = event.currentTarget.dataset.mangaid;
const currentTarget = event.currentTarget;
const url = `/toggle_monitored`;
fetch(url, {
method: 'POST',
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/json',
},
body: JSON.stringify({ mangaId: mangaId })
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
}).then(data => {
if(data.isMonitored === true){
currentTarget.classList.remove('text-white');
currentTarget.classList.add('text-green-500');
this.textTarget.innerHTML = "Monitored";
}else if(data.isMonitored === false){
currentTarget.classList.remove('text-green-500');
currentTarget.classList.add('text-white');
this.textTarget.innerHTML = "Monitoring";
}
// console.log(data.isMonitored);
});
}
editMangas() {
console.log("Editing mangas...");
}