Sha256: c3d77c936bd5795d365be7bb00cc549362289f2fccf60df127f83137333cf2d6

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

module Commontator
  class ThreadsController < Commontator::ApplicationController
    skip_before_filter :ensure_user, :only => :show

    before_filter :get_thread
    before_filter :set_commontable_url, :only => :show

    # GET /threads/1
    def show
      commontator_thread_show(@thread.commontable)

      respond_to do |format|
        format.html { redirect_to commontable_url }
        format.js
      end
    end
    
    # PUT /threads/1/close
    def close
      security_transgression_unless @thread.can_be_edited_by?(@user)

      @thread.errors.add(:base, t('commontator.thread.errors.already_closed')) \
        unless @thread.close(@user)

      respond_to do |format|
        format.html { redirect_to @thread }
        format.js { render :show }
      end
    end
    
    # PUT /threads/1/reopen
    def reopen
      security_transgression_unless @thread.can_be_edited_by?(@user)

      @thread.errors.add(:base, t('commontator.thread.errors.not_closed')) \
        unless @thread.reopen

      respond_to do |format|
        format.html { redirect_to @thread }
        format.js { render :show }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
commontator-4.5.4 app/controllers/commontator/threads_controller.rb
commontator-4.5.3 app/controllers/commontator/threads_controller.rb
commontator-4.5.2 app/controllers/commontator/threads_controller.rb
commontator-4.5.1 app/controllers/commontator/threads_controller.rb
commontator-4.5.0 app/controllers/commontator/threads_controller.rb
commontator-4.4.1 app/controllers/commontator/threads_controller.rb