This commit is contained in:
Barış Soner Uşaklı
2015-03-31 14:19:08 -04:00
parent 16c6578bdb
commit b65f456d70
3 changed files with 22 additions and 15 deletions

View File

@@ -471,6 +471,26 @@ app.cacheBuster = null;
});
}
function handleNewTopic() {
$('#content').on('click', '#new_topic', function() {
require(['composer'], function(composer) {
var cid = ajaxify.variables.get('category_id');
if (cid) {
composer.newTopic(cid);
} else {
socket.emit('categories.getCategoriesByPrivilege', 'topics:create', function(err, categories) {
if (err) {
return app.alertError(err.message);
}
if (categories.length) {
composer.newTopic(categories[0].cid);
}
});
}
});
});
}
app.load = function() {
$('document').ready(function () {
var url = ajaxify.start(window.location.pathname.slice(1), true, window.location.search);
@@ -482,6 +502,8 @@ app.cacheBuster = null;
handleSearch();
}
handleNewTopic();
$('#logout-link').on('click', app.logout);
Visibility.change(function(e, state){