Node.js based forum software built for the modern web
finished recent, popular and active posts shells, just need to update api methods
psychobunny31542cd9bea3
diff --git a/public/src/templates.js b/public/src/templates.jsindex 455b0b7439..8eaea3502f 100644--- a/public/src/templates.js+++ b/public/src/templates.js@@ -28,7 +28,6 @@ var templates = {};$.getJSON('/templates/config.json', function(data) {config = data;- console.log('loaded');});for (var t in templatesToLoad) {diff --git a/public/templates/category.tpl b/public/templates/category.tplindex 4fb3c46bc8..513070c198 100644--- a/public/templates/category.tpl+++ b/public/templates/category.tpl@@ -1,4 +1,4 @@-<button id="new_post" class="btn btn-primary btn-large">New Topic</button>+<button id="new_post" class="btn btn-primary btn-large {show_topic_button}">New Topic</button><ul class="topic-container"><!-- BEGIN topics --><a href="../../topic/{topics.slug}"><li class="topic-row">diff --git a/public/templates/config.json b/public/templates/config.jsonindex 1fef6307ae..78bf9e0551 100644--- a/public/templates/config.json+++ b/public/templates/config.json@@ -1,5 +1,8 @@{"custom_mapping": {- "users": "account"+ "users": "account",+ "latest": "category",+ "popular": "category",+ "active": "category"}}\ No newline at end of filediff --git a/public/templates/header.tpl b/public/templates/header.tplindex aa292c8095..463e1a3440 100644--- a/public/templates/header.tpl+++ b/public/templates/header.tpl@@ -27,15 +27,15 @@</button><div class="nav-collapse collapse"><ul class="nav">- <li id="fat-menu" class="active dropdown">- <a href="#" id="topic_dropdown" role="button" class="dropdown-toggle" data-toggle="dropdown">Topics <span class="badge badge-inverse">3</span></a>- <ul class="dropdown-menu" role="menu" aria-labelledby="topic_dropdown">- <li role="presentation"><a role="menuitem" tabindex="-1" href="#">latest post</a></li>- <li role="presentation"><a role="menuitem" tabindex="-1" href="#">another latest post</a></li>- <li role="presentation"><a role="menuitem" tabindex="-1" href="#">moar latest posts</a></li>- </ul>+ <li>+ <a href="/latest">Recent <span class="badge badge-inverse">3</span></a>+ </li>+ <li>+ <a href="/popular">Popular</a>+ </li>+ <li>+ <a href="/active">Active</a></li>-</ul><ul class="nav pull-right" id="right-menu"><li><a href="/account" id="user_label"></a></li>diff --git a/src/topics.js b/src/topics.jsindex 2ae3a5fa65..be6bf06e32 100644--- a/src/topics.js+++ b/src/topics.js@@ -66,7 +66,11 @@ var RDB = require('./redis.js'),});}- callback({'category_id': category_id, 'topics': topics});+ callback({+ 'show_topic_button' : category_id ? 'show' : 'hidden',+ 'category_id': category_id,+ 'topics': topics+ });});diff --git a/src/webserver.js b/src/webserver.jsindex d74ebc9467..345500cca3 100644--- a/src/webserver.js+++ b/src/webserver.js@@ -125,7 +125,7 @@ passport.deserializeUser(function(uid, done) {// Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section)(function() {- var routes = ['', 'login', 'register', 'account'];+ var routes = ['', 'login', 'register', 'account', 'latest', 'popular', 'active'];for (var i=0, ii=routes.length; i<ii; i++) {(function(route) {@@ -192,10 +192,24 @@ passport.deserializeUser(function(uid, done) {break;case 'category' :global.modules.topics.get(function(data) {- console.log(data);res.send(JSON.stringify(data));}, req.params.id);break;+ case 'latest' :+ global.modules.topics.get(function(data) {+ res.send(JSON.stringify(data));+ });+ break;+ case 'popular' :+ global.modules.topics.get(function(data) {+ res.send(JSON.stringify(data));+ });+ break;+ case 'active' :+ global.modules.topics.get(function(data) {+ res.send(JSON.stringify(data));+ });+ break;case 'users' :get_account_fn(req, res, function(userData) {res.send(JSON.stringify(userData));