mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 10:12:21 +01:00
Merge branch 'marietje-zuid' into feature/marietje-4.1-in-header
This commit is contained in:
@ -66,7 +66,7 @@
|
||||
<td class="col-md-2 d-sm-table-cell d-none">Requested By</td>
|
||||
<td class="col-md-1 text-info d-sm-table-cell d-none" style="cursor: pointer;">
|
||||
<span v-if="playsIn" id="timeswitch" class="btn btn-link p-0" v-on:click="playsIn = false">Plays In</span>
|
||||
<span v-else class="btn btn-link p-0" v-on:click="playsIn = true">Plays at</span>
|
||||
<span v-else class="btn btn-link p-0" v-on:click="playsIn = true">Plays At</span>
|
||||
</td>
|
||||
<td class="col-md-1 control-icons">Control</td>
|
||||
</tr>
|
||||
@ -93,17 +93,22 @@
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" v-if="song.can_move_up" v-on:click="move_down(queue[index-1].id)"><i
|
||||
class="fa-solid fa-arrow-up"></i></a>
|
||||
<a href="#" v-else class="invisible"><i class="fa-solid fa-arrow-up"></i></a>
|
||||
<div class="d-flex flex-column">
|
||||
<div class="d-flex flex-row">
|
||||
<button v-if="song.can_move_up" v-on:click="move_down(queue[index-1].id)" class="btn btn-link"><i
|
||||
class="fa-solid fa-arrow-up"></i></button>
|
||||
<button v-else class="btn btn-link invisible"><i class="fa-solid fa-arrow-up"></i></button>
|
||||
|
||||
<a href="#" v-if="song.can_move_down" v-on:click="move_down(song.id)"><i
|
||||
class="fa-solid fa-arrow-down"></i></a>
|
||||
<a href="#" v-else class="invisible"><i class="fa-solid fa-arrow-down"></i></a>
|
||||
|
||||
<a href="#" v-if="song.can_delete" v-on:click="cancel_song(song.id)"><i
|
||||
class="fa-solid fa-trash-can"></i></a>
|
||||
<a href="#" v-else class="invisible"><i class="fa-solid fa-trash-can"></i></a>
|
||||
<button v-if="song.can_move_down" v-on:click="move_down(song.id)" class="btn btn-link"><i
|
||||
class="fa-solid fa-arrow-down"></i></button>
|
||||
<button v-else class="btn btn-link invisible"><i class="fa-solid fa-arrow-down"></i></button>
|
||||
</div>
|
||||
<div class="d-flex flex-row">
|
||||
<button v-if="song.can_delete" v-on:click="cancel_song(song.id)" class="btn btn-link"><i
|
||||
class="fa-solid fa-trash-can"></i></button>
|
||||
<button v-else class="btn btn-link invisible"><i class="fa-solid fa-trash-can"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
@ -353,7 +358,11 @@
|
||||
"Content-Type": 'application/json',
|
||||
},
|
||||
}
|
||||
).finally(() => {
|
||||
).then(() => {
|
||||
tata.success("", "Removed song from the queue.");
|
||||
}).catch(() => {
|
||||
tata.error("", "An error occurred while removing the song, please try again.");
|
||||
}).finally(() => {
|
||||
this.refresh();
|
||||
});
|
||||
},
|
||||
@ -368,7 +377,11 @@
|
||||
"Content-Type": 'application/json',
|
||||
},
|
||||
}
|
||||
).finally(() => {
|
||||
).then(() => {
|
||||
tata.success("", "Song was moved successfully.");
|
||||
}).catch(() => {
|
||||
tata.error("", "An error occurred while moving the song, please try again.");
|
||||
}).finally(() => {
|
||||
this.refresh();
|
||||
});
|
||||
}
|
||||
@ -414,6 +427,7 @@
|
||||
this.page_size = 10;
|
||||
}
|
||||
this.page_number = 1;
|
||||
setCookie("REQUEST_PAGE_SIZE", this.page_size, 14);
|
||||
this.search();
|
||||
}
|
||||
}
|
||||
@ -425,7 +439,7 @@
|
||||
},
|
||||
created() {
|
||||
fetch(
|
||||
`/api/v1/songs/?ordering=title&limit=${this.page_size}&offset=${this.page_size * (this.page_number - 1)}`
|
||||
`/api/v1/songs/?ordering=artist,title&limit=${this.page_size}&offset=${this.page_size * (this.page_number - 1)}`
|
||||
).then(response => {
|
||||
if (response.status === 200) {
|
||||
return response.json();
|
||||
@ -444,11 +458,15 @@
|
||||
tata.error("", "An unknown error occurred, please try again.")
|
||||
}
|
||||
});
|
||||
const stored_page_size = parseInt(getCookie("REQUEST_PAGE_SIZE"));
|
||||
if (stored_page_size !== Number.NaN && stored_page_size > 0) {
|
||||
this.page_size = stored_page_size;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
fetch(
|
||||
`/api/v1/songs/?ordering=title&limit=${this.page_size}&offset=${this.page_size * (this.page_number - 1)}&search=${this.search_input}`,
|
||||
`/api/v1/songs/?ordering=artist,title&limit=${this.page_size}&offset=${this.page_size * (this.page_number - 1)}&search=${this.search_input}`,
|
||||
{
|
||||
headers: {
|
||||
"X-CSRFToken": CSRF_TOKEN,
|
||||
|
||||
Reference in New Issue
Block a user