12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/controllers/comfy/archive/index_controller.rb', line 12
def index
if ! @cms_index || @cms_index.page != @cms_page
show
else
scope = @cms_index.children(true).chronologically(@cms_index.datetime_fragment)
if params[:year]
@year = params[:year]
scope = scope.for_year(@cms_index.datetime_fragment, @year)
if params[:month]
@month = params[:month]
scope = scope.for_month(@cms_index.datetime_fragment, @month)
end
elsif params[:category]
@category = CGI.unescape(params[:category])
scope = scope.for_category(@category).distinct(false)
end
@archive_pages = comfy_paginate(scope, per_page: ComfyArchive.config.posts_per_page)
if @cms_index.force_render_page
show
else
render layout: app_layout
end
end
end
|