configs
This commit is contained in:
70
templates/configs.html
Normal file
70
templates/configs.html
Normal file
@@ -0,0 +1,70 @@
|
||||
{% extends 'layouts/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Конфиги <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#create_config">+</button></h1>
|
||||
<select class="form-select" style="width: 150px;" onchange="window.location.href='/configs/?stage=' + this.value;">
|
||||
<option {% if stage == 'production' %}selected{% endif %}>production</option>
|
||||
<option {% if stage == 'development' %}selected{% endif %}>development</option>
|
||||
</select>
|
||||
<div class="modal fade" id="create_config" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
<div class="modal-header">
|
||||
<h2 class="h6 modal-title">Создать конфиг</h2>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="text" name="name" placeholder="Название конфига" style="width: 100%;" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="action" value="create_config" class="btn btn-secondary">Создать</button>
|
||||
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if error %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
Конфиг не имеет вид JSON!
|
||||
</div>
|
||||
{% endif %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>Название</th>
|
||||
<th>Действие</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for config in configs %}
|
||||
<tr>
|
||||
<td>{{ config.name }}</td>
|
||||
<td><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#edit_{{ config.id }}">Редактировать</button></td>
|
||||
<div class="modal fade" id="edit_{{ config.id }}" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="config" value="{{ config.id }}" />
|
||||
<div class="modal-header">
|
||||
<h2 class="h6 modal-title">Редактировать конфиг {{ config.name }}</h2>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea style="width: 100%; height: 800px;" name="data">{{ config.data_pretty }}</textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="action" value="save" class="btn btn-secondary">Сохранить</button>
|
||||
<button type="submit" name="action" value="delete" class="btn btn-danger">Удалить</button>
|
||||
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
@@ -75,7 +75,7 @@
|
||||
{% endif %}
|
||||
<li role="separator" class="dropdown-divider mt-4 mb-3 border-gray-700"></li>
|
||||
<li class="nav-item">
|
||||
<a href="/profile" class="nav-link">
|
||||
<a href="/configs" class="nav-link">
|
||||
<span class="sidebar-icon">
|
||||
<i class="fa fa-cogs"></i>
|
||||
</span>
|
||||
|
Reference in New Issue
Block a user