Baris Usakli 12 years ago
commit 85acabf1f6

@ -28,7 +28,6 @@ var templates = {};
$.getJSON('/templates/config.json', function(data) { $.getJSON('/templates/config.json', function(data) {
config = data; config = data;
console.log('loaded');
}); });
for (var t in templatesToLoad) { for (var t in templatesToLoad) {

@ -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"> <ul class="topic-container">
<!-- BEGIN topics --> <!-- BEGIN topics -->
<a href="../../topic/{topics.slug}"><li class="topic-row"> <a href="../../topic/{topics.slug}"><li class="topic-row">

@ -1,5 +1,8 @@
{ {
"custom_mapping": { "custom_mapping": {
"users": "account" "users": "account",
"latest": "category",
"popular": "category",
"active": "category"
} }
} }

@ -27,15 +27,15 @@
</button> </button>
<div class="nav-collapse collapse"> <div class="nav-collapse collapse">
<ul class="nav"> <ul class="nav">
<li id="fat-menu" class="active dropdown"> <li>
<a href="#" id="topic_dropdown" role="button" class="dropdown-toggle" data-toggle="dropdown">Topics <span class="badge badge-inverse">3</span></a> <a href="/latest">Recent <span class="badge badge-inverse">3</span></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="topic_dropdown"> </li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">latest post</a></li> <li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">another latest post</a></li> <a href="/popular">Popular</a>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">moar latest posts</a></li> </li>
</ul> <li>
<a href="/active">Active</a>
</li> </li>
</ul> </ul>
<ul class="nav pull-right" id="right-menu"> <ul class="nav pull-right" id="right-menu">
<li><a href="/users" id="user_label"></a></li> <li><a href="/users" id="user_label"></a></li>

@ -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
});
}); });

@ -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) // Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section)
(function() { (function() {
var routes = ['', 'login', 'register', 'account']; var routes = ['', 'login', 'register', 'account', 'latest', 'popular', 'active'];
for (var i=0, ii=routes.length; i<ii; i++) { for (var i=0, ii=routes.length; i<ii; i++) {
(function(route) { (function(route) {
@ -192,10 +192,24 @@ passport.deserializeUser(function(uid, done) {
break; break;
case 'category' : case 'category' :
global.modules.topics.get(function(data) { global.modules.topics.get(function(data) {
console.log(data);
res.send(JSON.stringify(data)); res.send(JSON.stringify(data));
}, req.params.id); }, req.params.id);
break; 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' : case 'users' :
get_account_fn(req, res, function(userData) { get_account_fn(req, res, function(userData) {
res.send(JSON.stringify(userData)); res.send(JSON.stringify(userData));

Loading…
Cancel
Save