Class: AlchemyCrm::RecipientsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/alchemy_crm/recipients_controller.rb

Instance Method Summary collapse

Methods included from I18nHelpers

#alchemy_crm_t, #i18n_t, included, #translate_model_attribute

Instance Method Details

#reactsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/alchemy_crm/recipients_controller.rb', line 12

def reacts
  recipient = Recipient.find_by_sha1(params[:h])
  if recipient
    recipient.reacts!({
      :page_id => params[:page_id],
      :element_id => params[:element_id],
      :url => params[:r]
    })
  end
  if params[:r].present?
    redirect_to params[:r]
  else
    page = Alchemy::Page.includes(:elements).find(params[:page_id])
    element = page.elements.find_by_id(params[:element_id])
    redirect_to alchemy.show_page_url(
      :urlname => page.urlname,
      :lang => multi_language? ? page.language_code : nil,
      :anchor => element ? element.dom_id : nil
    )
  end
end

#readsObject



4
5
6
7
8
9
10
# File 'app/controllers/alchemy_crm/recipients_controller.rb', line 4

def reads
  recipient = Recipient.find_by_sha1(params[:h])
  if recipient && !recipient.read?
    recipient.reads!
  end
  render :nothing => true
end