Fix pagination for people list on the tag stream page

Update _index.html.haml

This params broken the pagination of the followers list in tags page
To reproduce try to paginate in
https://joindiaspora.com/tags/diaspora

test for people pagination patch

reducing the per page limit

removing tabs
This commit is contained in:
fabianfiorotto 2013-06-19 23:14:20 -03:00 committed by Jonne Haß
parent d4b5261ba0
commit 3e5b29b289
4 changed files with 33 additions and 3 deletions

View file

@ -9,6 +9,7 @@
* Do not render mobile photo view for none-existing photos [#4194](https://github.com/diaspora/diaspora/issues/4194)
* Render markdown content for prettier email subjects and titles [#4182](https://github.com/diaspora/diaspora/issues/4182)
* Disable invite button after sending invite [#4173](https://github.com/diaspora/diaspora/issues/4173)
* Fix pagination for people list on the tag stream page [#4245](https://github.com/diaspora/diaspora/pull/4245)
## Features
* Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252)

View file

@ -8,4 +8,4 @@
%span.from
= person_link(person, :class => "hovercardable")
= will_paginate people, :inner_window => 3, :params => {:controller => 'people', :action => 'tag_index'}
= will_paginate people, :inner_window => 3

View file

@ -3,11 +3,12 @@
# the COPYRIGHT file.
class Stream::Tag < Stream::Base
attr_accessor :tag_name, :people_page
attr_accessor :tag_name, :people_page , :people_per_page
def initialize(user, tag_name, opts={})
self.tag_name = tag_name
self.people_page = opts[:page] || 1
self.people_per_page = 15
super(user, opts)
end
@ -24,7 +25,7 @@ class Stream::Tag < Stream::Base
end
def tagged_people
@people ||= ::Person.profile_tagged_with(tag_name).paginate(:page => people_page, :per_page => 15)
@people ||= ::Person.profile_tagged_with(tag_name).paginate(:page => people_page, :per_page => people_per_page)
end
def tagged_people_count

View file

@ -0,0 +1,28 @@
require 'spec_helper'
describe TagsController, type: :controller do
describe 'will_paginate people on the tag page' do
let(:people) { (1..2).map { FactoryGirl.create(:person) } }
let(:tag) { "diaspora" }
before do
Stream::Tag.any_instance.stub(people_per_page: 1)
Person.should_receive(:profile_tagged_with).with(/#{tag}/).twice.and_return(people)
end
it 'paginates the people set' do
get "/tags/#{tag}"
expect(response.status).to eq(200)
response.body.should match(/div class="pagination"/)
response.body.should match(/href="\/tags\/#{tag}\?page=2"/)
end
it 'fetches the second page' do
get "/tags/#{tag}", page: 2
expect(response.status).to eq(200)
response.body.should match(/<em class="current">2<\/em>/)
end
end
end