mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
Add user home pages. #3616
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
"allowLocalLogin": 1,
|
"allowLocalLogin": 1,
|
||||||
"allowAccountDelete": 1,
|
"allowAccountDelete": 1,
|
||||||
"allowFileUploads": 0,
|
"allowFileUploads": 0,
|
||||||
|
"allowUserHomePage": 1,
|
||||||
"maximumFileSize": 2048,
|
"maximumFileSize": 2048,
|
||||||
"minimumTitleLength": 3,
|
"minimumTitleLength": 3,
|
||||||
"maximumTitleLength": 255,
|
"maximumTitleLength": 255,
|
||||||
|
|||||||
@@ -68,7 +68,20 @@ define('forum/account/settings', ['forum/account/header'], function(header) {
|
|||||||
|
|
||||||
css.attr('href', val);
|
css.attr('href', val);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('[data-property="homePageRoute"]').on('change', toggleCustomRoute);
|
||||||
|
|
||||||
|
toggleCustomRoute();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function toggleCustomRoute() {
|
||||||
|
$('[data-property="homePageCustom"]').val('');
|
||||||
|
if ($('[data-property="homePageRoute"]').val() === 'custom') {
|
||||||
|
$('#homePageCustom').show();
|
||||||
|
}else{
|
||||||
|
$('#homePageCustom').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return AccountSettings;
|
return AccountSettings;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,5 +11,4 @@ var accountsController = {
|
|||||||
chats: require('./accounts/chats')
|
chats: require('./accounts/chats')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
module.exports = accountsController;
|
module.exports = accountsController;
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ apiController.getConfig = function(req, res, next) {
|
|||||||
config.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads) === 1;
|
config.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads) === 1;
|
||||||
config.allowTopicsThumbnail = parseInt(meta.config.allowTopicsThumbnail, 10) === 1;
|
config.allowTopicsThumbnail = parseInt(meta.config.allowTopicsThumbnail, 10) === 1;
|
||||||
config.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1;
|
config.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1;
|
||||||
|
config.allowUserHomePage = parseInt(meta.config.allowUserHomePage, 10) === 1;
|
||||||
config.privateUserInfo = parseInt(meta.config.privateUserInfo, 10) === 1;
|
config.privateUserInfo = parseInt(meta.config.privateUserInfo, 10) === 1;
|
||||||
config.privateTagListing = parseInt(meta.config.privateTagListing, 10) === 1;
|
config.privateTagListing = parseInt(meta.config.privateTagListing, 10) === 1;
|
||||||
config.usePagination = parseInt(meta.config.usePagination, 10) === 1;
|
config.usePagination = parseInt(meta.config.usePagination, 10) === 1;
|
||||||
|
|||||||
@@ -33,22 +33,27 @@ var Controllers = {
|
|||||||
|
|
||||||
|
|
||||||
Controllers.home = function(req, res, next) {
|
Controllers.home = function(req, res, next) {
|
||||||
var route = meta.config.homePageRoute || meta.config.homePageCustom || 'categories',
|
var route = meta.config.homePageRoute || meta.config.homePageCustom || 'categories';
|
||||||
hook = 'action:homepage.get:' + route;
|
|
||||||
|
|
||||||
if (plugins.hasListeners(hook)) {
|
user.getSettings(req.uid, function(err, settings) {
|
||||||
plugins.fireHook(hook, {req: req, res: res, next: next});
|
if (!err) route = settings.homePageRoute || route;
|
||||||
} else {
|
|
||||||
if (route === 'categories' || route === '/') {
|
var hook = 'action:homepage.get:' + route;
|
||||||
Controllers.categories.list(req, res, next);
|
|
||||||
} else if (route === 'recent') {
|
if (plugins.hasListeners(hook)) {
|
||||||
Controllers.recent.get(req, res, next);
|
plugins.fireHook(hook, {req: req, res: res, next: next});
|
||||||
} else if (route === 'popular') {
|
|
||||||
Controllers.popular.get(req, res, next);
|
|
||||||
} else {
|
} else {
|
||||||
res.redirect(route);
|
if (route === 'categories' || route === '/') {
|
||||||
|
Controllers.categories.list(req, res, next);
|
||||||
|
} else if (route === 'recent') {
|
||||||
|
Controllers.recent.get(req, res, next);
|
||||||
|
} else if (route === 'popular') {
|
||||||
|
Controllers.popular.get(req, res, next);
|
||||||
|
} else {
|
||||||
|
res.redirect(route);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Controllers.reset = function(req, res, next) {
|
Controllers.reset = function(req, res, next) {
|
||||||
|
|||||||
@@ -115,7 +115,8 @@ module.exports = function(User) {
|
|||||||
sendPostNotifications: data.sendPostNotifications,
|
sendPostNotifications: data.sendPostNotifications,
|
||||||
restrictChat: data.restrictChat,
|
restrictChat: data.restrictChat,
|
||||||
topicSearchEnabled: data.topicSearchEnabled,
|
topicSearchEnabled: data.topicSearchEnabled,
|
||||||
groupTitle: data.groupTitle
|
groupTitle: data.groupTitle,
|
||||||
|
homePageRoute: data.homePageCustom || data.homePageRoute
|
||||||
};
|
};
|
||||||
|
|
||||||
if (data.bootswatchSkin) {
|
if (data.bootswatchSkin) {
|
||||||
|
|||||||
@@ -12,11 +12,18 @@
|
|||||||
<option value="{routes.route}">{routes.name}</option>
|
<option value="{routes.route}">{routes.name}</option>
|
||||||
<!-- END routes -->
|
<!-- END routes -->
|
||||||
</select>
|
</select>
|
||||||
<br>
|
|
||||||
<div id="homePageCustom" style="display: none;">
|
<div id="homePageCustom" style="display: none;">
|
||||||
|
<br>
|
||||||
<label>Custom Route</label>
|
<label>Custom Route</label>
|
||||||
<input type="text" class="form-control" data-field="homePageCustom"/>
|
<input type="text" class="form-control" data-field="homePageCustom"/>
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="checkbox">
|
||||||
|
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||||
|
<input class="mdl-switch__input" type="checkbox" data-field="allowUserHomePage">
|
||||||
|
<span class="mdl-switch__label"><strong>Allow User Home Pages</strong></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user