Много всякого дизайна

This commit is contained in:
Vinejar
2025-03-31 06:05:09 +03:00
parent dfd9a8e32e
commit a6c3740a41
4 changed files with 112 additions and 18 deletions

View File

@@ -2,15 +2,27 @@ from django.shortcuts import render
from .models import manga_collection from .models import manga_collection
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.shortcuts import render
from .models import manga_collection
from django.core.paginator import Paginator
def manga_catalog(request): def manga_catalog(request):
# Получаем все записи
all_manga = list(manga_collection.find({})) all_manga = list(manga_collection.find({}))
# Создаем пагинатор
paginator = Paginator(all_manga, 20) paginator = Paginator(all_manga, 20)
page_number = request.GET.get('page') page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number) page_obj = paginator.get_page(page_number)
# Получаем общее количество манги в базе
total_manga_count = manga_collection.count_documents({})
return render(request, 'manga_catalog.html', { return render(request, 'manga_catalog.html', {
'page_obj': page_obj, 'page_obj': page_obj,
'manga_list': page_obj.object_list 'manga_list': page_obj.object_list,
'total_manga_count': total_manga_count # Добавляем счетчик в контекст
}) })
def show_manga(request, manga_id): def show_manga(request, manga_id):

View File

@@ -1,12 +1,13 @@
{% load static %} {% load static %}
<link rel="stylesheet" href="{% static 'css/manga_catalog.css' %}"> <link rel="stylesheet" href="{% static 'css/manga_catalog.css' %}">
<div class="catalog-header">
<div class="catalog-container"> <h1 class="title-site">Дроч.кам</h1>
<div > <h5 class="titles-cont">Манги на сайте: {{ total_manga_count }}</h5>
<h1>Каталог манги</h1>
</div> </div>
<div class="catalog-container">
<div class="manga-list"> <div class="manga-list">
@@ -33,7 +34,7 @@
<h3>{{ manga.original_title }}</h3> <h3>{{ manga.original_title }}</h3>
</div> </div>
<!-- Теги возвращены наверх --> <!-- Теги -->
{% if manga.tags %} {% if manga.tags %}
<div class="tags"> <div class="tags">
{% for tag in manga.tags %} {% for tag in manga.tags %}
@@ -47,7 +48,27 @@
<span class="meta-label">Страниц:</span> <span class="meta-label">Страниц:</span>
<span class="meta-value">{{ manga.len_manga }}</span> <span class="meta-value">{{ manga.len_manga }}</span>
</div> </div>
<div class="meta-row">
<div class="date-post">
<span class="date-label">Дата:</span>
<span class="date-value">{{ manga.date }}</span>
</div> </div>
{% if manga.manga_link %}
<a href="{{ manga.manga_link }}" target="_blank" class="read-original-button">
Читать в источнике
</a>
{% endif %}
</div>
</div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}

View File

@@ -6,6 +6,38 @@ body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
} }
.catalog-header {
min-height: 50px;
display: flex;
position: sticky;
top: 0;
width: 100%;
height: 5%;
background-color: #3987cf;
z-index: 1000;
align-items: center;
justify-content: space-between; /* Распределяет пространство между элементами */
padding: 0 20px; /* Добавляем отступы по бокам */
}
.title-site {
color: #ffffff;
position: absolute; /* Абсолютное позиционирование */
left: 50%; /* Сдвигаем на 50% вправо */
transform: translateX(-50%); /* Корректируем положение на половину своей ширины */
margin: 0; /* Убираем стандартные отступы */
}
.titles-cont {
position: absolute;
color: #ffffff;
left: 65%;
}
.catalog-container { .catalog-container {
max-width: 50%; max-width: 50%;
margin: 0 auto; margin: 0 auto;
@@ -41,6 +73,7 @@ body {
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
display: block; display: block;
box-shadow: 0 0 15px #39accf;
} }
/* Кнопка "Читать" поверх изображения */ /* Кнопка "Читать" поверх изображения */
@@ -50,16 +83,41 @@ body {
left: 0; left: 0;
right: 0; right: 0;
padding: 12px 0; padding: 12px 0;
background: rgba(74, 137, 220, 0.9); background: #2478c2;
color: white; color: white;
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
transition: background 0.3s; transition: background 0.3s;
} }
/* Строка с мета-информацией */
.meta-row {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
margin-top: auto;
}
/* Кнопка "Читать в источнике" */
.read-original-button {
padding: 6px 12px;
background: #6497c5;
color: white;
text-decoration: none;
border-radius: 4px;
font-size: 14px;
transition: background 0.3s;
white-space: nowrap;
margin-left: 15px;
}
.read-original-button:hover {
background: #5a6268;
}
.read-button:hover { .read-button:hover {
background: rgba(59, 125, 216, 0.95); background: #2478c2;
} }
/* Информация справа */ /* Информация справа */
@@ -71,6 +129,9 @@ body {
} }
.manga-title h3 { .manga-title h3 {
width: 100%;
padding-bottom: 3px;
border-bottom: 1px solid #3987cf;
margin: 0 0 8px 0; margin: 0 0 8px 0;
color: #333; color: #333;
font-size: 20px; font-size: 20px;
@@ -101,12 +162,13 @@ body {
margin-bottom: 10px; margin-bottom: 10px;
} }
.meta-label { .manga-meta{
font-weight: bold; font-weight: bold;
color: #555; color: #555;
margin-right: 5px; margin-right: 5px;
} }
/* Адаптивность */ /* Адаптивность */
@media (max-width: 768px) { @media (max-width: 768px) {
.catalog-container { .catalog-container {

View File

@@ -16,7 +16,7 @@ body {
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
align-items: center; align-items: center;
background-color: green; background-color: #ffffff;
justify-content: center; justify-content: center;
@@ -26,9 +26,8 @@ body {
min-height: 100vh; min-height: 100vh;
width: 50%; width: 50%;
place-items: center; place-items: center;
background-color: white; background-color: #cee6fd;
flex-direction: column; flex-direction: column;
border: dashed white;
} }
@@ -37,7 +36,7 @@ body {
padding: 15px 0; padding: 15px 0;
margin-bottom: 0; margin-bottom: 0;
width: 100%; width: 100%;
border-bottom: dashed green; border-bottom: dashed #ffffff;
} }
@@ -134,7 +133,7 @@ body {
align-items: center; align-items: center;
gap: 15px; gap: 15px;
width: 100%; width: 100%;
border-top: dashed green; border-top: dashed #ffffff;
} }