morozovka-portal/app/templates/project_form.html

100 lines
5.3 KiB
HTML
Raw Permalink 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.

{% extends "base.html" %}
{% block title %}{{ 'Редактирование' if is_edit else 'Новый проект' }} — Morozovka Portal{% endblock %}
{% block main_class %}container container-narrow{% endblock %}
{% block content %}
<a href="{{ '/projects/' + project.id|string if is_edit else '/projects' }}" class="back-link" style="display:block;margin-bottom:20px;color:#8b949e;text-decoration:none;">← Назад</a>
<h2 class="page-title">{{ 'Редактирование проекта' if is_edit else 'Создание нового проекта' }}</h2>
<form method="POST" id="project-form" class="form-card">
<div class="form-group">
<label>Название проекта <span class="req">*</span></label>
<input type="text" name="title" value="{{ project.title if is_edit else '' }}" required>
</div>
<div class="form-group">
<label>Описание</label>
<textarea name="description">{{ project.description if is_edit else '' }}</textarea>
</div>
<div class="form-row">
<div class="form-group">
<label>Статус</label>
<select name="status">
<option value="idea" {% if is_edit and project.status == 'idea' %}selected{% endif %}>Идея</option>
<option value="in_progress" {% if is_edit and project.status == 'in_progress' %}selected{% endif %}>В работе</option>
<option value="completed" {% if is_edit and project.status == 'completed' %}selected{% endif %}>Завершён</option>
<option value="frozen" {% if is_edit and project.status == 'frozen' %}selected{% endif %}>Заморожен</option>
</select>
</div>
<div class="form-group">
<label>Видимость</label>
<select name="visibility">
<option value="public" {% if is_edit and project.visibility == 'public' %}selected{% endif %}>Публичный (видят все)</option>
<option value="internal" {% if is_edit and project.visibility == 'internal' %}selected{% endif %}>Внутренний (только для своих)</option>
<option value="private" {% if is_edit and project.visibility == 'private' %}selected{% endif %}>Приватный (только участники)</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label>Дата начала</label>
<input type="date" name="start_date" value="{{ project.start_date if is_edit and project.start_date else '' }}">
</div>
<div class="form-group">
<label>Дата завершения</label>
<input type="date" name="end_date" value="{{ project.end_date if is_edit and project.end_date else '' }}">
</div>
</div>
<div class="form-group">
<label>Контактное лицо</label>
<input type="text" name="contact_person" placeholder="Имя, email или Telegram" value="{{ project.contact_person if is_edit and project.contact_person else '' }}">
</div>
<div class="form-group">
<label>Теги технологий</label>
<input type="text" name="tags" placeholder="python, flask, iot, embedded" value="{{ project.tags if is_edit and project.tags else '' }}">
<div class="hint">Через запятую. Сохраняются в нижнем регистре, без дублей.</div>
</div>
<div class="form-group">
<label>Ссылка на репозиторий Gitea</label>
<input type="url" name="gitea_url" placeholder="https://git.morozovka.space/user/repo" value="{{ project.gitea_url if is_edit and project.gitea_url else '' }}">
</div>
<div class="form-group">
<label>Репозиторий для Gitea API (owner/repo)</label>
<input type="text" name="gitea_repo" placeholder="например, IvanBud123/morozovka-portal" value="{{ project.gitea_repo if is_edit and project.gitea_repo else '' }}">
<div class="hint">Можно оставить пустым — автоматически извлечётся из URL выше. Заполняйте вручную, если URL нестандартный.</div>
</div>
<div class="form-actions">
<button type="submit" id="submit-btn" class="btn btn-primary">{{ 'Сохранить изменения' if is_edit else 'Создать проект' }}</button>
<a href="{{ '/projects/' + project.id|string if is_edit else '/projects' }}" class="btn btn-default">Отмена</a>
</div>
</form>
{% endblock %}
{% block scripts %}
<script>
(function() {
const form = document.getElementById('project-form');
const btn = document.getElementById('submit-btn');
const originalText = btn.textContent;
let submitted = false;
form.addEventListener('submit', function(e) {
if (submitted) { e.preventDefault(); return false; }
submitted = true;
btn.disabled = true;
btn.textContent = '{{ "Сохранение..." if is_edit else "Создание..." }}';
setTimeout(function() {
submitted = false;
btn.disabled = false;
btn.textContent = originalText;
}, 30000);
});
})();
</script>
{% endblock %}