nav - basic ACP setup

v1.18.x
psychobunny 10 years ago
parent 8256d2b997
commit fbc0a11c87

@ -17,7 +17,7 @@
"enabled": true, "enabled": true,
"iconClass": "fa-clock-o", "iconClass": "fa-clock-o",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:]]" "text": "[[global:header.recent]]"
}, },
{ {
"route": "/tags", "route": "/tags",

@ -2,6 +2,7 @@
@import "./mixins"; @import "./mixins";
@import "./general/dashboard"; @import "./general/dashboard";
@import "./general/navigation";
@import "./manage/categories"; @import "./manage/categories";
@import "./manage/groups"; @import "./manage/groups";
@import "./manage/tags"; @import "./manage/tags";

@ -0,0 +1,6 @@
#navigation {
ul {
list-style-type: none;
padding: 0;
}
}

@ -37,6 +37,7 @@ var adminController = {
settings: {}, settings: {},
logger: {}, logger: {},
sounds: {}, sounds: {},
navigation: {},
themes: {}, themes: {},
users: require('./admin/users'), users: require('./admin/users'),
uploads: require('./admin/uploads') uploads: require('./admin/uploads')
@ -230,6 +231,30 @@ adminController.languages.get = function(req, res, next) {
}); });
}; };
adminController.sounds.get = function(req, res, next) {
meta.sounds.getFiles(function(err, sounds) {
sounds = Object.keys(sounds).map(function(name) {
return {
name: name
};
});
res.render('admin/general/sounds', {
sounds: sounds
});
});
};
adminController.navigation.get = function(req, res, next) {
require('../navigation/admin').get(function(err, data) {
if (err) {
return next(err);
}
res.render('admin/general/navigation', data);
});
};
adminController.settings.get = function(req, res, next) { adminController.settings.get = function(req, res, next) {
var term = req.params.term ? req.params.term : 'general'; var term = req.params.term ? req.params.term : 'general';
@ -340,20 +365,6 @@ adminController.groups.get = function(req, res, next) {
}); });
}; };
adminController.sounds.get = function(req, res, next) {
meta.sounds.getFiles(function(err, sounds) {
sounds = Object.keys(sounds).map(function(name) {
return {
name: name
};
});
res.render('admin/general/sounds', {
sounds: sounds
});
});
};
adminController.themes.get = function(req, res, next) { adminController.themes.get = function(req, res, next) {
var themeDir = path.join(__dirname, '../../node_modules/' + req.params.theme); var themeDir = path.join(__dirname, '../../node_modules/' + req.params.theme);
fs.exists(themeDir, function(exists) { fs.exists(themeDir, function(exists) {

@ -23,9 +23,20 @@ admin.save = function(data, callback) {
], callback); ], callback);
}; };
admin.getAvailable = function(data, callback) { admin.get = function(callback) {
var core = require('../../install/data/navigation.json'); async.parallel({
plugins.fireHook('filter:navigation.available', core, callback); enabled: require('./index').get,
available: getAvailable
}, callback);
}; };
function getAvailable(callback) {
var core = require('../../install/data/navigation.json').map(function(item) {
item.core = true;
return item;
});
plugins.fireHook('filter:navigation.available', core, callback);
}
module.exports = admin; module.exports = admin;

@ -43,6 +43,7 @@ function addRoutes(router, middleware, controllers) {
router.get('/general/dashboard', controllers.admin.home); router.get('/general/dashboard', controllers.admin.home);
router.get('/general/languages', controllers.admin.languages.get); router.get('/general/languages', controllers.admin.languages.get);
router.get('/general/sounds', controllers.admin.sounds.get); router.get('/general/sounds', controllers.admin.sounds.get);
router.get('/general/navigation', controllers.admin.navigation.get);
router.get('/manage/categories', controllers.admin.categories.active); router.get('/manage/categories', controllers.admin.categories.active);
router.get('/manage/categories/active', controllers.admin.categories.active); router.get('/manage/categories/active', controllers.admin.categories.active);

@ -0,0 +1,67 @@
<div id="navigation">
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">Active Navigation</div>
<div class="panel-body">
<ul id="enabled">
<form class="main inline-block">
<!-- BEGIN enabled -->
<li class="well">
<label>ID: <small>optional</small>
<input class="form-control" type="text" name="id" value="{enabled.id}" />
</label>
<label>Route: <small>ex. /unread</small>
<input class="form-control" type="text" name="route" value="{enabled.route}" />
</label>
<label>Title: <small>text shown upon mouseover</small>
<input class="form-control" type="text" name="title" value="{enabled.title}" />
</label>
<label>Text:
<input class="form-control" type="text" name="textClass" value="{enabled.text}" />
</label>
<label>Icon Class: <small><a href="http://fortawesome.github.io/Font-Awesome/cheatsheet/" target="_blank">pick one</a></small>
<input class="form-control" type="text" name="iconClass" value="{enabled.iconClass}" />
</label>
<label>Text Class: <small>optional</small>
<input class="form-control" type="text" name="textClass" value="{enabled.textClass}" />
</label>
<hr />
<label>Enabled
<input type="checkbox" name="enabled" <!-- IF enabled --> checked<!-- ENDIF enabled --> />
</label>
</li>
<!-- END enabled -->
</form>
</ul>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">Available Menu Items</div>
<div class="panel-body">
<ul id="active">
<li data-id="Custom" class="alert alert-warning">
<strong>Custom Route</strong>
</li>
<!-- BEGIN available -->
<li data-id="@index" class="alert <!-- IF available.core -->alert-info<!-- ELSE -->alert-success<!-- ENDIF available.core -->">
<strong>{available.title}</strong> {available.route}
<span class="pull-right badge"><!-- IF available.core -->core<!-- ELSE -->plugin<!-- ENDIF available.core --></span>
</li>
<!-- END available -->
</ul>
</div>
</div>
</div>
<div class="col-lg-3 acp-sidebar">
<div class="panel panel-default">
<div class="panel-heading">Navigation Control</div>
<div class="panel-body">
<button class="btn btn-primary btn-md" id="save">Save Changes</button>
</div>
</div>
</div>
</div>

@ -4,6 +4,7 @@
<li class="active"><a href="{relative_path}/admin/general/dashboard">Dashboard</a></li> <li class="active"><a href="{relative_path}/admin/general/dashboard">Dashboard</a></li>
<li><a href="{relative_path}/admin/general/languages">Languages</a></li> <li><a href="{relative_path}/admin/general/languages">Languages</a></li>
<li><a href="{relative_path}/admin/general/sounds">Sounds</a></li> <li><a href="{relative_path}/admin/general/sounds">Sounds</a></li>
<li><a href="{relative_path}/admin/general/navigation">Navigation</a></li>
</ul> </ul>
</div> </div>
<div class="sidebar-nav"> <div class="sidebar-nav">

Loading…
Cancel
Save