navigation - basic save function
parent
80116c3e30
commit
f1adddb775
@ -1,12 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
|
||||
var admin = {};
|
||||
var admin = {},
|
||||
async = require('async'),
|
||||
plugins = require('../plugins'),
|
||||
db = require('../database');
|
||||
|
||||
|
||||
admin.save = function(data, callback) {
|
||||
var order = Object.keys(data),
|
||||
items = data.map(function(item) {
|
||||
return JSON.stringify(item);
|
||||
});
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
db.delete('navigation:enabled', next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetAdd('navigation:enabled', order, items, next);
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
admin.getAvailable = function(data, callback) {
|
||||
var core = require('../../install/data/navigation.json');
|
||||
plugins.fireHook('filter:navigation.available', core, callback);
|
||||
};
|
||||
|
||||
module.exports = admin;
|
Loading…
Reference in New Issue