mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-12 22:10:16 +02:00
[FIX] Datatable in permission audit templates
This commit is contained in:
parent
f0fe3929d4
commit
0a6a6e0bf9
@ -1,18 +1,29 @@
|
|||||||
{% extends "allianceauth/base-bs5.html" %}
|
{% extends "allianceauth/base-bs5.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block page_title %}
|
{% block page_title %}
|
||||||
{{ permission.permission.codename }} - {% translate "Permissions Audit" %}
|
{{ permission.permission.codename }} - {% translate "Permissions Audit" %}
|
||||||
{% endblock page_title %}
|
{% endblock page_title %}
|
||||||
|
|
||||||
|
{% block header_nav_brand %}
|
||||||
|
{% translate "Permissions Audit" %}
|
||||||
|
{% endblock header_nav_brand %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
<h1 class="page-header">{% translate "Permissions Audit" %}: {{ permission.permission.codename }}</h1>
|
<h1 class="page-header md-3">
|
||||||
|
{% translate "Permissions Audit" %}: {{ permission.permission.codename }}
|
||||||
|
</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="{% url 'permissions_tool:overview' %}" class="btn btn-primary">
|
<a href="{% url 'permissions_tool:overview' %}" class="btn btn-primary">
|
||||||
<i class="fa-solid fa-chevron-left"></i> {% translate "Back" %}
|
<i class="fa-solid fa-chevron-left"></i> {% translate "Back" %}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped" id="tab_permissions_audit">
|
<table class="table table-striped" id="tab_permissions_audit" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{% translate "Group" %}</th>
|
<th scope="col">{% translate "Group" %}</th>
|
||||||
@ -44,52 +55,52 @@
|
|||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
{% block extra_javascript %}
|
{% block extra_javascript %}
|
||||||
{% include "bundles/datatables-js-bs5.html" %}
|
{% include "bundles/datatables-js-bs5.html" %}
|
||||||
{% include "bundles/filterdropdown-js.html" %}
|
{# {% include "bundles/filterdropdown-js.html" %}#}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
const 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) {
|
||||||
|
const api = this.api();
|
||||||
|
const 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(`<tr class="h4 table-secondary"><td colspan="3">${group}</td></tr>`;
|
||||||
|
|
||||||
|
last = group;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock extra_javascript %}
|
{% endblock extra_javascript %}
|
||||||
|
|
||||||
{% block extra_css %}
|
{% block extra_css %}
|
||||||
{% include "bundles/datatables-css-bs5.html" %}
|
{% include "bundles/datatables-css-bs5.html" %}
|
||||||
{% endblock extra_css %}
|
{% 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(
|
|
||||||
'<tr class="h4 table-secondary"><td colspan="3">' + group + '</td></tr>'
|
|
||||||
);
|
|
||||||
|
|
||||||
last = group;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
{% endblock extra_script %}
|
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
{% load evelinks %}
|
{% load evelinks %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ type }}: {{ name }}</td>
|
<td>{{ type }}: {{ name }}</td>
|
||||||
<td class="text-end">
|
<td class="text-end">
|
||||||
<img src="{{ user.profile.main_character|character_portrait_url:32 }}" class="img-circle" alt="{{ user.profile.main_character.character_name }}"></td>
|
<img src="{{ user.profile.main_character|character_portrait_url:32 }}" class="img-circle" alt="{{ user.profile.main_character.character_name }}">
|
||||||
<td><strong>{{ user }}<br></strong>{{ user.profile.main_character.character_name }}</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>{{ user }}<br></strong>{{ user.profile.main_character.character_name }}
|
||||||
|
</td>
|
||||||
<td class="text-start">
|
<td class="text-start">
|
||||||
{% if user.profile.main_character %}
|
{% if user.profile.main_character %}
|
||||||
<a href="{{ user.profile.main_character|dotlan_corporation_url }}" target="_blank">{{ user.profile.main_character.corporation_name }}</a>
|
<a href="{{ user.profile.main_character|dotlan_corporation_url }}" target="_blank">{{ user.profile.main_character.corporation_name }}</a>
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
{% extends "allianceauth/base-bs5.html" %}
|
{% extends "allianceauth/base-bs5.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block page_title %}
|
{% block page_title %}
|
||||||
{% translate "Permissions Overview" %}
|
{% translate "Permissions Overview" %}
|
||||||
{% endblock page_title %}
|
{% endblock page_title %}
|
||||||
|
|
||||||
|
{% block header_nav_brand %}
|
||||||
|
{% translate "Permissions Audit" %}
|
||||||
|
{% endblock header_nav_brand %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-sm-12">
|
<div>
|
||||||
<h1 class="page-header">{% translate "Permissions Overview" %}</h1>
|
|
||||||
<p>
|
<p>
|
||||||
{% if request.GET.all != 'yes' %}
|
{% if request.GET.all != 'yes' %}
|
||||||
{% translate "Showing only applied permissions" %}
|
{% translate "Showing only applied permissions" %}
|
||||||
@ -15,6 +21,7 @@
|
|||||||
<a href="{% url 'permissions_tool:overview' %}?all=no" class="btn btn-primary">{% translate "Show Applied" %}</a>
|
<a href="{% url 'permissions_tool:overview' %}?all=no" class="btn btn-primary">{% translate "Show Applied" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped" id="tab_permissions_overview">
|
<table class="table table-striped" id="tab_permissions_overview">
|
||||||
<thead>
|
<thead>
|
||||||
@ -28,6 +35,7 @@
|
|||||||
<th scope="col">{% translate "States" %}</th>
|
<th scope="col">{% translate "States" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for perm in permissions %}
|
{% for perm in permissions %}
|
||||||
<tr>
|
<tr>
|
||||||
@ -49,59 +57,59 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
{% block extra_javascript %}
|
{% block extra_javascript %}
|
||||||
{% include "bundles/datatables-js-bs5.html" %}
|
{% include "bundles/datatables-js-bs5.html" %}
|
||||||
{% include "bundles/filterdropdown-js.html" %}
|
{# {% include "bundles/filterdropdown-js.html" %}#}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(() => {
|
||||||
|
const 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: (settings) => {
|
||||||
|
const api = this.api();
|
||||||
|
const rows = api.rows({
|
||||||
|
page: 'current'
|
||||||
|
}).nodes();
|
||||||
|
let last = null;
|
||||||
|
|
||||||
|
api.column(groupColumn, {
|
||||||
|
page: 'current'
|
||||||
|
}).data().each((group, i) => {
|
||||||
|
if (last !== group) {
|
||||||
|
$(rows).eq(i).before(`<tr class="h4 table-secondary"><td colspan="6">${group}</td></tr>`);
|
||||||
|
|
||||||
|
last = group;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock extra_javascript %}
|
{% endblock extra_javascript %}
|
||||||
|
|
||||||
{% block extra_css %}
|
{% block extra_css %}
|
||||||
{% include "bundles/datatables-css-bs5.html" %}
|
{% include "bundles/datatables-css-bs5.html" %}
|
||||||
{% endblock extra_css %}
|
{% 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(
|
|
||||||
'
|
|
||||||
<tr class="h4 table-secondary">
|
|
||||||
<td colspan="6">' + group + '</td>
|
|
||||||
</tr>
|
|
||||||
'
|
|
||||||
);
|
|
||||||
last = group;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
{% endblock extra_script %}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user