admin navigation test

This commit is contained in:
Barış Soner Uşaklı
2017-05-24 13:25:47 -04:00
parent 30bec51a21
commit b0dd1ad4d7
4 changed files with 60 additions and 51 deletions

View File

@@ -1,23 +1,22 @@
'use strict';
var navigationController = {};
var async = require('async');
var navigationAdmin = require('../../navigation/admin');
var navigationController = module.exports;
navigationController.get = function (req, res, next) {
require('../../navigation/admin').getAdmin(function (err, data) {
if (err) {
return next(err);
}
async.waterfall([
navigationAdmin.getAdmin,
function (data) {
data.enabled.forEach(function (enabled, index) {
enabled.index = index;
enabled.selected = index === 0;
});
data.navigation = data.enabled.slice();
data.enabled.forEach(function (enabled, index) {
enabled.index = index;
enabled.selected = index === 0;
});
data.navigation = data.enabled.slice();
res.render('admin/general/navigation', data);
});
res.render('admin/general/navigation', data);
},
], next);
};
module.exports = navigationController;