mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
closes #4558
This commit is contained in:
@@ -78,11 +78,12 @@ define('forum/account/settings', ['forum/account/header', 'components', 'csrf'],
|
|||||||
};
|
};
|
||||||
|
|
||||||
function toggleCustomRoute() {
|
function toggleCustomRoute() {
|
||||||
$('[data-property="homePageCustom"]').val('');
|
|
||||||
if ($('[data-property="homePageRoute"]').val() === 'custom') {
|
if ($('[data-property="homePageRoute"]').val() === 'custom') {
|
||||||
$('#homePageCustom').show();
|
$('#homePageCustom').show();
|
||||||
}else{
|
} else {
|
||||||
$('#homePageCustom').hide();
|
$('#homePageCustom').hide();
|
||||||
|
$('[data-property="homePageCustom"]').val('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,8 +96,18 @@ settingsController.get = function(req, res, callback) {
|
|||||||
{ "name": "Yeti", "value": "yeti" }
|
{ "name": "Yeti", "value": "yeti" }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var isCustom = true;
|
||||||
userData.homePageRoutes.forEach(function(route) {
|
userData.homePageRoutes.forEach(function(route) {
|
||||||
route.selected = route.route === userData.settings.homePageRoute;
|
route.selected = route.route === userData.settings.homePageRoute;
|
||||||
|
if (route.selected) {
|
||||||
|
isCustom = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
userData.homePageRoutes.push({
|
||||||
|
route: 'custom',
|
||||||
|
name: 'Custom',
|
||||||
|
selected: isCustom
|
||||||
});
|
});
|
||||||
|
|
||||||
userData.bootswatchSkinOptions.forEach(function(skin) {
|
userData.bootswatchSkinOptions.forEach(function(skin) {
|
||||||
@@ -142,40 +152,28 @@ function getHomePageRoutes(callback) {
|
|||||||
name: 'Category: ' + category.name
|
name: 'Category: ' + category.name
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
next(null, categoryData);
|
|
||||||
|
categoryData = categoryData || [];
|
||||||
|
|
||||||
|
plugins.fireHook('filter:homepage.get', {routes: [
|
||||||
|
{
|
||||||
|
route: 'categories',
|
||||||
|
name: 'Categories'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
route: 'recent',
|
||||||
|
name: 'Recent'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
route: 'popular',
|
||||||
|
name: 'Popular'
|
||||||
|
}
|
||||||
|
].concat(categoryData)}, next);
|
||||||
|
},
|
||||||
|
function (data, next) {
|
||||||
|
next(null, data.routes);
|
||||||
}
|
}
|
||||||
], function(err, categoryData) {
|
], callback);
|
||||||
if (err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
categoryData = categoryData || [];
|
|
||||||
|
|
||||||
plugins.fireHook('filter:homepage.get', {routes: [
|
|
||||||
{
|
|
||||||
route: 'categories',
|
|
||||||
name: 'Categories'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
route: 'recent',
|
|
||||||
name: 'Recent'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
route: 'popular',
|
|
||||||
name: 'Popular'
|
|
||||||
}
|
|
||||||
].concat(categoryData)}, function(err, data) {
|
|
||||||
if (err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
data.routes.push({
|
|
||||||
route: 'custom',
|
|
||||||
name: 'Custom'
|
|
||||||
});
|
|
||||||
|
|
||||||
callback(null, data.routes);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user