Implement adding networks

This commit is contained in:
2022-08-01 23:02:35 +01:00
parent fa53e11ff0
commit c7e5ac5aac
15 changed files with 225 additions and 37 deletions

View File

@@ -0,0 +1,42 @@
<div id="actions">
{% include 'manage/threshold/partials/notify.html' %}
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'threshold_irc_actions_add-network' %}"
hx-trigger="click"
hx-target="#modals-here-actions"
class="button is-success">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-plus"></i>
</span>
<span>Network</span>
</span>
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-post="% url 'threshold_irc_actions_auto' %"
hx-trigger="click"
hx-target="#actions"
hx-swap="outerHTML"
class="button is-success">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-wrench"></i>
</span>
<span>Auto</span>
</span>
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
class="button is-success">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-list"></i>
</span>
<span>Registration</span>
</span>
</button>
</div>
</div>

View File

@@ -1,11 +1,7 @@
{% load joinsep %}
<div id="aliases">
{% if message is not None %}
<div class="notification is-{{ class }}" hx-ext="remove-me" remove-me="3s">
{{ message }}
</div>
{% endif %}
{% include 'manage/threshold/partials/notify.html' %}
{% if aliases is not None %}
<div class="content" style="max-height: 30em; overflow: auto;">
<div class="table-container">

View File

@@ -0,0 +1,85 @@
{% load index %}
{% load static %}
<script src="{% static 'modal.js' %}"></script>
<div class="modal is-active is-clipped">
<div class="modal-background"></div>
<div class="modal-content">
<div class="box">
<h4 class="subtitle is-4">Add network</h4>
<form
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-put="{% url 'threshold_irc_actions_add-network' %}"
hx-target="#networks"
hx-swap="outerHTML">
<div class="content">
<div class="field">
<label class="label">Network name</label>
<div class="control">
<input class="input" type="text" name="net" placeholder="freenode">
</div>
</div>
<div class="field">
<label class="label">Host</label>
<div class="control">
<input class="input" type="text" name="host" placeholder="irc.freenode.net">
</div>
</div>
<div class="field">
<label class="label">Port</label>
<div class="control">
<input class="input" type="text" name="port" placeholder="6697">
</div>
</div>
<div class="columns">
<div class="column">
<div class="field">
<label class="label">Security</label>
<div class="control">
<div class="select">
<select name="security">
<option>ssl</option>
<option>plain</option>
</select>
</div>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label">Authentication</label>
<div class="control">
<div class="select">
<select name="auth">
<option>sasl</option>
<option>ns</option>
<option>none</option>
</select>
</div>
</div>
</div>
</div>
</div>
<button
class="button is-primary modal-close-button">
Cancel
</button>
<button class="button is-primary modal-close-button">Submit</button>
</form>
</div>
<button class="modal-close is-large" aria-label="close"></button>
</div>
</div>

View File

@@ -1,4 +1,5 @@
<div id="networks">
{% include 'manage/threshold/partials/notify.html' %}
<div class="content" style="max-height: 30em; overflow: auto;">
<table class="table is-fullwidth is-hoverable">
<thead>
@@ -32,4 +33,6 @@
{% endfor %}
</table>
</div>
<div id="modals-here-actions">
</div>
</div>

View File

@@ -28,6 +28,15 @@
hx-swap="outerHTML">
</div>
<div
style="display: none;"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'threshold_irc_actions' %}"
hx-trigger="load"
hx-target="#actions"
hx-swap="outerHTML">
</div>
<div class="columns">
<div class="column">
<div class="box">
@@ -53,8 +62,20 @@
<div class="column">
<div class="box">
<div id="alerts">
Alerts here
</div>
</div>
</div>
</div>
<div class="columns">
<div class="column"></div>
<div class="column is-half">
<div class="box">
<div id="actions">
</div>
</div>
</div>
</div>
{% endblock %}