Class: Staticpress::Content::Index
Instance Attribute Summary
Attributes inherited from Base
#params, #template_types
Class Method Summary
collapse
Instance Method Summary
collapse
#find_supported_extensions, #gather_resources_from, #load_resource
#template_path, #template_types
Methods inherited from Base
#==, #content, #content_type, #exist?, find_by_url_path, #full_title, #initialize, #layout, #markup_template?, #meta, #output_path, #published?, #raw, #render, #render_partial, #save, #save!, #template_context, #template_engine_options, #template_extension, #template_path_content, #theme, theme, #title, #to_s, type, #url_path
Methods included from Helpers
#config, #extensionless_basename, #extensionless_path, #hash_from_array, #hash_from_match_data, #paginate, #settings, #spider_map, #titleize
Class Method Details
.all ⇒ Object
25
26
27
28
29
|
# File 'lib/staticpress/content/index.rb', line 25
def self.all
(1..paginate(all_posts).count).map do |number|
new(:number => number)
end
end
|
.published ⇒ Object
31
32
33
|
# File 'lib/staticpress/content/index.rb', line 31
def self.published
all
end
|
Instance Method Details
#optional_param_defaults ⇒ Object
6
7
8
|
# File 'lib/staticpress/content/index.rb', line 6
def optional_param_defaults
{ :number => pages_count }
end
|
#pages_count ⇒ Object
10
11
12
|
# File 'lib/staticpress/content/index.rb', line 10
def pages_count
(self.class.all_posts.count / config.posts_per_page.to_f).ceil
end
|
#preferred_layout_names ⇒ Object
18
19
20
21
22
23
|
# File 'lib/staticpress/content/index.rb', line 18
def preferred_layout_names
reply = []
reply << :post_index if params[:number].nil?
reply << :post_paged
reply
end
|
#sub_content ⇒ Object
14
15
16
|
# File 'lib/staticpress/content/index.rb', line 14
def sub_content
paginate(self.class.all_posts.sort)[params[:number] - 1]
end
|