Class: ConversationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ConversationsController
- Defined in:
- app/controllers/conversations_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/conversations_controller.rb', line 50 def destroy @conversation.move_to_trash(@actor) respond_to do |format| format.html { if params[:location].present? and params[:location] == 'conversation' redirect_to conversations_path(:box => :trash) else redirect_to conversations_path(:box => @box,:page => params[:page]) end } format.js { if params[:location].present? and params[:location] == 'conversation' render :js => "window.location = '#{conversations_path(:box => @box,:page => params[:page])}';" else render 'conversations/destroy' end } end end |
#index ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/conversations_controller.rb', line 6 def index if @box.eql? "inbox" @conversations = @mailbox.inbox.page(params[:page]).per(9) elsif @box.eql? "sentbox" @conversations = @mailbox.sentbox.page(params[:page]).per(9) else @conversations = @mailbox.trash.page(params[:page]).per(9) end respond_to do |format| format.html { render @conversations if request.xhr? } end end |
#show ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/conversations_controller.rb', line 20 def show if @box.eql? 'trash' @receipts = @mailbox.receipts_for(@conversation).trash else @receipts = @mailbox.receipts_for(@conversation).not_trash end render :action => :show @receipts.mark_as_read end |
#update ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/conversations_controller.rb', line 30 def update if params[:untrash].present? @conversation.untrash(@actor) end if params[:reply_all].present? last_receipt = @mailbox.receipts_for(@conversation).last @receipt = @actor.reply_to_all(last_receipt, params[:body]) end if @box.eql? 'trash' @receipts = @mailbox.receipts_for(@conversation).trash else @receipts = @mailbox.receipts_for(@conversation).not_trash end redirect_to :action => :show @receipts.mark_as_read end |