Class: Thoth::ArchiveController

Inherits:
Controller
  • Object
show all
Defined in:
lib/thoth/controller/archive.rb

Instance Method Summary collapse

Methods inherited from Controller

action_missing

Instance Method Details

#index(page = 1) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/thoth/controller/archive.rb', line 36

def index(page = 1)
  page = page.to_i
  error_404 unless page >= 1

  @posts = Post.recent(page, 10)

  error_404 if page > @posts.page_count && @posts.page_count > 0

  @title = "#{Config.site['name']} Archives (page #{page} of " <<
      "#{@posts.page_count > 0 ? @posts.page_count : 1})"

  @pager = pager(@posts)
end