Skip to content

Commit

Permalink
Merge branch 'simplicitybg-customize-post-view'
Browse files Browse the repository at this point in the history
  • Loading branch information
GBH committed May 10, 2018
2 parents 99824c7 + a7c2e20 commit ca48f52
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 1 addition & 3 deletions app/controllers/comfy/blog/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def index
def show
load_post

render inline: @cms_post.content_cache,
layout: app_layout,
content_type: "text/html"
render layout: app_layout

rescue ActiveRecord::RecordNotFound
render cms_page: "/404", status: 404
Expand Down
8 changes: 8 additions & 0 deletions app/views/comfy/blog/posts/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%h1= @cms_post.title

%p
- label = Comfy::Blog::Post.human_attribute_name(:published_on)
- time = @cms_post.published_at.to_formatted_s(:short)
= "#{label}: #{time}"

= @cms_post.content_cache.html_safe
11 changes: 10 additions & 1 deletion test/controllers/comfy/blog/posts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,18 @@ def test_get_index_is_sorted

def test_get_show
@post.update_column(:content_cache, "blog post content")

expected = <<~HTML
<h1>Default Title</h1>
<p>
Published on: 01 Jan 01:23
</p>
blog post content
HTML

get comfy_blog_post_path(@site.path, @post.year, @post.month, @post.slug)
assert_response :success
assert_equal "blog post content", response.body
assert_equal expected, response.body
end

def test_get_show_unpublished
Expand Down

0 comments on commit ca48f52

Please sign in to comment.