From d6f95f7664fdd13615b9fa2ff142c94dcc5213f9 Mon Sep 17 00:00:00 2001 From: Yohei Sasaki Date: Tue, 10 May 2011 00:35:50 +0900 Subject: [PATCH] footer in a post section UI improved --- apps/posts/_attachments/js/posts.js | 20 ++++++++++++++++++- .../_attachments/templates/parts/post.ejs | 16 ++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/apps/posts/_attachments/js/posts.js b/apps/posts/_attachments/js/posts.js index cde93bc..0700cd1 100644 --- a/apps/posts/_attachments/js/posts.js +++ b/apps/posts/_attachments/js/posts.js @@ -94,4 +94,22 @@ button.bind('click', onClick); }; -})(jQuery); \ No newline at end of file +})(jQuery); + +$(function(){ + function f(s){ + if( s > 10 ){ + return s; + }else{ + return '0' + s; + } + } + + $('time').each(function(){ + var self = $(this); + var t = new Date(self.attr('datetime')) + var date = [f(t.getFullYear()), f(t.getMonth() + 1), f(t.getDate())].join('-'); + var time = [f(t.getHours()), f(t.getMinutes() + 1), f(t.getSeconds())].join(':'); + self.html(date + ' ' + time); + }); +}); \ No newline at end of file diff --git a/apps/posts/_attachments/templates/parts/post.ejs b/apps/posts/_attachments/templates/parts/post.ejs index 58daad1..2f6a115 100644 --- a/apps/posts/_attachments/templates/parts/post.ejs +++ b/apps/posts/_attachments/templates/parts/post.ejs @@ -16,15 +16,17 @@ <%- markdown(this.content) %>