don't render page-viewer twice; last_post should actually get the last post posted, not the first one
This commit is contained in:
parent
dc0b5db0ac
commit
73f224e690
3 changed files with 4 additions and 5 deletions
|
|
@ -110,7 +110,7 @@ class PeopleController < ApplicationController
|
||||||
|
|
||||||
def last_post
|
def last_post
|
||||||
@person = Person.find_from_guid_or_username(params)
|
@person = Person.find_from_guid_or_username(params)
|
||||||
last_post = Post.visible_from_author(@person, current_user).last
|
last_post = Post.visible_from_author(@person, current_user).order('posts.created_at DESC').first
|
||||||
redirect_to post_path(last_post)
|
redirect_to post_path(last_post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,10 @@ app.Router = Backbone.Router.extend({
|
||||||
app.page = new app.views.Photos({model : app.photos}).render();
|
app.page = new app.views.Photos({model : app.photos}).render();
|
||||||
|
|
||||||
$("#main_stream").html(app.page.el);
|
$("#main_stream").html(app.page.el);
|
||||||
},
|
},
|
||||||
|
|
||||||
singlePost : function(id) {
|
singlePost : function(id) {
|
||||||
|
var page = new app.pages.PostViewer({ id: id });
|
||||||
var page = new app.pages.PostViewer({ id: id }).render();
|
|
||||||
$("#container").html(page.el);
|
$("#container").html(page.el);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ describe PeopleController do
|
||||||
get :index, :q => "Eug"
|
get :index, :q => "Eug"
|
||||||
assigns[:people].map { |x| x.id }.should =~ [@eugene.id, eugene2.id]
|
assigns[:people].map { |x| x.id }.should =~ [@eugene.id, eugene2.id]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "succeeds if there is exactly one match" do
|
it "succeeds if there is exactly one match" do
|
||||||
get :index, :q => "Korth"
|
get :index, :q => "Korth"
|
||||||
assigns[:people].length.should == 1
|
assigns[:people].length.should == 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue