Sha256: cbd7ba795aaaa370e6732f0dfdb241c8cb259c485a6d3b4bf3346547a124bcf7

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

class ForumsController < ReaderActionController
  include Radiant::Pagination::Controller
  helper :forum
  
  before_filter :private_forum
  before_filter :find_forum, :only => :show
  before_filter :no_changes_here, :except => [:index, :show]

  radiant_layout { |controller| Radiant::Config['forum.layout'] || Radiant::Config['reader.layout'] }

  def index
    # visible is an open scope that can be overridden in other extensions, ie group_forum
    @forums = Forum.visible.paginate(:all, pagination_parameters.merge(:order => "position"))
  end

  def show
    respond_to do |format|
      format.html { 
        @topics = Topic.paginate_by_forum_id(params[:id], pagination_parameters.merge(:include => :replied_by, :order => 'sticky desc, replied_at desc'))
      }
      format.rss  {
        @topics = Topic.paginate_by_forum_id(params[:id], pagination_parameters.merge(:include => :replied_by, :order => 'replied_at desc'))
        render :layout => 'feed'
      }
    end
  end

  def no_changes_here
    redirect_to admin_forums_url
  end

protected

  def private_forum
    return false unless Radiant::Config['forum.public?'] || require_reader && require_activated_reader
  end

  def find_forum
    @forum = Forum.find(params[:id])
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-forum-extension-1.2.1 app/controllers/forums_controller.rb
radiant-forum-extension-1.1.2 app/controllers/forums_controller.rb
radiant-forum-extension-1.1.1 app/controllers/forums_controller.rb
radiant-forum-extension-1.1.0 app/controllers/forums_controller.rb