From 42fa8304ddb811b0f725f245130f70c0f5e86a6c Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 04 Nov 2025 06:12:02 +0000
Subject: [PATCH] =Refactored LoginManager to be more extensible and configurable, as well as an AjaxRateLimiter
---
assets/js/dash/CRUD.js | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/assets/js/dash/CRUD.js b/assets/js/dash/CRUD.js
index e9f39d7..670f625 100644
--- a/assets/js/dash/CRUD.js
+++ b/assets/js/dash/CRUD.js
@@ -7,6 +7,7 @@
console.log(this.queue);
this.config = config;
this.content = config.content || false;
+ this.settings = window.jvbUserSettings;
if (!this.content) {
return;
@@ -41,7 +42,7 @@
this.filterTimeout = null;
this.viewController = new window.jvbViews(this.ui.container, this.store);
- this.formController = new window.jvbForm(this.store);
+ this.formController = new window.jvbForm();
this.formController.subscribe((event, data) => {
switch(event) {
@@ -180,16 +181,27 @@
create: 'dialog.create form',
edit: 'dialog.edit form',
bulkEdit: 'dialog.bulkEdit form'
- }
+ },
+ uploader: 'details.uploader'
};
this.ui = window.uiFromSelectors(this.elements);
}
init() {
+ this.settings.addSetting(this.ui.uploader, 'open');
+ this.ui.uploader.addEventListener('toggle', (e) =>{
+ console.log(e);
+ console.log('Is Open: ', this.ui.uploader.open);
+ console.log(this.ui.uploader.open ? 'on' : 'off');
+ this.settings.saveSetting('open', this.ui.uploader.open ? 'on' : 'off');
+ });
+
+
// Set up filter controls
this.filterHandler = this.handleFilterChange.bind(this);
this.changeHandler = this.handleChange.bind(this);
+
this.modals = {};
for (let [name, modal] of Object.entries(this.ui.modals)) {
this.modals[name] = new window.jvbModal(modal);
@@ -213,8 +225,6 @@
this.setupFilters();
- // Load initial data
- this.store.fetch();
this.queue.subscribe((event, data) => {
switch (event) {
@@ -517,7 +527,9 @@
}
populateEditForm(itemID) {
- let item = this.store.get(itemID);
+ console.log(itemID);
+
+ let item = this.store.get(parseInt(itemID));
console.log(item);
if (item) {
this.ui.modals.edit.dataset.itemID = itemID;
@@ -539,6 +551,7 @@
setupFilters() {
document.querySelectorAll('[data-filter]').forEach(filter => {
+ this.settings.addSetting(filter)
filter.addEventListener('change', (e) => {
if (this.filterTimeout) {
clearTimeout(this.filterTimeout);
--
Gitblit v1.10.0