summaryrefslogtreecommitdiffstats
path: root/ogcp/templates
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-02-22 17:22:07 +0100
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-02-23 10:47:08 +0100
commit886e6c7b67168441ea64ac04039c51264453fd77 (patch)
treeef9cf7ead91d5d0a1764e00644bc74dd675f7b21 /ogcp/templates
parent1d68e2619a74d7d8b2bd8faefbf01b9794f3a2f7 (diff)
Show selected clients in container block
On scopes and commands views, draw clients as users selects them in the scopes tree. Trigger client drawing on two events: 1."change" event, occurs when the user clicks a client checkbox. This event is standard [1]. 2. "show-client" event, fires when ogcp get selected clients from localStorage and when an user checks a parent checkbox. This event is custom. Dot characters (".") in clients names are replaced by underscore("_") when used as id to avoid errors. 1. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event
Diffstat (limited to 'ogcp/templates')
-rw-r--r--ogcp/templates/commands.html3
-rw-r--r--ogcp/templates/macros.html5
-rw-r--r--ogcp/templates/scopes.html4
3 files changed, 12 insertions, 0 deletions
diff --git a/ogcp/templates/commands.html b/ogcp/templates/commands.html
index 1b51701..9fa8617 100644
--- a/ogcp/templates/commands.html
+++ b/ogcp/templates/commands.html
@@ -96,3 +96,6 @@
</div>
{% endblock %}
+{% block content %}
+ {{ macros.selected_clients() }}
+{% endblock %}
diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html
index a1b5ebb..7864cd4 100644
--- a/ogcp/templates/macros.html
+++ b/ogcp/templates/macros.html
@@ -8,6 +8,7 @@
// in the scope
document.addEventListener('readystatechange', () => {
if (document.readyState === 'complete') {
+ showSelectedClientsOnEvents();
updateScopeState();
keepScopesTreeState();
keepSelectedClients();
@@ -47,3 +48,7 @@
</li>
{% endfor %}
{% endmacro %}
+
+{% macro selected_clients() -%}
+<div id="selected-clients" class="d-flex flex-wrap justify-content-center"></div>
+{% endmacro %}
diff --git a/ogcp/templates/scopes.html b/ogcp/templates/scopes.html
index 6c543fa..81b2403 100644
--- a/ogcp/templates/scopes.html
+++ b/ogcp/templates/scopes.html
@@ -29,3 +29,7 @@
<input class="btn btn-light" type="submit" value="{{ _('Delete center') }}"
form="scopesForm" formaction="{{ url_for('action_center_delete') }}" formmethod="get">
{% endblock %}
+
+{% block content %}
+ {{ macros.selected_clients() }}
+{% endblock %}