146 lines
6.5 KiB
HTML
146 lines
6.5 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="ru">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Редактирование опроса</title>
|
||
|
<link rel="stylesheet" href="/questioneer/static/css/style.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="container">
|
||
|
<h1>Редактирование опроса</h1>
|
||
|
|
||
|
<div id="loading">Загрузка опроса...</div>
|
||
|
|
||
|
<div class="form-container" id="edit-form-container" style="display: none;">
|
||
|
<form id="edit-questionnaire-form">
|
||
|
<div class="form-group">
|
||
|
<label for="title">Название опроса:</label>
|
||
|
<input type="text" id="title" name="title" required>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="description">Описание:</label>
|
||
|
<textarea id="description" name="description" rows="3"></textarea>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="display-type">Тип отображения:</label>
|
||
|
<select id="display-type" name="displayType">
|
||
|
<option value="default">Обычный</option>
|
||
|
<option value="tag_cloud">Облако тегов</option>
|
||
|
<option value="voting">Голосование</option>
|
||
|
<option value="poll">Опрос</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
|
||
|
<div class="questions-container">
|
||
|
<h2>Вопросы</h2>
|
||
|
<div id="questions-list"></div>
|
||
|
|
||
|
<button type="button" id="add-question" class="btn btn-small">Добавить вопрос</button>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-actions">
|
||
|
<div class="link-group">
|
||
|
<h3>Ссылки:</h3>
|
||
|
<div class="link-input-group">
|
||
|
<div>
|
||
|
<label for="public-link">Ссылка для голосования:</label>
|
||
|
<input type="text" id="public-link" readonly>
|
||
|
<button type="button" class="btn btn-small" id="copy-public-link">Копировать</button>
|
||
|
<button type="button" class="btn btn-small" id="show-qr-code">QR-код</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
<label for="admin-link">Административная ссылка:</label>
|
||
|
<input type="text" id="admin-link" readonly>
|
||
|
<button type="button" class="btn btn-small" id="copy-admin-link">Копировать</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-buttons">
|
||
|
<a href="#" id="back-to-admin" class="btn btn-secondary">Вернуться</a>
|
||
|
<button type="submit" class="btn btn-primary">Сохранить изменения</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- Шаблон для вопроса -->
|
||
|
<template id="question-template">
|
||
|
<div class="question-item" data-index="{{index}}">
|
||
|
<div class="question-header">
|
||
|
<h3>Вопрос {{number}}</h3>
|
||
|
<button type="button" class="btn-icon delete-question">
|
||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||
|
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
|
||
|
</svg>
|
||
|
</button>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="question-text-{{index}}">Текст вопроса:</label>
|
||
|
<input type="text" id="question-text-{{index}}" name="questions[{{index}}][text]" required>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="question-type-{{index}}">Тип вопроса:</label>
|
||
|
<select id="question-type-{{index}}" name="questions[{{index}}][type]" class="question-type-select">
|
||
|
<option value="single_choice">Один вариант</option>
|
||
|
<option value="multiple_choice">Несколько вариантов</option>
|
||
|
<option value="text">Текстовый ответ</option>
|
||
|
<option value="rating">Оценка</option>
|
||
|
<option value="scale">Шкала оценки</option>
|
||
|
<option value="tag_cloud">Облако тегов</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label>
|
||
|
<input type="checkbox" name="questions[{{index}}][required]" value="true">
|
||
|
Обязательный вопрос
|
||
|
</label>
|
||
|
</div>
|
||
|
|
||
|
<div class="options-container" id="options-container-{{index}}">
|
||
|
<h4>Варианты ответа</h4>
|
||
|
<div class="options-list" id="options-list-{{index}}"></div>
|
||
|
<button type="button" class="btn btn-small add-option" data-question-index="{{index}}">Добавить вариант</button>
|
||
|
</div>
|
||
|
|
||
|
<div class="scale-container" id="scale-container-{{index}}" style="display: none;">
|
||
|
<h4>Настройки шкалы</h4>
|
||
|
<div class="form-group">
|
||
|
<label for="scale-max-{{index}}">Максимальное значение:</label>
|
||
|
<select id="scale-max-{{index}}" name="questions[{{index}}][scaleMax]">
|
||
|
<option value="5">5</option>
|
||
|
<option value="10" selected>10</option>
|
||
|
<option value="20">20</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<!-- Шаблон для варианта ответа -->
|
||
|
<template id="option-template">
|
||
|
<div class="option-item" data-index="{{optionIndex}}">
|
||
|
<input type="text" name="questions[{{questionIndex}}][options][{{optionIndex}}][text]" placeholder="Вариант ответа">
|
||
|
<button type="button" class="btn-icon delete-option">
|
||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
||
|
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
|
||
|
</svg>
|
||
|
</button>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
|
||
|
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
|
||
|
crossorigin="anonymous"></script>
|
||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcode-generator/1.4.4/qrcode.min.js"></script>
|
||
|
<script src="/questioneer/static/js/common.js"></script>
|
||
|
<script src="/questioneer/static/js/edit.js"></script>
|
||
|
</body>
|
||
|
</html>
|