diff --git a/core/models.py b/core/models.py index 3803e3ca..1f5b2109 100644 --- a/core/models.py +++ b/core/models.py @@ -982,7 +982,7 @@ class SithFile(models.Model): return True if self.is_in_sas and user.is_in_group(pk=settings.SITH_GROUP_SAS_ADMIN_ID): return True - return user.id == self.owner.id + return user.id == self.owner_id def can_be_viewed_by(self, user): if hasattr(self, "profile_of"): diff --git a/core/static/core/js/script.js b/core/static/core/js/script.js index 1ab7887e..f2c365ff 100644 --- a/core/static/core/js/script.js +++ b/core/static/core/js/script.js @@ -65,3 +65,21 @@ function display_notif() { function getCSRFToken() { return $("[name=csrfmiddlewaretoken]").val(); } + + +const initialUrlParams = new URLSearchParams(window.location.search); + +function update_query_string(key, value) { + const url = new URL(window.location.href); + if (!value) { + // If the value is null, undefined or empty => delete it + url.searchParams.delete(key) + } else if (Array.isArray(value)) { + + url.searchParams.delete(key) + value.forEach((v) => url.searchParams.append(key, v)) + } else { + url.searchParams.set(key, value); + } + history.pushState(null, document.title, url.toString()); +} diff --git a/core/static/core/pagination.scss b/core/static/core/pagination.scss index 2d3f3a8d..911018a4 100644 --- a/core/static/core/pagination.scss +++ b/core/static/core/pagination.scss @@ -3,6 +3,7 @@ .pagination { text-align: center; gap: 10px; + margin: 30px; button { background-color: $secondary-neutral-light-color; diff --git a/core/static/core/style.scss b/core/static/core/style.scss index 3ba0f569..b08be5fb 100644 --- a/core/static/core/style.scss +++ b/core/static/core/style.scss @@ -93,6 +93,32 @@ a:not(.button) { } } +[aria-busy] { + --loading-size: 50px; + --loading-stroke: 5px; + --loading-duration: 1s; + position: relative; +} + +[aria-busy]:after { + content: ''; + position: absolute; + top: 50%; + left: 50%; + width: var(--loading-size); + height: var(--loading-size); + margin-top: calc(var(--loading-size) / 2 * -1); + margin-left: calc(var(--loading-size) / 2 * -1); + border: var(--loading-stroke) solid rgba(0, 0, 0, .15); + border-radius: 50%; + border-top-color: rgba(0, 0, 0, 0.5); + animation: rotate calc(var(--loading-duration)) linear infinite; +} + +@keyframes rotate { + 100% { transform: rotate(360deg); } +} + .ib { display: inline-block; padding: 1px; diff --git a/core/static/sas/album.scss b/core/static/sas/album.scss index 7b744183..e3c3527a 100644 --- a/core/static/sas/album.scss +++ b/core/static/sas/album.scss @@ -102,20 +102,10 @@ main { border-radius: 10px; } -.paginator { - display: flex; - justify-content: center; - gap: 10px; - width: -moz-fit-content; - width: fit-content; - background-color: rgba(0,0,0,.1); - border-radius: 10px; - padding: 10px; - margin: 10px 0 10px auto; -} - .photos, .albums { + margin: 20px; + min-height: 50px; // To contain the aria-busy loading wheel, even if empty box-sizing: border-box; display: flex; flex-direction: row; @@ -161,17 +151,13 @@ main { > .album { box-sizing: border-box; background-color: #333333; - background-size: cover; + background-size: contain; background-repeat: no-repeat; background-position: center center; width: calc(16 / 9 * 128px); height: 128px; - &.vertical { - background-size: contain; - } - margin: 0; padding: 0; box-shadow: none; diff --git a/core/templates/core/user_pictures.jinja b/core/templates/core/user_pictures.jinja index ae01ef87..c3815552 100644 --- a/core/templates/core/user_pictures.jinja +++ b/core/templates/core/user_pictures.jinja @@ -23,7 +23,7 @@