Class: IshManager::EmailConversationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ish_manager/email_conversations_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#basic_auth, #home, #tinymce

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/ish_manager/email_conversations_controller.rb', line 6

def index
  authorize! :email_conversations_index, IshManager::Ability
  @email_conversations = ::Office::EmailConversation.all

  per_page = current_profile.per_page
  # if current_profile.per_page > 100
  #   flash_notice "Cannot display more than 100 conversations per page."
  #   per_page = 100
  # end

  if params[:slug]
    @email_conversations = @email_conversations.in_emailtag( params[:slug] )
  end

  if params[:not_slug]
    @email_conversations = @email_conversations.not_in_emailtag( params[:not_slug] )
  end

  @email_conversations = @email_conversations.order_by( latest_at: :desc
    ).includes( :email_messages # , :lead_ties
    ).page( params[:conv_page]
    ).per( per_page )
end

#showObject



31
32
33
34
35
36
# File 'app/controllers/ish_manager/email_conversations_controller.rb', line 31

def show
  authorize! :email_conversations_show, IshManager::Ability
  @email_conversation = ::Office::EmailConversation.find( params[:id] )
  @email_messages     = @email_conversation.email_messages.order_by( date: :asc )
  @email_conversation.update_attributes({ state: Conv::STATE_READ })
end