mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Merge pull request #850 from ae-utbm/sas-history
Fix history navigation bug in picture viewer in sas
This commit is contained in:
commit
67af1485b3
@ -38,7 +38,7 @@
|
|||||||
<h4 x-text="album"></h4>
|
<h4 x-text="album"></h4>
|
||||||
<div class="photos">
|
<div class="photos">
|
||||||
<template x-for="picture in pictures">
|
<template x-for="picture in pictures">
|
||||||
<a :href="`/sas/picture/${picture.id}#pict`">
|
<a :href="`/sas/picture/${picture.id}`">
|
||||||
<div
|
<div
|
||||||
class="photo"
|
class="photo"
|
||||||
:class="{not_moderated: !picture.is_moderated}"
|
:class="{not_moderated: !picture.is_moderated}"
|
||||||
|
@ -137,7 +137,12 @@ document.addEventListener("alpine:init", () => {
|
|||||||
this.current_picture = this.pictures.find(
|
this.current_picture = this.pictures.find(
|
||||||
(i) => i.id === first_picture_id,
|
(i) => i.id === first_picture_id,
|
||||||
);
|
);
|
||||||
this.$watch("current_picture", () => this.update_picture());
|
this.$watch("current_picture", (current, previous) => {
|
||||||
|
if (current === previous){ /* Avoid recursive updates */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.update_picture();
|
||||||
|
});
|
||||||
window.addEventListener("popstate", async (event) => {
|
window.addEventListener("popstate", async (event) => {
|
||||||
if (!event.state || event.state.sas_picture_id === undefined) {
|
if (!event.state || event.state.sas_picture_id === undefined) {
|
||||||
return;
|
return;
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
<h4>{% trans %}Pictures{% endtrans %}</h4>
|
<h4>{% trans %}Pictures{% endtrans %}</h4>
|
||||||
<div class="photos" :aria-busy="loading">
|
<div class="photos" :aria-busy="loading">
|
||||||
<template x-for="picture in pictures.results">
|
<template x-for="picture in pictures.results">
|
||||||
<a :href="`/sas/picture/${picture.id}#pict`">
|
<a :href="`/sas/picture/${picture.id}`">
|
||||||
<div
|
<div
|
||||||
class="photo"
|
class="photo"
|
||||||
:class="{not_moderated: !picture.is_moderated}"
|
:class="{not_moderated: !picture.is_moderated}"
|
||||||
|
Loading…
Reference in New Issue
Block a user