Node.js based forum software built for the modern web
post replies, unfinished
psychobunny0f3f2bb85903
diff --git a/public/src/app.js b/public/src/app.jsindex 8b50d34af6..64dd8378ff 100644--- a/public/src/app.js+++ b/public/src/app.js@@ -78,12 +78,16 @@ var socket,}}- var post_window = null;- app.open_post_window = function() {+ var post_window = null,+ mode = 'topic',+ topic_id = null;+ app.open_post_window = function(post_mode, id) {post_window = post_window || document.getElementById('post_window');jQuery(post_window).slideToggle(250);document.getElementById('post_title').focus();+ mode = (post_mode == null) ? 'topic' : mode;+ topic_id = (mode == 'reply') ? topic_id : null;};app.post_topic = function() {diff --git a/public/templates/topic.tpl b/public/templates/topic.tplindex 56c230a31f..ed5de86aa8 100644--- a/public/templates/topic.tpl+++ b/public/templates/topic.tpl@@ -5,4 +5,12 @@<p>Posted on {posts.timestamp} by user {posts.uid}.</p></li><!-- END posts -->-</ul>\ No newline at end of file+</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>\ No newline at end of filediff --git a/src/posts.js b/src/posts.jsindex c34d088232..b2cac90985 100644--- a/src/posts.js+++ b/src/posts.js@@ -46,7 +46,7 @@ var RDB = require('./redis.js');});}- callback({'posts': posts});+ callback({'posts': posts, 'TOPIC_ID': tid});});} else {callback({});diff --git a/src/templates.js b/src/templates.jsindex f38a195475..c74aba7934 100644--- a/src/templates.js+++ b/src/templates.js@@ -60,11 +60,11 @@ var fs = require('fs');var template = this.html, regex, block;return (function parse(data, namespace, template) {- if (data.length == 0) {+ if (Object.keys(data).length == 0) {regex = makeRegex('[^]*');template = template.replace(regex, '');}-+for (var d in data) {if (data.hasOwnProperty(d)) {if (data[d] instanceof String || data[d] === null) {