class Estatic::ProductListingsPage

Attributes

current_page[R]
products[R]
total_pages[R]

Public Class Methods

new(resource, page_number) click to toggle source
Calls superclass method Estatic::Page::new
# File lib/estatic/product_listings_page.rb, line 5
def initialize(resource, page_number)
  super(resource)
  @products = resource.products_in_chunks[page_number - 1]
  @current_page = page_number
  @total_pages = resource.total_chunks
end

Public Instance Methods

filename() click to toggle source
# File lib/estatic/product_listings_page.rb, line 12
def filename
  current_page == 1 ? 'index.html' : "#{current_page}.html"
end
render(filename, args = {}) click to toggle source
# File lib/estatic/product_listings_page.rb, line 16
def render(filename, args = {})
  partial = Dir.glob("#{Estatic.configuration.project_path}/blueprints/shared/#{filename}.{erb,haml,slim}").first
  Tilt.new(partial).render(nil, args[:locals])
end