mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
added functionality to post button. also introduced some underlying concepts regarding modules and pulling template vars
This commit is contained in:
@@ -48,6 +48,7 @@ var ajaxify = {};
|
||||
|
||||
jQuery('#footer, #content').fadeOut(100);
|
||||
|
||||
templates.flush();
|
||||
templates.load_template(function() {
|
||||
exec_body_scripts(content);
|
||||
|
||||
|
||||
@@ -191,6 +191,11 @@ var socket,
|
||||
socket.emit('api:user.get_online_users', uids);
|
||||
}
|
||||
|
||||
// here is where all modules' onNavigate should be called, I think.
|
||||
require(['mobileMenu'], function(mobileMenu) {
|
||||
mobileMenu.onNavigate();
|
||||
});
|
||||
|
||||
|
||||
populate_online_users();
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ define(function() {
|
||||
|
||||
var categories = null,
|
||||
overlay = null,
|
||||
menuBtn = null;
|
||||
menuBtn = null,
|
||||
postBtn = null;
|
||||
|
||||
|
||||
function loadCategories(callback) {
|
||||
@@ -63,9 +64,27 @@ define(function() {
|
||||
}
|
||||
|
||||
|
||||
mobileMenu.onNavigate = function() {
|
||||
var cid = templates.get('category_id');
|
||||
|
||||
if (cid) {
|
||||
postBtn.style.display = 'inline-block';
|
||||
postBtn.onclick = function() {
|
||||
require(['composer'], function(cmp) {
|
||||
cmp.push(0, cid); //todo check if in post
|
||||
});
|
||||
};
|
||||
} else {
|
||||
postBtn.style.display = 'none';
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
mobileMenu.init = function() {
|
||||
overlay = overlay || document.getElementById('mobile-menu-overlay');
|
||||
menuBtn = menuBtn || document.getElementById('mobile-menu-btn');
|
||||
postBtn = postBtn || document.getElementById('mobile-post-btn');
|
||||
|
||||
menuBtn.onclick = function() {
|
||||
animateIcons();
|
||||
@@ -73,9 +92,11 @@ define(function() {
|
||||
|
||||
|
||||
loadCategories(displayCategories);
|
||||
mobileMenu.onNavigate();
|
||||
}
|
||||
|
||||
return {
|
||||
init: mobileMenu.init
|
||||
init: mobileMenu.init,
|
||||
onNavigate: mobileMenu.onNavigate
|
||||
}
|
||||
});
|
||||
@@ -181,6 +181,10 @@
|
||||
|
||||
}
|
||||
|
||||
templates.flush = function() {
|
||||
parsed_variables = {};
|
||||
}
|
||||
|
||||
templates.get = function(key) {
|
||||
return parsed_variables[key];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user