bcms_contact_us_module 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,13 @@
1
1
  class BcmsNotifications < ActionMailer::Base
2
2
 
3
3
 
4
- def new_question_notification(question, recipients, from_email="no_reply@bcms-site.com", subject="New question submitted")
5
- subject subject
6
- recipients recipients
7
- from from_email
4
+ def message_notification(question, to, from_email="no_reply@bcms-site.com", subject="New message")
5
+ recipients to
6
+ from from_email
7
+ subject subject
8
+ sent_on Time.now
8
9
 
9
- body "Question Subject: " + question.subject + "\n\n" + question.message
10
+ body :question => question
10
11
  end
11
12
 
12
13
  end
@@ -14,12 +14,18 @@ class ContactUsPortlet < Portlet
14
14
 
15
15
  if question.save
16
16
 
17
- if self.notify_me
18
- begin
19
- Notifications.deliver_new_question_notification(question, self.notify_emails)
20
- rescue => e
21
- logger.error "[ERROR] in ContactUsPortlet => #{e}"
17
+ if self.notify_me.to_i == 1
18
+ logger.debug "[DEBUG] notify me is enabled"
19
+ unless self.notify_emails.blank?
20
+ logger.debug "[DEBUG] Sending email to #{self.notify_emails}"
21
+ begin
22
+ BcmsNotifications.deliver_message_notification(question, self.notify_emails)
23
+ rescue => e
24
+ logger.error "[ERROR] in ContactUsPortlet => #{e}"
25
+ end
22
26
  end
27
+ else
28
+ logger.debug "[DEBUG] E-Mail is disabled"
23
29
  end
24
30
 
25
31
  flash[:notice] = "We have received your message and will get intouch with you within 48 hours."
@@ -0,0 +1,7 @@
1
+ from........: <%= @question.name %>
2
+ email.......: <%= @question.email %>
3
+ subject.....: <%= @question.subject %>
4
+
5
+ =============================================================
6
+
7
+ <%= @question.message %>
@@ -8,6 +8,12 @@
8
8
  <body>
9
9
  <%= cms_toolbar %>
10
10
  <%= render_breadcrumbs %>
11
+ <% if flash[:notice] %>
12
+ <p class="notice"><%= flash[:notice] %></p>
13
+ <% end %>
14
+ <% if flash[:error] %>
15
+ <p class="error"><%= flash[:error] %></p>
16
+ <% end %>
11
17
  <%= container :default %>
12
18
  </body>
13
19
  </html>
@@ -1,7 +1,7 @@
1
1
  <%= f.cms_text_field :name %>
2
2
  <%= f.cms_check_box :notify_me, :instructions => 'To enable email notification put a check mark here.' %>
3
3
  <%= f.cms_text_field :notify_emails,
4
- :instructions => 'Email addresses to notify after a successful submitted question; emails separated by a comma' %>
4
+ :instructions => 'Email addresse to notify after a successful submitted question; emails separated by a comma' %>
5
5
  <%= f.cms_drop_down :success_url,
6
6
  [["Default url",""]] + Page.all(:order => "name").map{|c| ["#{c.name} - [#{c.path}]", c.path]},
7
7
  :label => "Success url",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_contact_us_module
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 3
10
- version: 1.1.3
9
+ - 4
10
+ version: 1.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Freddy Andersen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-17 00:00:00 -08:00
18
+ date: 2011-03-29 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -36,6 +36,7 @@ files:
36
36
  - app/models/bcms_question.rb
37
37
  - app/portlets/contact_us_portlet.rb
38
38
  - app/portlets/helpers/contact_us_portlet_helper.rb
39
+ - app/views/bcms_notifications/message_notification.text.plain.erb
39
40
  - app/views/cms/bcms_questions/_form.html.erb
40
41
  - app/views/cms/bcms_questions/render.html.erb
41
42
  - app/views/layouts/templates/default.html.erb
@@ -83,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
84
  requirements: []
84
85
 
85
86
  rubyforge_project:
86
- rubygems_version: 1.4.1
87
+ rubygems_version: 1.6.2
87
88
  signing_key:
88
89
  specification_version: 3
89
90
  summary: Contact Us portlet in BrowserCMS