Fix pagination in AppsController

This commit is contained in:
Raphael Sofaer 2011-06-09 16:22:52 -07:00
parent 0790c3397e
commit 7fd86924ee
4 changed files with 18 additions and 12 deletions

View file

@ -3,7 +3,10 @@ class AppsController < ApplicationController
@app = 'cubbies'
@posts = ActivityStreams::Photo
max_time = params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now
@posts = @posts.where(ActivityStreams::Photo.arel_table[:created_at].lt(max_time)).where(:public => true).order('posts.created_at DESC').limit(15).includes(:author)
@posts = @posts.where(ActivityStreams::Photo.arel_table[:created_at].lt(max_time)
).where(:public => true
).order('posts.created_at DESC'
).includes(:author => :profile).limit(30)
@commenting_disabled = true
@people = []
@people_count = 0

View file

@ -17,15 +17,15 @@
%h1
= "#{@app}"
#main_stream.stream
#main_stream.stream.canvas
- if @posts.length > 0
.canvas.stream
- for post in @posts
.image-element.stream-element
.hold-me
= link_to(image_tag(post.image_url), object_path(post))
.via
= post.author.name
- for post in @posts
.image-element.stream_element
.hold-me
= link_to(image_tag(post.image_url), object_path(post))
.via
= post.author.name
.time{:integer => post.created_at.to_i}
#pagination
=link_to(t('more'), next_page_path, :class => 'paginate')

View file

@ -2928,7 +2928,9 @@ h1.tag
:width 98%
.canvas
.image-element
.image-element,
.stream_element
:border none
:padding 20px
:height 170px
:width 170px

View file

@ -103,10 +103,11 @@ end
Factory.define(:activity_streams_photo, :class => ActivityStreams::Photo) do |p|
p.association(:author, :factory => :person)
p.image_url "http://example.com/awesome.png"
p.image_height 9001
p.image_width 4
p.image_height 900
p.image_width 400
p.object_url "http://example.com/awesome_things.gif"
p.objectId "http://example.com/awesome_things.gif"
p.actor_url "http://notcubbi.es/cubber"
p.provider_display_name "not cubbies"
p.public true
end