#
# Provides a controller for managing Category objects.
#
class CategoryController < ApplicationController
  
  #
  # Displays the Stories for the specified Category.
  #
  def show
    
    if !params[ :id ] 
      
      flash[ :error ] = "You need to pick a category to show."
      redirect_to :controller => "main"
      return
    end
    
    @category = Category.find( params[ :id ] )
    page = params[ :page ]
    
    @story_pages, @stories = paginate_collection( @category.stories, :order => "pub_date DESC", :page => params[ :page ] )
    @rss_feed = true
  end
  
  #
  # Gathers data for the "rss" view.
  #
  def rss

     @category = Category.find( params[ :id ] )
      page = params[ :page ]

      @story_pages, @stories = paginate_collection( @category.stories, :order => "pub_date DESC", :page => params[ :page ] )
      @rss_feed = true
  end
end
