Module: UserOrderNotifications

Defined in:
lib/kete_gets_trollied/user_order_notifications.rb

Overview

each notification expects an order object

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
# File 'lib/kete_gets_trollied/user_order_notifications.rb', line 4

def self.included(klass)
  klass.send :include, HasTrolleyControllerHelpersOverrides
end

Instance Method Details

#cancelled(order, user, cancelling_user) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/kete_gets_trollied/user_order_notifications.rb', line 8

def cancelled(order, user, cancelling_user)
  setup_email(user)
  @subject += I18n.t("user_notifier_model.subject_cancelled")
  @body[:order] = order
  @body[:cancelling_user] = cancelling_user
  set_body_url_for(order, user)
end

#new_note(order, note, user) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/kete_gets_trollied/user_order_notifications.rb', line 27

def new_note(order, note, user)
  setup_email(user)
  @subject += I18n.t("user_notifier_model.subject_new_note")
  @body[:order] = order
  @body[:note] = note
  set_body_url_for(order, user)
end

#set_body_url_for(order, user) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/kete_gets_trollied/user_order_notifications.rb', line 35

def set_body_url_for(order, user)
  @body[:url] = url_for(:controller => :orders,
                        :action => :show,
                        :id => order,
                        :urlified_name => order.basket.urlified_name,
                        :host => Kete.site_name)
end