morozovka-portal/app/templates/projects.html

75 lines
4.0 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.

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Проекты — Morozovka Portal</title>
<style>
body { background: #0d1117; color: #e6edf3; font-family: sans-serif; padding: 40px; }
.container { max-width: 1000px; margin: 0 auto; }
h1 { color: #58a6ff; margin-top: 0; }
.header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-add { background: #238636; color: white; text-decoration: none; padding: 10px 20px; border-radius: 5px; font-weight: bold; }
.btn-add:hover { background: #2ea043; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { background: #161b22; border: 1px solid #30363d; border-radius: 8px; padding: 20px; display: flex; flex-direction: column; }
.card h3 { margin: 0 0 10px 0; color: #e6edf3; }
.card p { color: #8b949e; font-size: 0.9rem; flex-grow: 1; margin-bottom: 15px; }
.status-badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; margin-bottom: 10px; }
.status-idea { background: #30363d; color: white; }
.status-in_progress { background: #1f6feb; color: white; }
.status-completed { background: #238636; color: white; }
.status-frozen { background: #da3633; color: white; }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; border-top: 1px solid #30363d; padding-top: 15px; }
.repo-link { color: #58a6ff; text-decoration: none; font-size: 0.85rem; }
.delete-btn { background: none; border: none; color: #da3633; cursor: pointer; font-size: 0.85rem; }
.delete-btn:hover { text-decoration: underline; }
.back-link { display: block; margin-bottom: 20px; color: #8b949e; text-decoration: none; }
</style>
</head>
<body>
<div class="container">
<a href="/" class="back-link">← На главную</a>
<div class="header-actions">
<h1>Каталог проектов</h1>
{% if role in ['admin', 'professor', 'lead'] %}
<a href="/projects/new" class="btn-add">+ Добавить проект</a>
{% endif %}
</div>
<div class="grid">
{% for proj in projects %}
<div class="card">
<div>
<span class="status-badge status-{{ proj.status }}">
{% if proj.status == 'idea' %}Идея
{% elif proj.status == 'in_progress' %}В работе
{% elif proj.status == 'completed' %}Завершён
{% else %}Заморожен{% endif %}
</span>
</div>
<h3>{{ proj.title }}</h3>
<p>{{ proj.description or 'Описание отсутствует.' }}</p>
<div class="card-footer">
{% if proj.gitea_url %}
<a href="{{ proj.gitea_url }}" target="_blank" class="repo-link">📦 Репозиторий</a>
{% else %}
<span style="color: #8b949e; font-size: 0.85rem;">Без репозитория</span>
{% endif %}
{% if role == 'admin' or (role in ['professor', 'lead'] and proj.owner_id == session.get('user_id')) %}
<form action="/projects/{{ proj.id }}/delete" method="POST" onsubmit="return confirm('Удалить проект?');">
<button type="submit" class="delete-btn">Удалить</button>
</form>
{% endif %}
</div>
</div>
{% else %}
<p style="color: #8b949e;">Проектов пока нет.</p>
{% endfor %}
</div>
</div>
</body>
</html>