aboutsummaryrefslogtreecommitdiff
path: root/src/static/scripts/admin_organizations.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/static/scripts/admin_organizations.js')
-rw-r--r--src/static/scripts/admin_organizations.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/static/scripts/admin_organizations.js b/src/static/scripts/admin_organizations.js
index ae15e2fd..db4037b4 100644
--- a/src/static/scripts/admin_organizations.js
+++ b/src/static/scripts/admin_organizations.js
@@ -1,6 +1,8 @@
"use strict";
+/* eslint-env es2017, browser, jquery */
+/* global _post:readable, BASE_URL:readable, reload:readable, jdenticon:readable */
-function deleteOrganization() {
+function deleteOrganization(event) {
event.preventDefault();
event.stopPropagation();
const org_uuid = event.target.dataset.vwOrgUuid;
@@ -28,9 +30,22 @@ function deleteOrganization() {
}
}
+function initActions() {
+ document.querySelectorAll("button[vw-delete-organization]").forEach(btn => {
+ btn.addEventListener("click", deleteOrganization);
+ });
+
+ if (jdenticon) {
+ jdenticon();
+ }
+}
+
// onLoad events
document.addEventListener("DOMContentLoaded", (/*event*/) => {
jQuery("#orgs-table").DataTable({
+ "drawCallback": function() {
+ initActions();
+ },
"stateSave": true,
"responsive": true,
"lengthMenu": [
@@ -46,9 +61,10 @@ document.addEventListener("DOMContentLoaded", (/*event*/) => {
});
// Add click events for organization actions
- document.querySelectorAll("button[vw-delete-organization]").forEach(btn => {
- btn.addEventListener("click", deleteOrganization);
- });
+ initActions();
- document.getElementById("reload").addEventListener("click", reload);
+ const btnReload = document.getElementById("reload");
+ if (btnReload) {
+ btnReload.addEventListener("click", reload);
+ }
}); \ No newline at end of file