This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
tuxbliki/app/controllers/news.rb

16 lines
588 B
Ruby
Raw Normal View History

2008-06-27 00:13:15 -04:00
class News < Application
def index
ncount = Page.count :conditions => [ 'published = ?', true ]
@page = params[:page].to_i
per_page = 5
@page_count = (ncount.to_f / per_page.to_f).ceil.to_i
@page = 0 if @page >= @page_count
2008-06-27 21:28:18 -04:00
@url_key = :news
2008-06-27 00:13:15 -04:00
@page_title = 'Blogging!'
@news = Page.find :all, :limit => per_page, :offset => (@page * per_page), :conditions => [ 'published = ?', true ], :order => 'created_at DESC'
@oldest_date = Page.find(:first, :order => 'created_at ASC').created_at rescue nil
@tags = Page.popular_tags(30)
render
end
end