feat: application screenshots added, and file size calculated

This commit is contained in:
Денис Братусев committed 2026-10-28 12:54:47 +03:00
1 parent 196d1e2ed7
commit 62d9ad1965
7 files changed
+180 -3

No files matched your search

+115
View File
@@ -0,0 +1,115 @@
{% extends "games/base.html" %}
{% block title %}{{ game.title }} — SKB Market{% endblock %}
{% block content %}
<div class="container py-4">
<a href="{% url 'game_list' %}" class="btn btn-outline-secondary mb-4">
&larr; Назад к каталогу
</a>
<div class="card border-0 shadow-sm">
<div class="card-body p-4">
<div class="row g-4 align-items-start">
<div class="col-12 col-md-4 col-lg-3">
{% if game.icon %}
<img
src="{{ game.icon.url }}"
alt="Иконка {{ game.title }}"
class="img-fluid rounded"
style="width: 100%; max-width: 240px; aspect-ratio: 1; object-fit: cover;"
>
{% else %}
<div class="bg-light rounded d-flex align-items-center justify-content-center"
style="width: 100%; max-width: 240px; aspect-ratio: 1;">
Нет иконки
</div>
{% endif %}
</div>
<div class="col-12 col-md-8 col-lg-9">
<h1 class="h2 mb-3">{{ game.title }}</h1>
{% if game.author_name %}
<p class="text-muted mb-2">
Автор / команда: {{ game.author_name }}
</p>
{% endif %}
{% if game.short_description %}
<p class="lead">{{ game.short_description }}</p>
{% endif %}
<div class="d-flex flex-wrap gap-2 mb-3">
<span class="badge text-bg-primary">
Версия {{ game.version }}
</span>
{% if game.unity_version %}
<span class="badge text-bg-secondary">
Unity {{ game.unity_version }}
</span>
{% endif %}
</div>
<p class="text-muted small mb-1">
Обновлено: {{ game.updated_at|date:"d.m.Y H:i" }}
</p>
<p class="text-muted small">
Скачиваний: {{ game.download_count }}
</p>
</div>
</div>
<hr class="my-4">
<h2 class="h4">Об приложении</h2>
<div class="mb-4">{{ game.description|linebreaks }}</div>
{% with screenshots=game.screenshots.all %}
{% if screenshots %}
<hr class="my-4">
<h2 class="h4 mb-3">Скриншоты</h2>
<div class="row g-3">
{% for screenshot in screenshots %}
<div class="col-12 col-sm-6 col-lg-4">
<a href="{{ screenshot.image.url }}" target="_blank" rel="noopener">
<img
src="{{ screenshot.image.url }}"
alt="Скриншот {{ game.title }}"
class="img-fluid rounded shadow-sm"
style="width: 100%; height: 220px; object-fit: cover;"
>
</a>
</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<h2 class="h5">Файл приложения</h2>
<p>
Размер:
{% if game.file_size %}
{{ game.file_size|filesizeformat }}
{% else %}
Пока не определён
{% endif %}
</p>
{% if game.file %}
<a href="{% url 'game_download' game.pk %}" class="btn btn-primary">
Скачать приложение
</a>
{% else %}
<p class="text-muted">Файл пока не загружен.</p>
{% endif %}
</div>
</div>
</div>
{% endblock %}
@@ -38,7 +38,6 @@
{% endif %}
<div class="flex-grow-1">
<h5 class="card-title mb-1">{{ game.title }}</h5>
<small class="text-muted">{{ game.size_mb }} МБ</small>
</div>
</div>
<p class="card-text text-muted small">{{ game.short_description }}</p>