Sha256: f9107a72a9dac8a553a0eb8615f381a952cb4bf44b9140495fba6ade440fedd2

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

module Commontator
  class ThreadsController < Commontator::ApplicationController
    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
    
    # PATCH /threads/1/close
    def close
      raise SecurityTransgression unless @thread.can_be_edited_by?(@user)

      @thread.errors.add(:base, 'This thread has already been closed.') \
        unless @thread.close(@user)

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

      @thread.errors.add(:base, 'This thread is 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

2 entries across 2 versions & 1 rubygems

Version Path
commontator-4.0.1 app/controllers/commontator/threads_controller.rb
commontator-4.0.0 app/controllers/commontator/threads_controller.rb