Class: ArchivePageTreeStructure::ArchiveYearTreePage
Instance Method Summary
collapse
#allowed_children_cache, #children, #class_name, display_name, #sheet?, #status, #url, #virtual?
Constructor Details
#initialize(parent, start_time, end_time = nil) ⇒ ArchiveYearTreePage
Returns a new instance of ArchiveYearTreePage.
68
69
70
71
72
|
# File 'lib/archive_page_tree_structure.rb', line 68
def initialize(parent, start_time, end_time=nil)
@parent = parent
@start_time = start_time
@end_time = end_time
end
|
Instance Method Details
#breadcrumb ⇒ Object
79
80
81
|
# File 'lib/archive_page_tree_structure.rb', line 79
def breadcrumb
title
end
|
#id ⇒ Object
73
74
75
|
# File 'lib/archive_page_tree_structure.rb', line 73
def id
@start_time.strftime("#{@parent.id}_%Y")
end
|
#title ⇒ Object
76
77
78
|
# File 'lib/archive_page_tree_structure.rb', line 76
def title
@start_time.strftime("%Y")
end
|
#tree_child(slug) ⇒ Object
90
91
92
|
# File 'lib/archive_page_tree_structure.rb', line 90
def tree_child(slug)
ArchiveMonthTreePage.new(@parent, @start_time.beginning_of_year.months_since(slug.to_i - 1))
end
|
#tree_children ⇒ Object
82
83
84
85
86
87
88
89
|
# File 'lib/archive_page_tree_structure.rb', line 82
def tree_children
start_month = @start_time.month
end_month = 12
end_month = @end_time.month if @end_time && @end_time.year <= @start_time.year
(@start_time.month..end_month).map do |m|
tree_child(m)
end.reverse
end
|