From 33379408bade3c1ceddbdde9db33c336a2d4a240 Mon Sep 17 00:00:00 2001 From: Denis Istratov Date: Thu, 9 Apr 2026 22:35:56 +0300 Subject: [PATCH] hw-2 fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - На лого слева вверху добавлена ссылка на главную - Добавлен механизм отображения вопросов по тегу - Теперь теги берутся из списка в контроллере - Теперь при нажатии на тег открывается страница вопросов по тегу - Добавлена страница hot questions - При нажатии на название вопроса теперь открывается страница вопроса - Улучшена пагинация --- questions/static/core/css/style.css | 19 +++ questions/templates/core/base.html | 140 ------------------ questions/templates/core/hot.html | 16 ++ questions/templates/core/index.html | 9 +- questions/templates/core/layout/base.html | 13 +- .../templates/core/partials/pagination.html | 6 +- .../templates/core/partials/question.html | 7 +- questions/urls.py | 1 + questions/views.py | 27 +++- 9 files changed, 75 insertions(+), 163 deletions(-) delete mode 100644 questions/templates/core/base.html create mode 100644 questions/templates/core/hot.html diff --git a/questions/static/core/css/style.css b/questions/static/core/css/style.css index 3400af1..236b684 100644 --- a/questions/static/core/css/style.css +++ b/questions/static/core/css/style.css @@ -204,6 +204,10 @@ a:hover { box-shadow: 0.25rem 0.25rem 0 rgba(31, 45, 58, 0.08); } +.not-underlined { + text-decoration: none; +} + .sidebar h2 { margin: 0 0 0.5rem; font-size: 1.25rem; @@ -307,6 +311,21 @@ a:hover { margin-top: 0.4rem; } +.current-tag { + display: inline-block; + border: 0.125rem solid #1f2d3a; + background: #f2f7f7; + padding: 0.25rem 0.6rem; + margin-bottom: 0.6rem; + font-size: 0.85rem; + box-shadow: 0.2rem 0.2rem 0 rgba(31, 45, 58, 0.08); +} + +.current-tag span { + color: #1d57d4; + font-weight: 700; +} + .footer { border-top: 0.125rem solid #1f2d3a; padding: 0.6rem 1.1rem; diff --git a/questions/templates/core/base.html b/questions/templates/core/base.html deleted file mode 100644 index 92f7d13..0000000 --- a/questions/templates/core/base.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - VkDesk | Fresh Questions - - - - - - -
-
-
-

Fresh Questions

- Top Today -
- - - - - - - - -
- - -
- - - - - - - - - - diff --git a/questions/templates/core/hot.html b/questions/templates/core/hot.html new file mode 100644 index 0000000..f53825e --- /dev/null +++ b/questions/templates/core/hot.html @@ -0,0 +1,16 @@ +{% extends 'core/layout/base.html' %} +{% load static %} + +{% block content %} +
+

Hot Questions

+ All questions +
+ +{% for question in hot_questions %} +{% include 'core/partials/question.html' %} +{% endfor %} +{% include 'core/partials/pagination.html' %} + + +{% endblock %} \ No newline at end of file diff --git a/questions/templates/core/index.html b/questions/templates/core/index.html index f02ca7b..1349e12 100644 --- a/questions/templates/core/index.html +++ b/questions/templates/core/index.html @@ -3,10 +3,15 @@ {% block content %}
-

Fresh Questions

- Top Today +

All Questions

+ Hot questions
+{% if tag %} +
+ Текущий тег: #{{ tag }} +
+{% endif %} {% for question in questions %} {% include 'core/partials/question.html' %} {% endfor %} diff --git a/questions/templates/core/layout/base.html b/questions/templates/core/layout/base.html index fe858a2..2b2ad3e 100644 --- a/questions/templates/core/layout/base.html +++ b/questions/templates/core/layout/base.html @@ -9,7 +9,7 @@