From 272a41fddbd514b3d748fe92442bc5e553922a3d Mon Sep 17 00:00:00 2001 From: gregorybesson Date: Tue, 3 Jan 2017 09:58:11 +0100 Subject: [PATCH] fix: ajax datatable on search --- src/server/app.js | 16 +++++++++++----- .../public/abejs/scripts/template-engine.js | 13 +++++++++++++ src/server/routes/get-main.js | 2 +- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/server/app.js b/src/server/app.js index 842df489..bbbd3749 100755 --- a/src/server/app.js +++ b/src/server/app.js @@ -6,10 +6,11 @@ import helmet from 'helmet' import bodyParser from 'body-parser' import exphbs from 'express-secure-handlebars' import path from 'path' +//import crypto from 'crypto'; import busboy from 'connect-busboy' import clc from 'cli-color' import openurl from 'openurl' -import uuid from 'uuid' +//import uuid from 'uuid' import flash from 'connect-flash' import cookieParser from 'cookie-parser' import csrf from 'csurf' @@ -107,10 +108,15 @@ app.use(function(req, res, next) { }) app.use(bodyParser.json({limit: '1gb'})) -app.use(function (req, res, next) { - res.locals.nonce = uuid.v4() - next() -}) +// app.use(function (req, res, next) { +// crypto.randomBytes(Math.ceil(6), function(err, buffer){ +// res.locals.nonce = buffer +// .toString('hex') +// .slice(0,12) +// }) +// //res.locals.nonce = uuid.v4() +// next() +// }) if(config.security === true){ app.use(helmet()) diff --git a/src/server/public/abejs/scripts/template-engine.js b/src/server/public/abejs/scripts/template-engine.js index 56959470..738d6ae1 100755 --- a/src/server/public/abejs/scripts/template-engine.js +++ b/src/server/public/abejs/scripts/template-engine.js @@ -149,6 +149,19 @@ class Engine { $('td', row).eq(i).html(actions) } }) + $('#navigation-list') + .on('processing.dt', function ( e, settings, processing ) { + $('#navigation-list_processing') + .css( 'display', processing ? 'block' : 'none' ) + .css( {top:'150px'}); + }) + .dataTable(); + $('#navigation-list') + .on('preXhr.dt', function ( e, settings, data ) { + if(settings.jqXHR) { + settings.jqXHR.abort() + } + }); }) var abeReady = new Event('abeReady') diff --git a/src/server/routes/get-main.js b/src/server/routes/get-main.js index 083db390..93a450b7 100644 --- a/src/server/routes/get-main.js +++ b/src/server/routes/get-main.js @@ -60,7 +60,7 @@ function renderAbeAdmin(EditorVariables, obj, filePath) { EditorVariables.form = _form EditorVariables.json = _json EditorVariables.manager = manager - EditorVariables.nonce = '\'nonce-' + EditorVariables.express.res.locals.nonce + '\'' +// EditorVariables.nonce = '\'nonce-' + EditorVariables.express.res.locals.nonce + '\'' EditorVariables.editorWidth = editorWidth if (_json != null && _json.abe_meta) {