Moona/templates/main.html
2022-04-27 22:15:58 +05:00

250 lines
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<link rel="stylesheet" href="../static/css/main.css">
{% extends "base.html" %}
{% block content %}
<table class="but">
<tr>
<td style="width: 110%;">
<h1 class="upp_zag">Главная</h1>
</td>
<td>
<a href="/add_post" id="add_post" class="btn btn-primary"
style="background-color:#1daff0;border-radius: 15px;"><strong>Добавить
запись</strong></a>
</td>
</tr>
</table>
<table id="main_table">
<td class="row1">
<div class="rowdiv1">
{% if current_user.is_authenticated %}
<h2 class="my_post_zag" style="margin-left:15%">Вопросы дня</h2>
<div class="my_post">
<div class="question">
{% for item in question %}
<a href="/answer_quest/{{item.id}}" class="btn quest_block">
{% if item.id in ans %}
<div class="is_ans">
<strong>{{item.quest}}</strong>
<div class="alert alert-success" role="alert" style="border-radius: 25px;">Ответ есть</div>
<strong>{{ans[item.id].answer}}</strong>
</div>
{% else %}
<div class="is_ans">
<strong>{{item.quest}}</strong>
<div class="alert alert-danger" role="alert" style="border-radius: 25px;">Ответа нет</div>
</div>
{% endif %}
</a>
{% endfor %}
</div>
</div>
{% else %}
<p>Чтобы увидеть вопросы дня войдите в аккаунт</p>
{% endif %}
</div>
</td>
<td class="row2">
<div class="rowdiv2">
<h2 class="post_zag" style="margin-top:-20%">Вам будет интересно</h2>
{% if for_me_post != [] %}
{% for item in for_me_post %}
<div class="card" style="width: 25rem;">
{% if item.photo != None %}
<img src="{{ item.photo }}" class="card-img-top" alt="...">
{% endif %}
<div class="card-body">
{% if item.name != None %}
<h4 class="card-title" style="color: #c5f1ff">{{item.name}}</h4>
{% endif %}
<p><small>{{item.date}}</small></p>
{% if item.text != None %}
<p class="card-text">{{item.text}}</p>
{% endif %}
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
{% if emotion_for_you[loop.index0]['pos_emot'] != None %}
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%;">
{% for item2 in emotion_for_you[loop.index0]['pos_emot'] %}
<li>
<div class="emot"><strong class="alert alert-success" role="alert"
style="border-radius: 22px;">{{item2}}</strong></div>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
<li class="list-group-item">
{% if emotion_for_you[loop.index0]['nig_emot'] != None %}
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%">
{% for item2 in emotion_for_you[loop.index0]['nig_emot'] %}
<li>
<div class="emot"><strong class="alert alert-danger" role="alert"
style="border-radius: 22px;">{{item2}}</strong></div>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
<li class="list-group-item">
{% if emotion_for_you[loop.index0]['link'] != None %}
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%; margin-bottom:5%">
{% for item2 in emotion_for_you[loop.index0]['link'] %}
<li>
<div class="emot"><a class="alert alert-light" role="alert" href="{{ item2 }}" style="border-radius: 22px;">Ссылка
{{ loop.index }}</a></div>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
</ul>
<div class="card-body">
{% if item.public == 1 or item.public == 'True' %}
<div style="border-radius: 22px; margin-left:-5%; width: 50%" class="alert alert-success pub" role="alert">Запись
опубликована
</div>
{% else %}
<div style="border-radius: 22px; margin-left:-5% width: 50%" class="alert alert-danger private" role="alert">Запись
приватная
</div>
{% endif %}
<div class="my_author"><img src="../{{ current_user.photo }}" width="40" height="40"
style="border-radius: 22px">
<strong style="color: #ffffff">{{ current_user.name }}</strong>
</div>
<div class="like" style="margin-top:5%; margin-left:1%">
<a type="button"
href="/new_like/{{current_user.id}}/{{item.id}}/diary">
{% if emotion_for_you[loop.index0]['is_like'] %}
<img src="../static/img/like_add.png" width="117" height="100">
{% else %}
<img src="../static/img/like.png" width="94" height="80">
{% endif %}
</a>
{% if emotion_for_you[loop.index0]['like'] != None %}
<p style="color:#ffffff; margin-left:30%">{{emotion_for_you[loop.index0]['like']}}</p>
{% endif %}
</div>
<div>
<a style="border-radius: 15px; margin-top:10%; margin-left:1%" href="/post/{{ item.id }}" class="btn" id="edit_btn">
Изменить
</a>
<a style="border-radius: 15px; margin-top:10%" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
Удалить
</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="bad_centre" style="background-color:#1daff0; border-radius: 22px;color:#ffffff">
<p class="hz1">Ничего не нашлось :с</p>
</div>
{% endif %}
</div>
</td>
<td class="row3">
<div class="rowdiv3">
<h2 class="post_zag" style="margin-top:-20%; margin-left:5%">Вам понравилось</h2>
{% if you_like_that != [] %}
{% for item in you_like_that %}
<div class="card" style="width: 25rem;">
{% if item.photo != None %}
<img src="{{ item.photo }}" class="card-img-top" alt="...">
{% endif %}
<div class="card-body">
{% if item.name != None %}
<h4 class="card-title" style="color: #c5f1ff">{{item.name}}</h4>
{% endif %}
<p><small>{{item.date}}</small></p>
{% if item.text != None %}
<p class="card-text">{{item.text}}</p>
{% endif %}
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
{% if emotion_you_like_that[loop.index0]['pos_emot'] != None %}
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%;">
{% for item2 in emotion_you_like_that[loop.index0]['pos_emot'] %}
<li>
<div class="emot"><strong class="alert alert-success" role="alert"
style="border-radius: 22px;">{{item2}}</strong></div>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
<li class="list-group-item">
{% if emotion_you_like_that[loop.index0]['nig_emot'] != None %}
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%">
{% for item2 in emotion_you_like_that[loop.index0]['nig_emot'] %}
<li>
<div class="emot"><strong class="alert alert-danger" role="alert"
style="border-radius: 22px;">{{item2}}</strong></div>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
<li class="list-group-item">
{% if emotion_you_like_that[loop.index0]['link'] != None %}
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%; margin-bottom:5%">
{% for item2 in emotion_you_like_that[loop.index0]['link'] %}
<li>
<div class="emot"><a class="alert alert-light" role="alert" href="{{ item2 }}" style="border-radius: 22px;">Ссылка
{{ loop.index }}</a></div>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
</ul>
<div class="card-body">
{% if item.public == 1 or item.public == 'True' %}
<div style="border-radius: 22px; margin-left:-5%; width: 50%" class="alert alert-success pub" role="alert">Запись
опубликована
</div>
{% else %}
<div style="border-radius: 22px; margin-left:-5% width: 50%" class="alert alert-danger private" role="alert">Запись
приватная
</div>
{% endif %}
<div class="my_author"><img src="../{{ current_user.photo }}" width="40" height="40"
style="border-radius: 22px">
<strong style="color: #ffffff">{{ current_user.name }}</strong>
</div>
<div class="like" style="margin-top:5%; margin-left:1%">
<a type="button"
href="/new_like/{{current_user.id}}/{{item.id}}/diary">
{% if emotion_you_like_that[loop.index0]['is_like'] %}
<img src="../static/img/like_add.png" width="117" height="100">
{% else %}
<img src="../static/img/like.png" width="94" height="80">
{% endif %}
</a>
{% if emotion_you_like_that[loop.index0]['like'] != None %}
<p style="color:#ffffff; margin-left:30%">{{emotion_you_like_that[loop.index0]['like']}}</p>
{% endif %}
</div>
<div>
<a style="border-radius: 15px; margin-top:10%; margin-left:1%" href="/post/{{ item.id }}" class="btn" id="edit_btn1">
Изменить
</a>
<a style="border-radius: 15px; margin-top:10%" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
Удалить
</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="bad_centre" style="background-color:#1daff0; border-radius: 22px;color:#ffffff">
<p class="hz1">Ничего не нашлось :с</p>
</div>
{% endif %}
</div>
</td>
</table>
{% endblock %}