Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
Pass existing locals to subsequent index pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommaso Valentini committed Feb 12, 2016
1 parent 030b8c0 commit 7e6918d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/middleman/pagination/index_page.rb
Expand Up @@ -2,14 +2,15 @@ module Middleman
module Pagination
class IndexPage

attr_reader :extension_context, :first_index, :pageable_context, :page_num, :symbolic_replacement_path
attr_reader :extension_context, :first_index, :pageable_context, :page_num, :symbolic_replacement_path, :index_locals

def initialize(extension_context, first_index, pageable_context, page_num, symbolic_replacement_path)
def initialize(extension_context, first_index, pageable_context, page_num, symbolic_replacement_path, index_locals)
@extension_context = extension_context
@first_index = first_index
@pageable_context = pageable_context
@page_num = page_num
@symbolic_replacement_path = symbolic_replacement_path
@index_locals = index_locals
end

def resource
Expand Down Expand Up @@ -37,7 +38,7 @@ def metadata
end

def locals
{ pagination: in_page_context }
index_locals.merge({ pagination: in_page_context })
end

def in_page_context
Expand Down
3 changes: 2 additions & 1 deletion lib/middleman/pagination/pageable.rb
Expand Up @@ -47,7 +47,8 @@ def new_pages_for_index(extension_context, index, resources)
index,
pageable_context,
page_num,
symbolic_replacement_path).resource
symbolic_replacement_path,
index.metadata[:locals]).resource

pageable_context.index_resources << new_index

Expand Down

0 comments on commit 7e6918d

Please sign in to comment.