Skip to content

Commit

Permalink
fix: ajax datatable on search
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Jan 3, 2017
1 parent 253064a commit 272a41f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
16 changes: 11 additions & 5 deletions src/server/app.js
Expand Up @@ -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'
Expand Down Expand Up @@ -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())
Expand Down
13 changes: 13 additions & 0 deletions src/server/public/abejs/scripts/template-engine.js
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/get-main.js
Expand Up @@ -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) {
Expand Down

0 comments on commit 272a41f

Please sign in to comment.