From 573df2acaa3adfeba6e208a8ea601f426bed7cbb Mon Sep 17 00:00:00 2001 From: catborise Date: Thu, 24 Jan 2019 15:00:45 +0300 Subject: [PATCH] Add XML Config to collapsible accordion --- nwfilters/templates/add_nwf_rule.html | 33 ++++ nwfilters/templates/nwfilter.html | 239 ++++++++++++-------------- 2 files changed, 140 insertions(+), 132 deletions(-) create mode 100644 nwfilters/templates/add_nwf_rule.html diff --git a/nwfilters/templates/add_nwf_rule.html b/nwfilters/templates/add_nwf_rule.html new file mode 100644 index 0000000..bd124e4 --- /dev/null +++ b/nwfilters/templates/add_nwf_rule.html @@ -0,0 +1,33 @@ +{% load i18n %} +{% if request.user.is_superuser %} + + + + + + +{% endif %} \ No newline at end of file diff --git a/nwfilters/templates/nwfilter.html b/nwfilters/templates/nwfilter.html index 377190d..db4b0dd 100644 --- a/nwfilters/templates/nwfilter.html +++ b/nwfilters/templates/nwfilter.html @@ -38,152 +38,127 @@ {% include 'errors_block.html' %} {% include 'messages_block.html' %} -
-
-

{% trans "UUID:" %}

-

{% trans "Name:" %}

-
- -
-

{{ uuid }}

-

{{ name }}

-
- -
-

{% trans "XML:" %}

-
{% csrf_token %} -
- - -
- -
+
+

{% trans "UUID:" %}

+

{% trans "Name:" %}

+
+
+

{{ uuid }}

+

{{ name }}

+
+
+
+ +
+
+
+ +
+
+ +
{% csrf_token %} +
+ + +
+ +
+
+
+
+
+
+
-

{% trans "Filter References:" %}

{% csrf_token %} -
- - + {% for nwf in nwfilters_all %} {% endfor %} - - +
-
+ +
+ + + + + + + + {% for ref in refs %} + + + + + + {% endfor %} + +
#{% trans "Reference" %}{% trans "Action" %}
{{ forloop.counter }}{{ ref }} +
{% csrf_token %} + + +
+
+
+
-
- - - - - - - - - - {% for ref in refs %} - - - - - - {% endfor %} - -
#{% trans "Reference" %}{% trans "Action" %}
{{ forloop.counter }}{{ ref }} -
{% csrf_token %} - - -
-
-
+ {% include 'add_nwf_rule.html' %} +
-
-

{% trans "Rules:" %}

- - - - - - +
+ + + + + + + + + + + + {% for rule in rules %} + + + + + + + + + + {% endfor %} + +
{% trans "Rule" %}{% trans "ActionType" %}{% trans "Direction" %}{% trans "Priority" %}{% trans "Statematch" %}{% trans "Directives" %}{% trans "Action" %}
{{ forloop.counter }}{{ rule.action }}{{ rule.direction }}{{ rule.priority }}{{ rule.statematch }}{{ rule.directives }} +
{% csrf_token %} + + + + +
+
-
-
- - - - - - - - - - - - - - {% for rule in rules %} - - - - - - - - - - {% endfor %} - -
{% trans "Rule" %}{% trans "ActionType" %}{% trans "Direction" %}{% trans "Priority" %}{% trans "Statematch" %}{% trans "Directives" %}{% trans "Action" %}
{{ forloop.counter }}{{ rule.action }}{{ rule.direction }}{{ rule.priority }}{{ rule.statematch }}{{ rule.directives }} -
{% csrf_token %} - - - - -
-
-
-
- - {% endblock %} {% block script %} @@ -209,7 +184,7 @@ var edit_input = $('input[name="edit_xml"]'); editor.getSession().on("change",function () { edit_input.val(editor.getSession().getValue()); - }) + }); var rule_editor = ace.edit("rule_editor"); rule_editor.getSession().setMode("ace/mode/xml"); @@ -217,7 +192,7 @@ var rule_input = $('input[name="nwfilterrule_xml"]'); rule_editor.getSession().on("change",function () { rule_input.val(rule_editor.getSession().getValue()); - }) + }); {% endblock %}