From 0a6a6e0bf915ce817ea74a2977ca6f6c1b40a03f Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Sun, 10 Dec 2023 13:54:31 +0100 Subject: [PATCH] [FIX] Datatable in permission audit templates --- .../templates/permissions_tool/audit.html | 105 ++++++++-------- .../templates/permissions_tool/audit_row.html | 8 +- .../templates/permissions_tool/overview.html | 112 ++++++++++-------- 3 files changed, 124 insertions(+), 101 deletions(-) diff --git a/allianceauth/permissions_tool/templates/permissions_tool/audit.html b/allianceauth/permissions_tool/templates/permissions_tool/audit.html index 9db22d3d..717805b5 100644 --- a/allianceauth/permissions_tool/templates/permissions_tool/audit.html +++ b/allianceauth/permissions_tool/templates/permissions_tool/audit.html @@ -1,18 +1,29 @@ {% extends "allianceauth/base-bs5.html" %} + {% load i18n %} + {% block page_title %} {{ permission.permission.codename }} - {% translate "Permissions Audit" %} {% endblock page_title %} + +{% block header_nav_brand %} + {% translate "Permissions Audit" %} +{% endblock header_nav_brand %} + {% block content %}
-

{% translate "Permissions Audit" %}: {{ permission.permission.codename }}

+

+ {% translate "Permissions Audit" %}: {{ permission.permission.codename }} +

+

{% translate "Back" %}

+
- +
@@ -44,52 +55,52 @@ {% endblock content %} {% block extra_javascript %} {% include "bundles/datatables-js-bs5.html" %} - {% include "bundles/filterdropdown-js.html" %} +{# {% include "bundles/filterdropdown-js.html" %}#} + + {% endblock extra_javascript %} + {% block extra_css %} {% include "bundles/datatables-css-bs5.html" %} {% endblock extra_css %} -{% block extra_script %} - $(document).ready(function () { - let groupColumn = 0; - - $('#tab_permissions_audit').DataTable({ - columnDefs: [{ - "visible": false, - "targets": groupColumn - }], - order: [ - [groupColumn, 'asc'], - [2, 'asc'] - ], - filterDropDown: { - columns: [{ - idx: 0, - title: 'Source' - }], - bootstrap: true - }, - "stateSave": true, - "stateDuration": 0, - drawCallback: function (settings) { - let api = this.api(); - let rows = api.rows({ - page: 'current' - }).nodes(); - let last = null; - - api.column(groupColumn, { - page: 'current' - }).data().each(function (group, i) { - if (last !== group) { - $(rows).eq(i).before( - '' - ); - - last = group; - } - }); - } - }); - }); -{% endblock extra_script %} diff --git a/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html b/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html index f2993490..de3e4ff5 100644 --- a/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html +++ b/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html @@ -1,10 +1,14 @@ {% load evelinks %} {% load i18n %} + - + {{ user.profile.main_character.character_name }} + +
{% translate "Group" %}
' + group + '
{{ type }}: {{ name }} - {{ user.profile.main_character.character_name }}{{ user }}
{{ user.profile.main_character.character_name }}
+ {{ user }}
{{ user.profile.main_character.character_name }} +
{% if user.profile.main_character %} {{ user.profile.main_character.corporation_name }} diff --git a/allianceauth/permissions_tool/templates/permissions_tool/overview.html b/allianceauth/permissions_tool/templates/permissions_tool/overview.html index 75f7183e..4287e176 100644 --- a/allianceauth/permissions_tool/templates/permissions_tool/overview.html +++ b/allianceauth/permissions_tool/templates/permissions_tool/overview.html @@ -1,11 +1,17 @@ {% extends "allianceauth/base-bs5.html" %} + {% load i18n %} + {% block page_title %} {% translate "Permissions Overview" %} {% endblock page_title %} + +{% block header_nav_brand %} + {% translate "Permissions Audit" %} +{% endblock header_nav_brand %} + {% block content %} -
-

{% translate "Permissions Overview" %}

+

{% if request.GET.all != 'yes' %} {% translate "Showing only applied permissions" %} @@ -15,6 +21,7 @@ {% translate "Show Applied" %} {% endif %}

+
@@ -28,6 +35,7 @@ + {% for perm in permissions %} @@ -49,59 +57,59 @@ {% endblock content %} + {% block extra_javascript %} {% include "bundles/datatables-js-bs5.html" %} - {% include "bundles/filterdropdown-js.html" %} +{# {% include "bundles/filterdropdown-js.html" %}#} + + {% endblock extra_javascript %} + {% block extra_css %} {% include "bundles/datatables-css-bs5.html" %} {% endblock extra_css %} -{% block extra_script %} - $(document).ready(function () { - let groupColumn = 0; - $('#tab_permissions_overview').DataTable({ - columnDefs: [{ - "visible": false, - "targets": groupColumn - }], - order: [ - [groupColumn, 'asc'], - [1, 'asc'], - [2, 'asc'] - ], - filterDropDown: { - columns: [{ - idx: 0 - }, - { - idx: 1 - } - ], - bootstrap: true, - }, - "stateSave": true, - "stateDuration": 0, - drawCallback: function (settings) { - let api = this.api(); - let rows = api.rows({ - page: 'current' - }).nodes(); - let last = null; - api.column(groupColumn, { - page: 'current' - }).data().each(function (group, i) { - if (last !== group) { - $(rows).eq(i).before( - ' - - - - ' - ); - last = group; - } - }); - } - }); - }); -{% endblock extra_script %}
{% translate "States" %}
' + group + '