Skip to content

Commit

Permalink
Merge branch 'master' into admin-post-paging
Browse files Browse the repository at this point in the history
Conflicts:
	app/controllers/monologue/admin/posts_controller.rb
  • Loading branch information
Caitlin Goldman committed Feb 13, 2015
2 parents 8b0ccc6 + 183bd8b commit ae2b5f3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/monologue/admin/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Monologue::Admin::PostsController < Monologue::Admin::BaseController

def index
@page = params[:page].nil? ? 1 : params[:page]
@posts = Monologue::Post.listing_page(@page)
@posts = Monologue::Post.listing_page(@page).includes(:user)
end

def new
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/monologue/posts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Monologue::PostsController < Monologue::ApplicationController
def index
@page = params[:page].nil? ? 1 : params[:page]
@posts = Monologue::Post.page(@page).published
@posts = Monologue::Post.page(@page).includes(:user).published
end

def show
Expand Down
4 changes: 2 additions & 2 deletions app/views/monologue/posts/_post.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section>
<section data-tags="<%= post.tags.map(&:name).join(' ') %>">
<%= render partial: 'monologue/posts/post_header', locals: {post: post} %>

<div class="content" data-monologue="content">
Expand All @@ -9,4 +9,4 @@
<%= render post.tags %>
</div>
<%= link_to t(".readmore"), post.full_url, class: "button" %>
</section>
</section>
2 changes: 1 addition & 1 deletion app/views/monologue/tags/_tag.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<span class='tag'><%=link_to tag.name, tag_url(tag) %></span>
<span class='tag tag-<%= tag.name.parameterize %>'><%=link_to tag.name, tag_url(tag) %></span>
10 changes: 9 additions & 1 deletion spec/requests/posts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
end

it "lists posts" do
Factory(:post, title: "post Y")
visit "/monologue"

page.should have_content("post X")
page.should have_content("post Y")
end

it "should route to a post" do
Expand All @@ -31,4 +33,10 @@
visit root_path
page.should_not have_content "I am Marty McFly"
end
end

it "should not show an unpublished post" do
Factory(:post, published: false, title: "I am Marty McFly")
visit root_path
page.should_not have_content "I am Marty McFly"
end
end

0 comments on commit ae2b5f3

Please sign in to comment.