class Staticpress::Content::Index
Public Class Methods
all()
click to toggle source
# File lib/staticpress/content/index.rb, line 25 def self.all (1..paginate(all_posts).count).map do |number| new(:number => number) end end
all_posts()
click to toggle source
# File lib/staticpress/content/index.rb, line 35 def self.all_posts Staticpress::Content::Post.published end
published()
click to toggle source
# File lib/staticpress/content/index.rb, line 31 def self.published all end
Public Instance Methods
optional_param_defaults()
click to toggle source
# File lib/staticpress/content/index.rb, line 6 def optional_param_defaults { :number => pages_count } end
pages_count()
click to toggle source
# 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()
click to toggle source
# 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()
click to toggle source
# File lib/staticpress/content/index.rb, line 14 def sub_content paginate(self.class.all_posts.sort)[params[:number] - 1] end