mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-06 23:52:58 +01:00
nav - basic ACP setup
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
"enabled": true,
|
||||
"iconClass": "fa-clock-o",
|
||||
"textClass": "visible-xs-inline",
|
||||
"text": "[[global:]]"
|
||||
"text": "[[global:header.recent]]"
|
||||
},
|
||||
{
|
||||
"route": "/tags",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@import "./mixins";
|
||||
|
||||
@import "./general/dashboard";
|
||||
@import "./general/navigation";
|
||||
@import "./manage/categories";
|
||||
@import "./manage/groups";
|
||||
@import "./manage/tags";
|
||||
|
||||
6
public/less/admin/general/navigation.less
Normal file
6
public/less/admin/general/navigation.less
Normal file
@@ -0,0 +1,6 @@
|
||||
#navigation {
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ var adminController = {
|
||||
settings: {},
|
||||
logger: {},
|
||||
sounds: {},
|
||||
navigation: {},
|
||||
themes: {},
|
||||
users: require('./admin/users'),
|
||||
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) {
|
||||
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) {
|
||||
var themeDir = path.join(__dirname, '../../node_modules/' + req.params.theme);
|
||||
fs.exists(themeDir, function(exists) {
|
||||
|
||||
@@ -23,9 +23,20 @@ admin.save = function(data, callback) {
|
||||
], callback);
|
||||
};
|
||||
|
||||
admin.getAvailable = function(data, callback) {
|
||||
var core = require('../../install/data/navigation.json');
|
||||
plugins.fireHook('filter:navigation.available', core, callback);
|
||||
admin.get = function(callback) {
|
||||
async.parallel({
|
||||
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;
|
||||
@@ -43,6 +43,7 @@ function addRoutes(router, middleware, controllers) {
|
||||
router.get('/general/dashboard', controllers.admin.home);
|
||||
router.get('/general/languages', controllers.admin.languages.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/active', controllers.admin.categories.active);
|
||||
|
||||
67
src/views/admin/general/navigation.tpl
Normal file
67
src/views/admin/general/navigation.tpl
Normal file
@@ -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><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/navigation">Navigation</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sidebar-nav">
|
||||
|
||||
Reference in New Issue
Block a user