Add main homepage

This commit is contained in:
Nyymix 2025-04-25 20:49:41 +03:00
parent 59a4ffc4ff
commit 4436042738
3 changed files with 95 additions and 3 deletions

View file

@ -0,0 +1,79 @@
{% extends "base.html" %}
{% load static %}
{% load image_tags %}
<!-- Title -->
{% block title %} Home {% endblock %}
<!-- Parallax -->
{% block parallax %}
{% include "./partials/parallax.html" %}
{% endblock %}
<!-- Content -->
{% block content %}
<!-- Favorite random portrait photos -->
{% load top_tags %}
{% random_favorite_photos_portrait 10 as top_portrait_photos %}
{% if top_portrait_photos %}
<div uk-slider>
<div class="uk-position-relative uk-visible-toggle uk-light" tabindex="-1">
<div class="uk-slider-items uk-child-width-1-2 uk-child-width-1-3@s uk-child-width-1-4@m">
{% for photo in top_portrait_photos %}
<div>
<a href="{{ photo.get_absolute_url }}">
<img src="{{ photo.photo_md.url }}" alt="{{ photo.album.slug }}" width="400" height="600" style="object-fit: cover;">
</a>
</div>
{% endfor %}
</div>
<a class="uk-position-center-left uk-position-small uk-hidden-hover" href uk-slidenav-previous uk-slider-item="previous"></a>
<a class="uk-position-center-right uk-position-small uk-hidden-hover" href uk-slidenav-next uk-slider-item="next"></a>
</div>
<ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin"></ul>
</div>
{% endif %}
<!-- Latest albums -->
<div class="uk-grid-small uk-child-width-1-2@s uk-child-width-1-3@m" uk-grid="masonry: true">
{% for album in latest_albums %}
<div>
<div class="uk-card uk-card-default uk-height-1-1">
<!-- Album cover image -->
<div class="uk-card-media-top">
<a href="{{ album.get_absolute_url }}">
{% with album|cover_image_data as img %}
<img
src="{{ img.url }}"
width="{{ img.width }}"
height="{{ img.height }}"
style="aspect-ratio: {{ img.aspect_ratio }};"
alt="Cover image for {{ album.name }}"
title="{{ album.name }}"
loading="lazy">
{% endwith %}
</a>
</div>
<!-- Album info overlay -->
<div class="uk-overlay uk-overlay-primary uk-position-bottom uk-padding-small">
<h3 class="uk-card-title uk-margin-remove-bottom">
<a href="{{ album.get_absolute_url }}">{{ album }}</a>
</h3>
<p class="uk-text-small uk-margin-remove-top">
{{ album.photos_in_album }} photos &bull;
{{ album.photos_views }} views
</p>
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}