fix blog comments

This commit is contained in:
Sami Samhuri 2012-03-22 17:56:02 -07:00
parent 6bb558688e
commit ed37be689a
7 changed files with 10 additions and 11 deletions

View file

@ -41,6 +41,7 @@
function showComments(cb) {
$('#sd-container').remove()
getComments(function(err) {
$('#comments-spinner').hide()
if (err) {
$('#comments').text('derp')
if (typeof cb === 'function') cb(err)
@ -102,7 +103,7 @@
document.getElementById('thoughts').focus()
return false
}
comment.timestamp = +comment.timestamp + tzOffset
comment.timestamp = +new Date() + tzOffset
var options = { method: 'POST'
, uri: postCommentURL()
@ -115,8 +116,6 @@
return false
}
// FIXME check for error, how do we get the returned status code?
$('#comment-form').get(0).reset()
comment.timestamp = +new Date()

View file

@ -2,7 +2,7 @@
/// http://github.com/samsonjs/gitter
/// @_sjs
///
/// Copyright 2010 Sami Samhuri <sami.samhuri@gmail.com>
/// Copyright 2010 Sami Samhuri <sami@samhuri.net>
/// MIT License
// TODO:

View file

@ -23,7 +23,7 @@
xhr.setRequestHeader(k, headers[k])
}
xhr.onload = function() {
if (xhr.status === 200) {
if (xhr.status === 200 || xhr.status === 204) {
cb(null, xhr, xhr.responseText)
}
else {

View file

@ -2,7 +2,7 @@
/// http://github.com/samsonjs/strftime
/// @_sjs
///
/// Copyright 2010 Sami Samhuri <sami.samhuri@gmail.com>
/// Copyright 2010 Sami Samhuri <sami@samhuri.net>
/// MIT License
var strftime = (function() {

View file

@ -27,7 +27,7 @@
<% } else { %>
<%= name %>
<% } %>
@ <%= strftime('%F %r', new Date(timestamp)) %>
@ <%= strftime('%F %I:%M %p', new Date(timestamp)) %>
</p>
<blockquote><%= html %></blockquote>
</div>

View file

@ -35,14 +35,14 @@
</div>
<script type="text/html" id="comment_tmpl">
<div class="comment">
<a name="comment-<%= id %>" id="comment-<%= id %>">
<a name="comment-<%= id %>" id="comment-<%= id %>"></a>
<p>
<% if (url) { %>
<a href="<%= url %>"><%= name %></a>
<% } else { %>
<%= name %>
<% } %>
@ <%= strftime('%F %r', new Date(timestamp)) %>
@ <a href="#comment-<%= id %>"><%= strftime('%F %I:%M %p', new Date(timestamp)) %></a>
</p>
<blockquote><%= html %></blockquote>
</div>

View file

@ -36,14 +36,14 @@
</div>
<script type="text/html" id="comment_tmpl">
<div class="comment">
<a name="comment-<%= id %>" id="comment-<%= id %>">
<a name="comment-<%= id %>" id="comment-<%= id %>"></a>
<p>
<% if (url) { %>
<a href="<%= url %>"><%= name %></a>
<% } else { %>
<%= name %>
<% } %>
@ <%= strftime('%F %I:%M %p', new Date(timestamp)) %>
@ <a href="#comment-<%= id %>"><%= strftime('%F %I:%M %p', new Date(timestamp)) %></a>
</p>
<blockquote><%= html %></blockquote>
</div>