breadcrumbs, and changed home in nav to 'forum'

v1.18.x
psychobunny 12 years ago
parent b2bc967e9b
commit 1bec9fc5aa

@ -85,12 +85,14 @@ var socket,
var post_window = null,
submit_post_btn = null,
post_title = null,
reply_title = null,
post_content = null;
app.open_post_window = function(post_mode, id) {
app.open_post_window = function(post_mode, id, title) {
submit_post_btn = submit_post_btn || document.getElementById('submit_post_btn');
post_title = post_title || document.getElementById('post_title');
reply_title = reply_title || document.getElementById('reply_title');
post_content = post_content || document.getElementById('post_content');
@ -98,13 +100,16 @@ var socket,
jQuery(post_window).slideToggle(250);
if (post_mode == null || post_mode == 'topic') {
post_title.style.display = 'block';
post_title.style.display = "block";
reply_title.style.display = "none";
post_title.focus();
submit_post_btn.onclick = function() {
app.post_topic();
}
} else {
post_title.style.display = 'none';
post_title.style.display = "none";
reply_title.style.display = "block";
reply_title.innerHTML = 'You are replying to "' + title + '"';
post_content.focus();
submit_post_btn.onclick = function() {
app.post_reply(id)

@ -119,7 +119,6 @@ function load_template(callback) {
url = (url === '') ? 'home' : url;
jQuery.get(API_URL + url, function(data) {
document.getElementById('content').innerHTML = templates[url.split('/')[0]].parse(JSON.parse(data));
if (callback) callback();
});

@ -117,6 +117,11 @@
font-size: 12px;
font-weight: bold;
}
#reply_title {
font-size: 17px;
padding-top: 14px;
font-weight: 600;
}
</style>
</head>
@ -132,7 +137,7 @@
</button>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="/">Home</a></li>
<li class="active"><a href="/">Forum</a></li>
<li><a href="/register">Register</a></li>
<li><a href="/login">Login</a></li>
</ul>
@ -148,6 +153,7 @@
<div class="post-title-container">
<div class="container">
<input id="post_title" placeholder="Enter your topic title here." />
<span id="reply_title"></span>
</div>
</div>
<div class="post-content-container">
@ -172,4 +178,5 @@
</div>
</div>
<div id="notification_window"></div>
<div class="container" id="content">

@ -1,3 +1,10 @@
<div class="container">
<ul class="breadcrumb">
<li><a href="/">Home</a> <span class="divider">/</span></li>
<li class="active">{TOPIC_NAME}</li>
</ul>
</div>
<ul class="topic-container">
<!-- BEGIN posts -->
<li class="topic-row">
@ -11,6 +18,6 @@
<script type="text/javascript">
var post_reply = document.getElementById('post_reply');
post_reply.onclick = function() {
app.open_post_window('reply', {TOPIC_ID});
app.open_post_window('reply', "{TOPIC_ID}", "{TOPIC_NAME}");
}
</script>

@ -16,47 +16,47 @@ var RDB = require('./redis.js'),
if (start == null) start = 0;
if (end == null) end = start + 10;
RDB.lrange('tid:' + tid + ':posts', start, end, function(pids) {
var content = [],
uid = [],
timestamp = [];
for (var i=0, ii=pids.length; i<ii; i++) {
content.push('pid:' + pids[i] + ':content');
uid.push('pid:' + pids[i] + ':uid');
timestamp.push('pid:' + pids[i] + ':timestamp');
}
if (pids.length > 0) {
RDB.multi()
.mget(content)
.mget(uid)
.mget(timestamp)
.exec(function(err, replies) {
content = replies[0];
uid = replies[1];
timestamp = replies[2];
var posts = [];
for (var i=0, ii=content.length; i<ii; i++) {
posts.push({
'content' : content[i],
'uid' : uid[i],
'timestamp' : timestamp[i],
'relativeTime': utils.relativeTime(timestamp[i])
});
}
callback({'TOPIC_ID': tid, 'posts': posts});
});
} else {
callback({});
}
RDB.get('tid:' + tid + ':title', function(topic_name) { //do these asynch later
RDB.lrange('tid:' + tid + ':posts', start, end, function(pids) {
var content = [],
uid = [],
timestamp = [];
for (var i=0, ii=pids.length; i<ii; i++) {
content.push('pid:' + pids[i] + ':content');
uid.push('pid:' + pids[i] + ':uid');
timestamp.push('pid:' + pids[i] + ':timestamp');
}
if (pids.length > 0) {
RDB.multi()
.mget(content)
.mget(uid)
.mget(timestamp)
.exec(function(err, replies) {
content = replies[0];
uid = replies[1];
timestamp = replies[2];
var posts = [];
for (var i=0, ii=content.length; i<ii; i++) {
posts.push({
'content' : content[i],
'uid' : uid[i],
'timestamp' : timestamp[i],
'relativeTime': utils.relativeTime(timestamp[i])
});
}
callback({'TOPIC_NAME':topic_name, 'TOPIC_ID': tid, 'posts': posts});
});
} else {
callback({});
}
});
});
}

Loading…
Cancel
Save