nav - added enabled/disabled

v1.18.x
psychobunny 10 years ago
parent 6c77adfd3c
commit 307204fc38

@ -3,6 +3,7 @@
"id": "unread-count", "id": "unread-count",
"route": "/unread", "route": "/unread",
"title": "[[global:header.unread]]", "title": "[[global:header.unread]]",
"enabled": true,
"iconClass": "fa-inbox", "iconClass": "fa-inbox",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:header.unread]]", "text": "[[global:header.unread]]",
@ -13,6 +14,7 @@
{ {
"route": "/recent", "route": "/recent",
"title": "[[global:header.recent]]", "title": "[[global:header.recent]]",
"enabled": true,
"iconClass": "fa-clock-o", "iconClass": "fa-clock-o",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:]]" "text": "[[global:]]"
@ -20,6 +22,7 @@
{ {
"route": "/tags", "route": "/tags",
"title": "[[global:header.tags]]", "title": "[[global:header.tags]]",
"enabled": true,
"iconClass": "fa-tags", "iconClass": "fa-tags",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:header.tags]]" "text": "[[global:header.tags]]"
@ -27,6 +30,7 @@
{ {
"route": "/popular", "route": "/popular",
"title": "[[global:header.popular]]", "title": "[[global:header.popular]]",
"enabled": true,
"iconClass": "fa-fire", "iconClass": "fa-fire",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:header.popular]]" "text": "[[global:header.popular]]"
@ -34,6 +38,7 @@
{ {
"route": "/users", "route": "/users",
"title": "[[global:header.users]]", "title": "[[global:header.users]]",
"enabled": true,
"iconClass": "fa-user", "iconClass": "fa-user",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:header.users]]", "text": "[[global:header.users]]",
@ -45,6 +50,7 @@
{ {
"route": "/groups", "route": "/groups",
"title": "[[global:header.groups]]", "title": "[[global:header.groups]]",
"enabled": true,
"iconClass": "fa-group", "iconClass": "fa-group",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:header.groups]]" "text": "[[global:header.groups]]"
@ -53,6 +59,7 @@
"route": "/admin", "route": "/admin",
"target": "_top", "target": "_top",
"title": "[[global:header.admin]]", "title": "[[global:header.admin]]",
"enabled": true,
"iconClass": "fa-cogs", "iconClass": "fa-cogs",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:header.admin]]", "text": "[[global:header.admin]]",
@ -63,6 +70,7 @@
{ {
"route": "/search", "route": "/search",
"title": "[[global:header.search]]", "title": "[[global:header.search]]",
"enabled": true,
"iconClass": "fa-search", "iconClass": "fa-search",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "[[global:header.search]]", "text": "[[global:header.search]]",

@ -8,9 +8,14 @@ var navigation = {},
navigation.get = function(callback) { navigation.get = function(callback) {
db.getSortedSetRange('navigation:enabled', 0, -1, function(err, data) { db.getSortedSetRange('navigation:enabled', 0, -1, function(err, data) {
data = data.map(function(item) {
return JSON.parse(item); data = data
}); .filter(function(item) {
return item.enabled;
})
.map(function(item) {
return JSON.parse(item);
});
callback(err, data); callback(err, data);
}) })

@ -21,7 +21,7 @@ var db = require('./database'),
schemaDate, thisSchemaDate, schemaDate, thisSchemaDate,
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema // IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
latestSchema = Date.UTC(2015, 1, 25); latestSchema = Date.UTC(2015, 1, 25, 1);
Upgrade.check = function(callback) { Upgrade.check = function(callback) {
db.get('schemaDate', function(err, value) { db.get('schemaDate', function(err, value) {
@ -943,7 +943,7 @@ Upgrade.upgrade = function(callback) {
} }
}, },
function(next) { function(next) {
thisSchemaDate = Date.UTC(2015, 1, 25); thisSchemaDate = Date.UTC(2015, 1, 25, 1);
if (schemaDate < thisSchemaDate) { if (schemaDate < thisSchemaDate) {
updatesMade = true; updatesMade = true;
winston.info('[2015/02/25] Upgrading menu items to dynamic navigation system'); winston.info('[2015/02/25] Upgrading menu items to dynamic navigation system');

Loading…
Cancel
Save