minor changes

This commit is contained in:
aneuhmanh 2025-02-17 00:22:28 +02:00
parent 8ccb3c634f
commit e06e10f5e6
6 changed files with 99 additions and 142 deletions

2
.gitignore vendored
View File

@ -6,3 +6,5 @@
/static/posts/
/static/thumbnails/
/static/videos/
/venv/
/__pycache__/

View File

@ -3,6 +3,9 @@
**Приватный репозиторий для разработки и тестирования новых версий веб-приложения artberry**
------------
### используемые технологии
#### backend:
- ##### ЯП: [Python](http://https://www.python.org/ "Python")
@ -14,4 +17,32 @@
- ##### CSS
- ##### JAVASCRIPT
------------
#### ЗАПУСК И ТЕСТИРОВАНИЕ
**Для удобства и скорости разработки выполните следующие шаги:**
#### создайте виртуальное окружение:
`python -m venv venv`
#### запустите виртуальное окружение:
WINDOWS:
**powershell: **` .\venv\Scripts\Activate`
**CMD: **`venv\Scripts\activate.bat`
LINUX | MAC:
`source venv/bin/activate`
#### установите зависимости:
`pip install -r requirements.txt`
#### запустите проект
`python app.py` или `flask run`
##### Для отладки в конце файла `app.py` измените:
`app.run(debug=False)` **на:** `app.run(debug=True)`
------------

BIN
requirements.txt Normal file

Binary file not shown.

View File

