From 5b740c845c9ab70a7c4308ea898103e03db0a9ab Mon Sep 17 00:00:00 2001 From: imperosol Date: Thu, 20 Feb 2025 15:04:33 +0100 Subject: [PATCH] typescriptify album-index.js --- sas/static/bundled/sas/album-index.ts | 9 +++------ sas/templates/sas/album.jinja | 8 ++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sas/static/bundled/sas/album-index.ts b/sas/static/bundled/sas/album-index.ts index ff0976d9..02a744b6 100644 --- a/sas/static/bundled/sas/album-index.ts +++ b/sas/static/bundled/sas/album-index.ts @@ -1,10 +1,6 @@ import { paginated } from "#core:utils/api"; import { History, initialUrlParams, updateQueryString } from "#core:utils/history"; -import { - type PictureSchema, - type PicturesFetchPicturesData, - picturesFetchPictures, -} from "#openapi"; +import { type PictureSchema, type PicturesFetchPicturesData, picturesFetchPictures } from "#openapi"; interface AlbumConfig { albumId: number; @@ -17,12 +13,14 @@ document.addEventListener("alpine:init", () => { page: Number.parseInt(initialUrlParams.get("page")) || 1, pushstate: History.Push /* Used to avoid pushing a state on a back action */, loading: false, + config: config, async init() { await this.fetchPictures(); this.$watch("page", () => { updateQueryString("page", this.page === 1 ? null : this.page, this.pushstate); this.pushstate = History.Push; + this.fetchPictures(); }); window.addEventListener("popstate", () => { @@ -30,7 +28,6 @@ document.addEventListener("alpine:init", () => { this.page = Number.parseInt(new URLSearchParams(window.location.search).get("page")) || 1; }); - this.config = config; }, getPage(page: number) { diff --git a/sas/templates/sas/album.jinja b/sas/templates/sas/album.jinja index 172e81ab..cb81d7b1 100644 --- a/sas/templates/sas/album.jinja +++ b/sas/templates/sas/album.jinja @@ -64,11 +64,7 @@
{% endif %} -
- +
{{ download_button(_("Download album")) }}

{% trans %}Pictures{% endtrans %}

@@ -94,7 +90,7 @@
- {{ paginate_alpine("page", "nbPages()") }} + {{ paginate_alpine("page", "nbPages()") }}
{% if is_sas_admin %}