Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 341
- Log:
Lots of changes to Hub to make it Rails 2.3.11 compatible. This is being
checked in as one large changeset because it doesn't really split down into
smaller components without having something that doesn't function in the
intermediate steps.
- Author:
- rool
- Date:
- Sat Mar 19 19:11:39 +0000 2011
- Size:
- 2153 Bytes
1 | class UserNotifier < ActionMailer::Base |
2 | |
3 | helper :application |
4 | |
5 | EMAIL_PLAIN_TEXT_LINE_WIDTH = 70 |
6 | |
7 | # Return a string formatted according to e-mail text width resrtrictions. |
8 | # |
9 | def self.formatted( text ) |
10 | # The strange 'extend' stuff is a way of calling through to a helper. |
11 | Object.new.extend( ActionView::Helpers::TextHelper ).word_wrap( |
12 | text, |
13 | :line_width => EMAIL_PLAIN_TEXT_LINE_WIDTH |
14 | ) |
15 | end |
16 | |
17 | def signup_notification(user) |
18 | setup_mail( |
19 | user, |
20 | "[#{INSTITUTION_NAME_SHORT}] Please activate your new web site account", |
21 | url_for(:controller => :account, |
22 | :action => :activate, |
23 | :id => user.activation_code, |
24 | :protocol => 'https') |
25 | ) |
26 | end |
27 | |
28 | def activation(user) |
29 | setup_mail( |
30 | user, |
31 | "[#{INSTITUTION_NAME_SHORT}] Your web site account has been activated", |
32 | root_url() |
33 | ) |
34 | end |
35 | |
36 | def forgot_password(user) |
37 | setup_mail( |
38 | user, |
39 | "[#{INSTITUTION_NAME_SHORT}] Request to change a web site account password", |
40 | url_for(:controller => :account, |
41 | :action => :reset_password, |
42 | :id => user.password_reset_code, |
43 | :protocol => 'https') |
44 | ) |
45 | end |
46 | |
47 | def reset_password(user) |
48 | setup_mail( |
49 | user, |
50 | "[#{INSTITUTION_NAME_SHORT}] Your web site account password has been reset", |
51 | EMAIL_ADMIN |
52 | ) |
53 | end |
54 | |
55 | def destruction(user) |
56 | setup_mail( |
57 | user, |
58 | "[#{INSTITUTION_NAME_SHORT}] Your web site account has been deleted", |
59 | EMAIL_ADMIN |
60 | ) |
61 | end |
62 | |
63 | protected |
64 | |
65 | # Prepare for and render an e-mail message view. Pass the recipient User |
66 | # object, subject text and an associated URL which will be shown in the body. |
67 | # |
68 | # Passes parameter 'url' through as local "@url" through to the view. |
69 | # |
70 | def setup_mail( user, subject, url ) |
71 | subject subject |
72 | from EMAIL_ADMIN |
73 | recipients user.email |
74 | sent_on Time.now |
75 | content_type 'text/plain' |
76 | body render( |
77 | :file => "user_notifier/#{ action_name }.txt.erb", |
78 | :body => { :url => url } |
79 | ) |
80 | end |
81 | end |