@ -78,9 +78,6 @@ body {
margin-top: 10px;
margin-bottom: 10px;
}
nav .button:hover {
background-color: #9a6fa0;
}
a {
color:yellow;
text-decoration: none;
@ -180,28 +177,6 @@ header {
.input-field::placeholder {
color: #DDDDDD;
}
nav {
display: flex;
justify-content: center;
align-items: center;
background-color: #6a4664;
width: 100%;
height: 60px;
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
z-index: 1000;
}
nav .button {
padding: 10px 45px;
text-decoration: none;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
background-color: #845e80;
}
footer {
display: flex;
justify-content: center;

View File

@ -14,57 +14,20 @@
</head>
<body>
<nav class="nav">
<div class="nav-buttons">
{% if content_type == 'art' %}
{% if current_user.is_authenticated %}
<a href="{{ url_for('upload') }}" class="button">Upload</a>
{% endif %}
<a href="{{ url_for('videos') }}" class="button">Videos</a>
<a href="{{ url_for('comics') }}" class="button">Comics</a>
{% elif content_type == 'video' %}
{% if current_user.is_authenticated %}
<a href="{{ url_for('upload_video') }}" class="button">Upload</a>
{% endif %}
<a href="{{ url_for('index') }}" class="button">Arts</a>
<a href="{{ url_for('comics') }}" class="button">Comics</a>
{% elif content_type == 'comic' %}
{% if current_user.is_authenticated %}
<a href="{{ url_for('comic_upload') }}" class="button">Upload</a>
{% endif %}
<a href="{{ url_for('index') }}" class="button">Arts</a>
<a href="{{ url_for('videos') }}" class="button">Videos</a>
{% endif %}
{% if current_user.is_authenticated %}
<a href="{{ url_for('logout') }}" class="button">Logout</a>
<a href="{{ url_for('shop') }}" class="button">{{ user_cookies }} 🍪</a>
{% else %}
<a href="{{ url_for('register') }}" class="button">Register</a>
<a href="{{ url_for('login') }}" class="button">Login</a>
{% endif %}
</div>
</nav>
{% include 'navbar.html' %}
<header class="header">
<h1 class="title"><a href="{{url_for('index')}}" style="color:white;">🫐artberry🫐</a></h1>
<form method="GET"
action="{{ search_url if search_url else url_for(request.endpoint, pub_type=pub_type, username=username) }}"
class="search-form">
<input type="text" name="search" id="search-input" placeholder="Search by tags"
class="input-field search-field" autocomplete="off">
<button type="submit" class="button search-button">Search</button>
</form>
<!-- </form>
<div id="autocomplete-suggestions" class="autocomplete-suggestions"></div>
</form>
подсказки будут добавлены позже -->
</header>
<section class="content" id="content">
{% block content %}
{% if content_type == 'art' or content_type == 'video' or content_type == 'comic' %}
{% if content_type in ['art', 'video', 'comic'] %}
<div class="{{ content_type }}-details">
<h2>{{ content.title }}</h2>
{% if content_type == 'art' %}
@ -83,57 +46,14 @@
{% endfor %}
</div>
{% endif %}
<p>Uploaded by: <a href="{{ url_for('profile', username=content.username) }}">{{ content.username }}</a></p>
<p>Description: {{ content.description }}</p>
</div>
<div class="vote-section">
<p>Votes: {{ content.cookie_votes }} 🍪</p>
{% if current_user.is_authenticated %}
<form action="{{ url_for('vote_content', content_type=content_type, content_id=content.id) }}"
method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="button">Vote</button>
</form>
{% else %}
<p>You need to <a href="{{ url_for('login') }}">log in</a> to vote.</p>
{% endif %}
</div>
{% else %}
<p>Unknown content type.</p>
{% endif %}
<div class="comments-section">
<h3>Comments</h3>
{% if comments %}
<ul class="comments-list">
{% for comment in comments %}
<li>
<img src="{{ url_for('static', filename='avatars/' + avatars[comment.username]) }}" alt="Avatar"
class="comment-avatar">
<strong>{{ comment.username }}</strong>: {{ comment.comment_text }}
</li>
{% endfor %}
</ul>
{% else %}
<p>No comments yet. Be the first to comment!</p>
{% endif %}
{% if current_user.is_authenticated %}
<form method="POST" class="comment-form">
<textarea name="comment" placeholder="Write your comment..." maxlength="44" required
class="input-textarea"></textarea>
<button type="submit" class="button">Post Comment</button>
</form>
{% else %}
<p>You need to <a href="{{ url_for('login') }}">log in</a> to comment.</p>
{% endif %}
</div>
{% endblock %}
</section>
{% if pagination %}
<!-- {% if pagination %}
<div class="pagination">
{% if pagination.has_prev %}
<a href="{{ url_for(request.endpoint, page=pagination.prev_num, search=request.args.get('search')) }}"
@ -152,16 +72,7 @@
class="button">»</a>
{% endif %}
</div>
{% endif %}
<footer class="footer">
<p>
<a href="{{ url_for('privacy_policy') }}" class="button">Privacy</a>
<a href="{{ url_for('terms_of_use') }}" class="button">TOS</a>
<a href="{{ url_for('publication_rules') }}" class="button">Pub Rules</a>
<a href="https://discord.gg/yRFyPjceWj" target="_blank" class="button" rel="noopener noreferrer">Discord</a>
</p>
</footer>
{% endif %} -->
<div class="modal-overlay" id="ageVerificationModal">
<div class="modal-content">
@ -173,7 +84,7 @@
</div>
</div>
<script>
<!-- <script>
window.onload = function () {
var modal = document.getElementById('ageVerificationModal');
var body = document.body;
@ -234,7 +145,7 @@
})
.catch(error => console.error('Error fetching autocomplete data:', error));
});
</script>
</script> -->
</body>
</html>

View File

@ -146,5 +146,43 @@
{% endif %}
</div>
{% endif %}
<div class="vote-section">
<p>Votes: {{ content.cookie_votes }} 🍪</p>
{% if current_user.is_authenticated %}
<form action="{{ url_for('vote_content', content_type=content_type, content_id=content.id) }}"
method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="button">Vote</button>
</form>
{% else %}
<p>You need to <a href="{{ url_for('login') }}">log in</a> to vote.</p>
{% endif %}
</div>
<div class="comments-section">
<h3>Comments</h3>
{% if comments %}
<ul class="comments-list">
{% for comment in comments %}
<li>
<img src="{{ url_for('static', filename='avatars/' + (avatars.get(comment.username) or 'default_avatar.png')) }}" alt="Avatar"
class="comment-avatar">
<strong>{{ comment.username }}</strong>: {{ comment.comment_text }}
</li>
{% endfor %}
</ul>
{% else %}
<p>No comments yet. Be the first to comment!</p>
{% endif %}
{% if current_user.is_authenticated %}
<form method="POST" class="comment-form">
<textarea name="comment" placeholder="Write your comment..." maxlength="44" required
class="input-textarea"></textarea>
<button type="submit" class="button">Post Comment</button>
</form>
{% else %}
<p>You need to <a href="{{ url_for('login') }}">log in</a> to comment.</p>
{% endif %}
</div>
</body>
</html>