117 lines
6.4 KiB
HTML
117 lines
6.4 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>{{ 'Редактирование' if is_edit else 'Новый проект' }} — Morozovka Portal</title>
|
||
<style>
|
||
body { background: #0d1117; color: #e6edf3; font-family: sans-serif; padding: 40px 20px; }
|
||
.container { max-width: 640px; margin: 0 auto; }
|
||
h2 { color: #58a6ff; }
|
||
.form-group { margin-bottom: 15px; display: flex; flex-direction: column; }
|
||
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
|
||
label { margin-bottom: 5px; color: #8b949e; font-size: 0.9rem; }
|
||
input, select, textarea { padding: 10px; background: #0d1117; color: white; border: 1px solid #30363d; border-radius: 5px; font-family: inherit; font-size: 1rem; }
|
||
input:focus, select:focus, textarea:focus { outline: none; border-color: #58a6ff; }
|
||
textarea { resize: vertical; min-height: 100px; }
|
||
.hint { color: #6e7681; font-size: .8rem; margin-top: 4px; }
|
||
button { padding: 12px 24px; background: #238636; color: white; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; font-size: 1rem; margin-top: 10px; }
|
||
button:hover:not(:disabled) { background: #2ea043; }
|
||
button:disabled { background: #30363d; color: #8b949e; cursor: not-allowed; }
|
||
.back-link { display: block; margin-bottom: 20px; color: #8b949e; text-decoration: none; }
|
||
.back-link:hover { color: #58a6ff; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<a href="{{ '/projects/' + project.id|string if is_edit else '/projects' }}" class="back-link">← Назад</a>
|
||
<h2>{{ 'Редактирование проекта' if is_edit else 'Создание нового проекта' }}</h2>
|
||
<form method="POST" id="project-form">
|
||
<div class="form-group">
|
||
<label>Название проекта *</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>
|
||
|
||
<button type="submit" id="submit-btn">{{ 'Сохранить изменения' if is_edit else 'Создать проект' }}</button>
|
||
</form>
|
||
</div>
|
||
|
||
<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>
|
||
</body>
|
||
</html>
|