public
Description: This contains various plugins for Feather
Clone URL: git://github.com/eldiablo/feather-plugins.git
Search Repo:
Click here to lend your support to: feather-plugins and make a donation at www.pledgie.com !
finished implementing comment e-mail notifications; also added comment 
bookmarks within the post so that comment links go to the right comment
eldiablo (author)
Fri Apr 18 15:26:40 -0700 2008
commit  4c3f4653c489c5cd975a6f9505d5684161782fbb
tree    3ce7f1e2a2562626346956db6018f2058f74a345
parent  c2e8abeec0b01d441e8a29f8921e6994b0aa2b42
...
8
9
10
11
12
 
 
 
 
 
13
14
15
...
8
9
10
 
 
11
12
13
14
15
16
17
18
0
@@ -8,8 +8,11 @@
0
       article = Article[@comment.article_id]
0
       expire_index
0
       expire_article(article)
0
-
0
- send_mail(CommentMailer, :notify, {:from => "", :to => "", :subject => ""}, {:comment => @comment})
0
+ if CommentSetting.current.email_notification
0
+ email_params = { :from => CommentSetting.current.from_email, :to => CommentSetting.current.to_email, :subject => "New comment - RE: #{article.title}" }
0
+ params = { :comment => @comment, :article => article, :request => request }
0
+ send_mail(CommentMailer, :notify, email_params, params)
0
+ end
0
     end
0
     redirect article.permalink
0
   end
...
1
2
3
 
4
5
6
...
1
2
3
4
5
6
7
0
@@ -1,6 +1,7 @@
0
 require File.join(File.join(File.join(File.dirname(__FILE__), "controllers"), "admin"), "comments")
0
 require File.join(File.join(File.join(File.dirname(__FILE__), "controllers"), "admin"), "comment_settings")
0
 require File.join(File.join(File.dirname(__FILE__), "controllers"), "comments")
0
+require File.join(File.join(File.dirname(__FILE__), "mailers"), "comment_mailer")
0
 require File.join(File.join(File.dirname(__FILE__), "models"), "comment")
0
 require File.join(File.join(File.dirname(__FILE__), "models"), "comment_setting")
0
 
...
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
0
@@ -1 +1,11 @@
0
+class CommentMailer < Merb::MailController
0
+ self._template_roots << [File.join(File.dirname(__FILE__), "views"), :_template_location]
0
+
0
+ def notify
0
+ @comment = params[:comment]
0
+ @article = params[:article]
0
+ @request = params[:request]
0
+ render_mail
0
+ end
0
+end
...
 
 
 
 
 
...
1
2
3
4
5
0
@@ -1 +1,6 @@
0
+This a notification to let you know that <%= @comment.name %> has left a comment on your post "<%= @article.title %>". You can view the comment at http://<%= @request.env["HTTP_HOST"] %><%= @article.permalink %>#<%= @comment.id %>.
0
+
0
+The comment is as follows:
0
+
0
+<%= @comment.comment %>
...
15
16
17
 
 
 
 
 
 
 
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
 
 
 
 
 
 
 
 
 
36
37
38
...
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
30
 
 
 
 
 
 
 
 
 
 
 
31
32
33
34
35
36
37
38
39
40
41
42
43
0
@@ -15,24 +15,29 @@
0
                 .:
0
                     - comment_settings.rb
0
                     - comments.rb
0
+ mailers:
0
+ .:
0
+ - comment_mailer.rb
0
+ views:
0
+ comment_mailer:
0
+ .:
0
+ - notify.text.erb
0
         models:
0
             .:
0
                 - comment.rb
0
                 - comment_setting.rb
0
         views:
0
- .:
0
             admin:
0
- .:
0
- comment_settings:
0
- .:
0
- - edit.html.erb
0
- - show.html.erb
0
- comments:
0
- .:
0
- - _comment.html.erb
0
- - index.html.erb
0
- - show.html.erb
0
- - update.js.erb
0
+ comment_settings:
0
+ .:
0
+ - edit.html.erb
0
+ - show.html.erb
0
+ comments:
0
+ .:
0
+ - _comment.html.erb
0
+ - index.html.erb
0
+ - show.html.erb
0
+ - update.js.erb
0
             after_article:
0
                 .:
0
                     - _comments.html.erb
...
5
6
7
 
8
9
10
...
5
6
7
8
9
10
11
0
@@ -5,6 +5,7 @@
0
 <ol class="comments" id="comments">
0
 <!-- Put this in a partial. Actually I think we should reopen the article model, and stick in has_many :comments. do that. -->
0
 <% Comment.all_for_post(@article.id).each do |comment| %>
0
+ <a name="<%= comment.id %>" />
0
   <li id="comment-<%= comment.id %>" class="comment">
0
     <div class="author">
0
       <cite><span class="author"><span><%= comment.website.blank? ? h(comment.name) : link_to(h(comment.name), comment.website) %></span></span></cite> –

Comments

    No one has commented yet.