From ed37be689a248b2f7863620ceacfb8197bd0ccd0 Mon Sep 17 00:00:00 2001
From: Sami Samhuri
Date: Thu, 22 Mar 2012 17:56:02 -0700
Subject: [PATCH] fix blog comments
---
assets/js/blog.js | 5 ++---
assets/js/gitter.js | 2 +-
assets/js/request.js | 2 +-
assets/js/strftime.js | 2 +-
public/discussions.html | 2 +-
templates/blog/index.html | 4 ++--
templates/blog/post.html | 4 ++--
7 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/assets/js/blog.js b/assets/js/blog.js
index 8d0d483..6dca9a8 100644
--- a/assets/js/blog.js
+++ b/assets/js/blog.js
@@ -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()
diff --git a/assets/js/gitter.js b/assets/js/gitter.js
index 09e84d7..befb4a7 100644
--- a/assets/js/gitter.js
+++ b/assets/js/gitter.js
@@ -2,7 +2,7 @@
/// http://github.com/samsonjs/gitter
/// @_sjs
///
-/// Copyright 2010 Sami Samhuri
+/// Copyright 2010 Sami Samhuri
/// MIT License
// TODO:
diff --git a/assets/js/request.js b/assets/js/request.js
index 0bd5360..27c143a 100644
--- a/assets/js/request.js
+++ b/assets/js/request.js
@@ -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 {
diff --git a/assets/js/strftime.js b/assets/js/strftime.js
index 5bb6de6..1afc029 100644
--- a/assets/js/strftime.js
+++ b/assets/js/strftime.js
@@ -2,7 +2,7 @@
/// http://github.com/samsonjs/strftime
/// @_sjs
///
-/// Copyright 2010 Sami Samhuri
+/// Copyright 2010 Sami Samhuri
/// MIT License
var strftime = (function() {
diff --git a/public/discussions.html b/public/discussions.html
index f3ea784..19e1b4a 100644
--- a/public/discussions.html
+++ b/public/discussions.html
@@ -27,7 +27,7 @@
<% } else { %>
<%= name %>
<% } %>
- @ <%= strftime('%F %r', new Date(timestamp)) %>
+ @ <%= strftime('%F %I:%M %p', new Date(timestamp)) %>
<%= html %>
diff --git a/templates/blog/index.html b/templates/blog/index.html
index 0ccc55b..54a1e6e 100644
--- a/templates/blog/index.html
+++ b/templates/blog/index.html
@@ -35,14 +35,14 @@