From 40a59a4d31189e3554dac0d1541a1cd3fb5c5ffa Mon Sep 17 00:00:00 2001 From: rec <112841230+recluse4615@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:14:08 +0100 Subject: [PATCH] Adding in a carousel for packages (#475) Co-authored-by: recluse4615 --- app/public/static/js/gallery_carousel.js | 13 +++++++++ app/templates/packages/view.html | 35 +++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 app/public/static/js/gallery_carousel.js diff --git a/app/public/static/js/gallery_carousel.js b/app/public/static/js/gallery_carousel.js new file mode 100644 index 00000000..73cdf773 --- /dev/null +++ b/app/public/static/js/gallery_carousel.js @@ -0,0 +1,13 @@ +// @author recluse4615 +// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later + +"use strict"; + +const galleryCarousel = new bootstrap.Carousel(document.getElementById("galleryCarousel")); +document.querySelectorAll(".gallery-image").forEach(el => { + el.addEventListener("click", function(e) { + galleryCarousel.to(el.dataset.bsSlideTo); + e.preventDefault(); + }); +}); + diff --git a/app/templates/packages/view.html b/app/templates/packages/view.html index e29715a4..1ebc773c 100644 --- a/app/templates/packages/view.html +++ b/app/templates/packages/view.html @@ -19,6 +19,7 @@ {% block scriptextra %} + {% if current_user.is_authenticated %} {% endif %} @@ -76,6 +77,7 @@ {% elif not package.media_license.is_foss %} {% set package_warning=_("Non-free media") %} {% endif %} +
{% if not package.approved %}
@@ -248,6 +250,37 @@ {% endif %} {% if screenshots or package.check_perm(current_user, "ADD_SCREENSHOTS") or package.video_url %} + {% if screenshots %} + + {% endif %}