about summary refs log tree commit diff stats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/blog.rb8
-rw-r--r--app/views/admin/blogs/show.html.haml2
-rw-r--r--app/views/blogs/_blog.html.haml8
3 files changed, 13 insertions, 5 deletions
diff --git a/app/models/blog.rb b/app/models/blog.rb index b677e2b..e640466 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb
@@ -32,6 +32,14 @@ class Blog < ApplicationRecord
32 slug 32 slug
33 end 33 end
34 34
35 def visible_date
36 if published
37 published_at
38 else
39 updated_at
40 end
41 end
42
35 private 43 private
36 def set_draft_title 44 def set_draft_title
37 if self.title.blank? and not self.published 45 if self.title.blank? and not self.published
diff --git a/app/views/admin/blogs/show.html.haml b/app/views/admin/blogs/show.html.haml index b9acd5d..f50f69d 100644 --- a/app/views/admin/blogs/show.html.haml +++ b/app/views/admin/blogs/show.html.haml
@@ -1,5 +1,5 @@
1- title "Previewing #{@blog.title}" 1- title "Previewing #{@blog.title}"
2= render partial: "blogs/blog", object: @blog 2= render "blogs/blog", blog: @blog, short: false
3%footer#blog-footer 3%footer#blog-footer
4 This draft was last updated on 4 This draft was last updated on
5 = succeed "." do 5 = succeed "." do
diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index c607e63..5467683 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml
@@ -1,8 +1,8 @@
1%article#blog-post 1%article#blog-post
2 %header 2 %header
3 .post-calendar{ class: "post-date-#{(blog.published_at.year - 2007) % 4 + 1}" } 3 .post-calendar{ class: "post-date-#{(blog.visible_date.year - 2007) % 4 + 1}" }
4 %span.post-month= blog.published_at.strftime("%^b") 4 %span.post-month= blog.visible_date.strftime("%^b")
5 %span.post-day= blog.published_at.day 5 %span.post-day= blog.visible_date.day
6 .blog-title 6 .blog-title
7 %h2= link_to_unless_current blog.title, blog 7 %h2= link_to_unless_current blog.title, blog
8 .post-author Hatkirby 8 .post-author Hatkirby
@@ -18,4 +18,4 @@
18 %cite.bubble 18 %cite.bubble
19 %strong Hatkirby 19 %strong Hatkirby
20 on 20 on
21 = blog.published_at.strftime("%B #{blog.published_at.day.ordinalize}, %Y at %-I:%M:%S%P") 21 = blog.visible_date.strftime("%B #{blog.visible_date.day.ordinalize}, %Y at %-I:%M:%S%P")