v1.18.x
barisusakli 10 years ago
parent 4d6a6f64b0
commit aaa1fae558

@ -34,8 +34,6 @@ define('forum/topic/posts', [
var posts = data.posts;
socket.emit('topics.getPageCount', ajaxify.variables.get('topic_id'), function(err, newPageCount) {
pagination.recreatePaginationLinks(newPageCount);
if (pagination.currentPage === pagination.pageCount) {
createNewPosts(data);
} else if(data.posts && data.posts.length && parseInt(data.posts[0].uid, 10) === parseInt(app.uid, 10)) {

@ -22,7 +22,8 @@ categoriesController.recent = function(req, res, next) {
}
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
data['rssFeedUrl'] = nconf.get('relative_path') + '/recent.rss';
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[recent:title]]'}]);
res.render('recent', data);
});
};
@ -52,7 +53,9 @@ categoriesController.popular = function(req, res, next) {
var data = {
topics: topics,
'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1
'feeds:disableRSS': parseInt(meta.config['feeds:disableRSS'], 10) === 1,
rssFeedUrl: nconf.get('relative_path') + '/popular.rss',
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[global:header.popular]]'}])
};
if (uid === 0) {
@ -72,6 +75,7 @@ categoriesController.unread = function(req, res, next) {
return next(err);
}
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[unread:title]]'}]);
res.render('unread', data);
});
};
@ -188,7 +192,7 @@ categoriesController.get = function(req, res, next) {
url: nconf.get('relative_path') + '/category/' + categoryData.slug
}
];
helpers.buildBreadcrumbs(categoryData.parentCid, function(err, crumbs) {
helpers.buildCategoryBreadcrumbs(categoryData.parentCid, function(err, crumbs) {
if (err) {
return next(err);
}
@ -255,6 +259,7 @@ categoriesController.get = function(req, res, next) {
data.currentPage = page;
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
data['rssFeedUrl'] = nconf.get('relative_path') + '/category/' + data.cid + '.rss';
pagination.create(data.currentPage, data.pageCount, data);

@ -38,7 +38,7 @@ helpers.notAllowed = function(req, res, error) {
}
};
helpers.buildBreadcrumbs = function(cid, callback) {
helpers.buildCategoryBreadcrumbs = function(cid, callback) {
var breadcrumbs = [];
async.whilst(function() {
@ -62,15 +62,33 @@ helpers.buildBreadcrumbs = function(cid, callback) {
return callback(err);
}
translator.translate('[[global:home]]', meta.config.defaultLang || 'en_GB', function(translated) {
breadcrumbs.unshift({
text: translated,
url: nconf.get('relative_path') + '/'
});
callback(null, breadcrumbs);
breadcrumbs.unshift({
text: '[[global:home]]',
url: nconf.get('relative_path') + '/'
});
callback(null, breadcrumbs);
});
};
helpers.buildBreadcrumbs = function(crumbs) {
var breadcrumbs = [
{
text: '[[global:home]]',
url: nconf.get('relative_path') + '/'
}
];
crumbs.forEach(function(crumb) {
if (crumb) {
if (crumb.url) {
crumb.url = nconf.get('relative_path') + crumb.url;
}
breadcrumbs.push(crumb);
}
});
return breadcrumbs;
};
module.exports = helpers;

@ -105,9 +105,18 @@ Controllers.home = function(req, res, next) {
};
Controllers.reset = function(req, res, next) {
res.render(req.params.code ? 'reset_code' : 'reset', {
reset_code: req.params.code ? req.params.code : null
});
if (req.params.code) {
res.render('reset_code', {
reset_code: req.params.code ? req.params.code : null,
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]', url: '/reset'}, {text: '[[reset_password:update_password]]'}])
});
} else {
res.render('reset', {
reset_code: req.params.code ? req.params.code : null,
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]'}])
});
}
};
Controllers.login = function(req, res, next) {
@ -120,6 +129,7 @@ Controllers.login = function(req, res, next) {
data.showResetLink = emailersPresent;
data.allowLocalLogin = parseInt(meta.config.allowLocalLogin, 10) === 1;
data.allowRegistration = parseInt(meta.config.allowRegistration, 10) === 1;
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[global:login]]'}]);
data.error = req.flash('error')[0];
res.render('login', data);
@ -151,6 +161,7 @@ Controllers.register = function(req, res, next) {
data.maximumUsernameLength = meta.config.maximumUsernameLength;
data.minimumPasswordLength = meta.config.minimumPasswordLength;
data.termsOfUse = meta.config.termsOfUse;
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[register:register]]'}]);
data.regFormEntry = [];
data.error = req.flash('error')[0];
@ -200,7 +211,8 @@ Controllers.outgoing = function(req, res, next) {
var url = req.query.url,
data = {
url: url,
title: meta.config.title
title: meta.config.title,
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[notifications:outgoing_link]]'}])
};
if (url) {

@ -12,7 +12,7 @@ searchController.search = function(req, res, next) {
if (!plugins.hasListeners('filter:search.query')) {
return helpers.notFound(req, res);
}
var breadcrumbs = helpers.buildBreadcrumbs([{text: '[[global:search]]'}]);
if (!req.params.term) {
return res.render('search', {
time: 0,
@ -20,7 +20,8 @@ searchController.search = function(req, res, next) {
posts: [],
topics: [],
users: [],
tags: []
tags: [],
breadcrumbs: breadcrumbs
});
}
@ -38,6 +39,7 @@ searchController.search = function(req, res, next) {
return next(err);
}
results.breadcrumbs = breadcrumbs;
res.render('search', results);
});
};

@ -5,7 +5,8 @@ var tagsController = {},
nconf = require('nconf'),
validator = require('validator'),
meta = require('../meta'),
topics = require('../topics');
topics = require('../topics'),
helpers = require('./helpers');
tagsController.getTag = function(req, res, next) {
var tag = validator.escape(req.params.tag);
@ -41,8 +42,13 @@ tagsController.getTag = function(req, res, next) {
content: nconf.get('url') + '/tags/' + tag
}
];
res.render('tag', {topics: topics, tag: tag, nextStart: end + 1});
var data = {
topics: topics,
tag: tag,
nextStart: end + 1,
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[tags:tags]]', url: '/tags'}, {text: tag}])
};
res.render('tag', data);
});
});
};
@ -52,8 +58,12 @@ tagsController.getTags = function(req, res, next) {
if (err) {
return next(err);
}
res.render('tags', {tags: tags, nextStart: 100});
var data = {
tags: tags,
nextStart: 100,
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[tags:tags]]'}])
};
res.render('tags', data);
});
};

@ -139,7 +139,7 @@ topicsController.get = function(req, res, next) {
}
];
helpers.buildBreadcrumbs(topicData.category.parentCid, function(err, crumbs) {
helpers.buildCategoryBreadcrumbs(topicData.category.parentCid, function(err, crumbs) {
if (err) {
return next(err);
}
@ -255,6 +255,7 @@ topicsController.get = function(req, res, next) {
data['reputation:disabled'] = parseInt(meta.config['reputation:disabled'], 10) === 1;
data['downvote:disabled'] = parseInt(meta.config['downvote:disabled'], 10) === 1;
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
data['rssFeedUrl'] = nconf.get('relative_path') + '/topic/' + data.tid + '.rss';
topics.increaseViewCount(tid);

Loading…
Cancel
Save