Permalink
Browse files

EMail-Template fixes

  • Loading branch information...
1 parent db88058 commit 778b14120856dbbcd34462018e2ed17edd7b3577 @iboard committed Feb 14, 2012
View
@@ -105,8 +105,8 @@ Layout and Templates
* Edit application.css or 'your_name_given_at_install'.css
* Edit views/layout/application.html or views/layout/'your_name_given_at_install'.html.erb
- * Read [Posting](/blogs/4d456adae7798923b100000a/postings/4dbebb9adaf9853b3000001a)
- * Visit [Demo Page](/p/pagecomponent_and_pagetemplat$)
+ * Read [Posting](http://cba.iboard.cc/postings/4dbebb9adaf9853b3000001a)
+ * Visit [Demo Page](http://cba.iboard.cc/p/pagecomponent_and_pagetemplat$)
License
@@ -4,26 +4,27 @@
# and so on.
class Notifications < ActionMailer::Base
+ include ActionView::Helpers::SanitizeHelper
default :from => APPLICATION_CONFIG['registration_from']
# When a new user signed up, inform the adminstrator
def sign_up(new_user)
@user = new_user
- @notify_subject = "NEW SIGN UP AT #{APPLICATION_CONFIG['name']}"
+ @notify_subject = strip_tags "NEW SIGN UP AT #{APPLICATION_CONFIG['name']}"
mail( :to => APPLICATION_CONFIG['admin_notification_address'], :subject => @notify_subject)
end
# Inform the admin when a user cancel an account.
def cancel_account(user_info)
@user_info = user_info
- @notify_subject = "USER CANCELED ACCOUNT AT #{APPLICATION_CONFIG['name']}"
+ @notify_subject = strip_tags "USER CANCELED ACCOUNT AT #{APPLICATION_CONFIG['name']}"
mail( :to => APPLICATION_CONFIG['admin_notification_address'], :subject => @notify_subject)
end
# Inform the admin if a user confirms an account
def account_confirmed(user)
- @notify_subject = "USER CONFIRMED ACCOUNT AT #{APPLICATION_CONFIG['name']}"
+ @notify_subject = strip_tags( "USER CONFIRMED ACCOUNT AT #{APPLICATION_CONFIG['name']}")
@user = user
mail( :to => APPLICATION_CONFIG['admin_notification_address'], :subject => @notify_subject)
end
@@ -37,7 +38,7 @@ def new_posting_created(blog_id,posting_id)
@username = posting.user.name
@content = ContentItem::markdown(posting.body).html_safe
@url = blog_posting_url(blog,posting)
- @notify_subject = "A NEW POSTING WAS CREATED AT #{APPLICATION_CONFIG['name']}"
+ @notify_subject = strip_tags "A NEW POSTING WAS CREATED AT #{APPLICATION_CONFIG['name']}"
begin
# Attach cover picture
@@ -50,6 +51,7 @@ def new_posting_created(blog_id,posting_id)
# TODO: The following code doesn't work. Either there is a bug somewhere
# TODO: in CBA or in Rails::Mail. Only the cover-pic arrives.
# TODO: Check if it's possible to attach more files with Rails Mail - it should!
+ # TODO: Fix testing attachments at all!
# Attach attachments
posting.attachments.each do |att|
path = att.file.path.gsub(/\?.*$/,"")
@@ -1,6 +1,22 @@
<h3><%= @notify_subject %></h3>
-<%= debug @user %>
+<% [ :confirmation_sent_at,
+ :confirmed_at,:created_at,
+ :current_sign_in_at,
+ :current_sign_in_ip,
+ :email,
+ :last_sign_in_at,:last_sign_in_ip,
+ :name,
+ :roles_mask,
+ :sign_in_count,:updated_at,
+ :use_gravatar
+ ].each do |attribute| -%>
+ <p>
+ <strong><%= attribute.to_s.humanize -%></strong>
+ <%= @user.send(attribute) -%>
+ </p>
+ <% end %>
+%>
@@ -1,6 +1,9 @@
<%= @notify_subject %>
<%= "="*@notify_subject.length %>
-<%= debug @user %>
-
+<% [ :confirmation_sent_at,:confirmed_at,:created_at,:current_sign_in_at,:current_sign_in_ip,:email,:last_sign_in_at,:last_sign_in_ip,:name,:roles_mask,:sign_in_count,:updated_at,:use_gravatar
+ ].each do |attribute| -%>
+ <%= attribute.to_s.humanize -%>: <%= @user.send(attribute) -%>
+ <% end %>
+ %>
@@ -1,5 +1,8 @@
<h3><%= @notify_subject %></h3>
-<%= debug @user %>
-
+<% [ :confirmation_sent_at,:confirmed_at,:created_at,:current_sign_in_at,:current_sign_in_ip,:email,:last_sign_in_at,:last_sign_in_ip,:name,:roles_mask,:sign_in_count,:updated_at,:use_gravatar
+ ].each do |attribute| -%>
+ <p><strong><%= attribute.to_s.humanize -%></strong> <%= @user.send(attribute) -%></p>
+ <% end %>
+ %>
@@ -1,6 +1,10 @@
<%= @notify_subject %>
<%= "="*@notify_subject.length %>
-<%= debug @user %>
+<% [ :confirmation_sent_at,:confirmed_at,:created_at,:current_sign_in_at,:current_sign_in_ip,:email,:last_sign_in_at,:last_sign_in_ip,:name,:roles_mask,:sign_in_count,:updated_at,:use_gravatar
+ ].each do |attribute| -%>
+ <%= attribute.to_s.humanize -%>: <%= @user.send(attribute) -%>
+ <% end %>
+ %>
@@ -9,7 +9,7 @@ class AccountConfirmedNotifier < Struct.new( :args )
# Deliver a Notificaton using module {Notifications}
def perform
user = User.find(args[0])
- Notifications::account_confirmed(user,args[1],args[2]).deliver
+ Notifications::account_confirmed(user).deliver
end
end

0 comments on commit 778b141

Please sign in to comment.