Browse files

footer in a post section UI improved

  • Loading branch information...
1 parent 0718ed2 commit d6f95f7664fdd13615b9fa2ff142c94dcc5213f9 @yssk22 committed May 10, 2011
Showing with 28 additions and 8 deletions.
  1. +19 −1 apps/posts/_attachments/js/posts.js
  2. +9 −7 apps/posts/_attachments/templates/parts/post.ejs
View
20 apps/posts/_attachments/js/posts.js
@@ -94,4 +94,22 @@
button.bind('click', onClick);
};
-})(jQuery);
+})(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);
+ });
+});
View
16 apps/posts/_attachments/templates/parts/post.ejs
@@ -16,15 +16,17 @@
<%- markdown(this.content) %>
</div>
<footer>
- <a class="permalink" title="<%= this.title %>"
- href="<%= url('/p/' + this._id) %>"><%= _("posts.permalink") %></a>
- <a class="posts-edit" title="<%= _('posts.edit') %>: <%= this.title %>"
- href="<%= url('/admin/edit/' + this._id) %>"><%= _("posts.edit") %></a>
- <a class="posts-delete" title="<%= _('posts.delete') %>: <%= this.title %>"
- href="<%= url('/p/' + this._id) %>"><%= _("posts.delete") %></a>
<time datetime="<%= this.updated_at %>" class="updated_at"><%= this.updated_at %></time>
- <time datetime="<%= this.created_at %>" class="created_at"><%= this.updated_at %></time>
+ <time datetime="<%= this.created_at %>" class="created_at" pubdate="pubdate"><%= this.updated_at %></time>
<%- $system.linkToUser(this.updated_by) %>
+ <div class="actions">
+ <a class="permalink" title="<%= this.title %>"
+ href="<%= url('/p/' + this._id) %>"><%= _("posts.permalink") %></a>
+ <a class="posts-edit" title="<%= _('posts.edit') %>: <%= this.title %>"
+ href="<%= url('/admin/edit/' + this._id) %>"><%= _("posts.edit") %></a>
+ <a class="posts-delete" title="<%= _('posts.delete') %>: <%= this.title %>"
+ href="<%= url('/p/' + this._id) %>"><%= _("posts.delete") %></a>
+ </div>
</footer>
<script type="text/javascript">
$(function(){$('article.post[data-docid="<%= this._id %>"]').bindDelete();});

0 comments on commit d6f95f7

Please sign in to comment.