Method: Monograph::ChapterTemplateContext#previous_page

Defined in:
lib/monograph/chapter_template_context.rb

#previous_pageObject



31
32
33
34
35
36
37
# File 'lib/monograph/chapter_template_context.rb', line 31

def previous_page
  if @chapter.number == 1
    BookTemplateContext.new(@chapter.book, 'contents.html')
  else
    @chapter.book.chapters.select { |c| c.number == @chapter.number - 1}.first
  end
end