post replies, unfinished

v1.18.x
psychobunny 12 years ago
parent f8345a1223
commit 0f3f2bb859

@ -78,12 +78,16 @@ var socket,
} }
} }
var post_window = null; var post_window = null,
app.open_post_window = function() { mode = 'topic',
topic_id = null;
app.open_post_window = function(post_mode, id) {
post_window = post_window || document.getElementById('post_window'); post_window = post_window || document.getElementById('post_window');
jQuery(post_window).slideToggle(250); jQuery(post_window).slideToggle(250);
document.getElementById('post_title').focus(); document.getElementById('post_title').focus();
mode = (post_mode == null) ? 'topic' : mode;
topic_id = (mode == 'reply') ? topic_id : null;
}; };
app.post_topic = function() { app.post_topic = function() {

@ -5,4 +5,12 @@
<p>Posted on {posts.timestamp} by user {posts.uid}.</p> <p>Posted on {posts.timestamp} by user {posts.uid}.</p>
</li> </li>
<!-- END posts --> <!-- END posts -->
</ul> </ul>
<hr />
<button id="post_reply" class="btn btn-primary btn-large">Reply</button>
<script type="text/javascript">
var post_reply = document.getElementById('post_reply');
post_reply.onclick = function() {
app.open_post_window('reply', {TOPIC_ID});
}
</script>

@ -46,7 +46,7 @@ var RDB = require('./redis.js');
}); });
} }
callback({'posts': posts}); callback({'posts': posts, 'TOPIC_ID': tid});
}); });
} else { } else {
callback({}); callback({});

@ -60,11 +60,11 @@ var fs = require('fs');
var template = this.html, regex, block; var template = this.html, regex, block;
return (function parse(data, namespace, template) { return (function parse(data, namespace, template) {
if (data.length == 0) { if (Object.keys(data).length == 0) {
regex = makeRegex('[^]*'); regex = makeRegex('[^]*');
template = template.replace(regex, ''); template = template.replace(regex, '');
} }
for (var d in data) { for (var d in data) {
if (data.hasOwnProperty(d)) { if (data.hasOwnProperty(d)) {
if (data[d] instanceof String || data[d] === null) { if (data[d] instanceof String || data[d] === null) {

Loading…
Cancel
Save