Skip to content

Commit

Permalink
fixes: paginator sets current page, etc.,. on :prop_name not :posts
Browse files Browse the repository at this point in the history
current_page, current_page_index, pages and window were all being set on
page.posts, but they should be set on page.:@prop_name instead.
  • Loading branch information
gruis committed Jan 3, 2012
1 parent 04709a2 commit c7612a0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/awestruct/extensions/paginator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def initialize(prop_name, input_path, opts={})
@window_size = opts[:window_size] || 2
@remove_input = opts.has_key?( :remove_input ) ? opts[:remove_input] : true
@output_prefix = opts[:output_prefix] || File.dirname( @input_path )
@collection = opts[:collection]
@collection = opts[:collection]
end

def execute(site)
Expand All @@ -74,7 +74,7 @@ def execute(site)
site.pages << page
paginated_pages << page
i = i + 1
end
end

if ( @remove_input )
site.pages.reject!{|page|
Expand All @@ -84,10 +84,10 @@ def execute(site)

prev_page = nil
paginated_pages.each_with_index do |page,i|
page.posts.current_page = page
page.posts.current_page_index = i
page.posts.pages = paginated_pages
page.posts.window = 1
page.send( @prop_name ).current_page = page
page.send( @prop_name ).current_page_index = i
page.send( @prop_name ).pages = paginated_pages
page.send( @prop_name ).window = 1

if ( prev_page != nil )
prev_page.send( @prop_name ).next_page = page
Expand Down

0 comments on commit c7612a0

Please sign in to comment.