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, var post_window = null,
submit_post_btn = null, submit_post_btn = null,
post_title = null, post_title = null,
reply_title = null,
post_content = 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'); submit_post_btn = submit_post_btn || document.getElementById('submit_post_btn');
post_title = post_title || document.getElementById('post_title'); post_title = post_title || document.getElementById('post_title');
reply_title = reply_title || document.getElementById('reply_title');
post_content = post_content || document.getElementById('post_content'); post_content = post_content || document.getElementById('post_content');
@ -98,13 +100,16 @@ var socket,
jQuery(post_window).slideToggle(250); jQuery(post_window).slideToggle(250);
if (post_mode == null || post_mode == 'topic') { 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(); post_title.focus();
submit_post_btn.onclick = function() { submit_post_btn.onclick = function() {
app.post_topic(); app.post_topic();
} }
} else { } 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(); post_content.focus();
submit_post_btn.onclick = function() { submit_post_btn.onclick = function() {
app.post_reply(id) app.post_reply(id)

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

@ -117,6 +117,11 @@
font-size: 12px; font-size: 12px;
font-weight: bold; font-weight: bold;
} }
#reply_title {
font-size: 17px;
padding-top: 14px;
font-weight: 600;
}
</style> </style>
</head> </head>
@ -132,7 +137,7 @@
</button> </button>
<div class="nav-collapse collapse"> <div class="nav-collapse collapse">
<ul class="nav"> <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="/register">Register</a></li>
<li><a href="/login">Login</a></li> <li><a href="/login">Login</a></li>
</ul> </ul>
@ -148,6 +153,7 @@
<div class="post-title-container"> <div class="post-title-container">
<div class="container"> <div class="container">
<input id="post_title" placeholder="Enter your topic title here." /> <input id="post_title" placeholder="Enter your topic title here." />
<span id="reply_title"></span>
</div> </div>
</div> </div>
<div class="post-content-container"> <div class="post-content-container">
@ -172,4 +178,5 @@
</div> </div>
</div> </div>
<div id="notification_window"></div> <div id="notification_window"></div>
<div class="container" id="content"> <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"> <ul class="topic-container">
<!-- BEGIN posts --> <!-- BEGIN posts -->
<li class="topic-row"> <li class="topic-row">
@ -11,6 +18,6 @@
<script type="text/javascript"> <script type="text/javascript">
var post_reply = document.getElementById('post_reply'); var post_reply = document.getElementById('post_reply');
post_reply.onclick = function() { post_reply.onclick = function() {
app.open_post_window('reply', {TOPIC_ID}); app.open_post_window('reply', "{TOPIC_ID}", "{TOPIC_NAME}");
} }
</script> </script>

@ -16,8 +16,8 @@ var RDB = require('./redis.js'),
if (start == null) start = 0; if (start == null) start = 0;
if (end == null) end = start + 10; if (end == null) end = start + 10;
RDB.get('tid:' + tid + ':title', function(topic_name) { //do these asynch later
RDB.lrange('tid:' + tid + ':posts', start, end, function(pids) { RDB.lrange('tid:' + tid + ':posts', start, end, function(pids) {
var content = [], var content = [],
uid = [], uid = [],
timestamp = []; timestamp = [];
@ -48,14 +48,14 @@ var RDB = require('./redis.js'),
}); });
} }
callback({'TOPIC_ID': tid, 'posts': posts}); callback({'TOPIC_NAME':topic_name, 'TOPIC_ID': tid, 'posts': posts});
}); });
} else { } else {
callback({}); callback({});
} }
}); });
});
} }

Loading…
Cancel
Save