public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
show comment approval message

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1204 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Fri Jun 09 20:26:40 -0700 2006
commit  c149588b36b325c8cdfe688ddc5d0fcee0692109
tree    4d8102cf093101bb064720ed5d7a0fba7cd11c13
parent  d4b921e2cbd316e0159ebac70991d2970238df0c
...
16
17
18
 
19
20
21
...
16
17
18
19
20
21
22
0
@@ -16,6 +16,7 @@ class ApplicationController < ActionController::Base
0
     end
0
     
0
     assigns.update 'site' => site.to_liquid
0
+ logger.warn "ASSIGNS: #{assigns.inspect}"
0
     render :text => site.templates.render_liquid_for(template_type, assigns, self)
0
   end
0
   
...
23
24
25
26
 
 
 
 
 
 
 
 
 
 
27
28
29
30
31
32
33
34
35
36
37
38
39
...
23
24
25
 
26
27
28
29
30
31
32
33
34
35
36
 
 
 
 
 
 
 
 
 
 
37
38
0
@@ -23,17 +23,16 @@ class CommentsController < ApplicationController
0
         :comment_content => @comment.body
0
       logger.info "Checking Akismet (#{Akismet.api_key}) for new comment on Article #{@article.id}. #{@comment.approved ? 'Approved' : 'Blocked'}"
0
     end
0
- @comment.save
0
+
0
+ assigns = @comment.save ?
0
+ { 'message' => 'Thank you for comment. Your comment requires approval from the blog author before showing up.' } :
0
+ { 'errors' => @comment.errors.full_messages }
0
+
0
+ @comments = @article.comments.reject(&:new_record?).collect(&:to_liquid)
0
+ @article = @article.to_liquid(:single)
0
+ render_liquid_template_for(:single, assigns.merge('articles' => [@article],
0
+ 'article' => @article,
0
+ 'comments' => @comments))
0
     
0
- if @comment.new_record?
0
- @comments = @article.comments.reject(&:new_record?).collect(&:to_liquid)
0
- @article = @article.to_liquid(:single)
0
- render_liquid_template_for(:single, 'articles' => [@article],
0
- 'article' => @article,
0
- 'comments' => @comments,
0
- 'errors' => @comment.errors.full_messages)
0
- else
0
- redirect_to article_url(@article.hash_for_permalink(:anchor => "comment_#{@comment.id}"))
0
- end
0
   end
0
 end
...
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
21
22
...
6
7
8
 
 
 
 
 
 
 
 
 
 
 
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
0
@@ -6,17 +6,21 @@ module Mephisto
0
       def render(context)
0
         result = []
0
         context.stack do
0
- errors = context['errors'] ? %Q{<ul id="comment_errors"><li>#{context['errors'].join('</li><li>')}</li></ul>} : ''
0
-
0
- context['form'] = {
0
- 'body' => %(<textarea id="comment_body" name="comment[body]"></textarea>),
0
- 'name' => %(<input type="text" id="comment_author" name="comment[author]" />),
0
- 'email' => %(<input type="text" id="comment_author_email" name="comment[author_email]" />),
0
- 'url' => %(<input type="text" id="comment_author_url" name="comment[author_url]" />),
0
- 'submit' => %(<input type="submit" value="Send" />)
0
- }
0
-
0
- result << %(<form method="post" action="#{context['article']['url']}/comment">#{[errors]+render_all(@nodelist, context)}</form>)
0
+ if context['message'].blank?
0
+ errors = context['errors'].blank? ? '' : %Q{<ul id="comment_errors"><li>#{context['errors'].join('</li><li>')}</li></ul>}
0
+
0
+ context['form'] = {
0
+ 'body' => %(<textarea id="comment_body" name="comment[body]"></textarea>),
0
+ 'name' => %(<input type="text" id="comment_author" name="comment[author]" />),
0
+ 'email' => %(<input type="text" id="comment_author_email" name="comment[author_email]" />),
0
+ 'url' => %(<input type="text" id="comment_author_url" name="comment[author_url]" />),
0
+ 'submit' => %(<input type="submit" value="Send" />)
0
+ }
0
+
0
+ result << %(<form method="post" action="#{context['article']['url']}/comment">#{[errors]+render_all(@nodelist, context)}</form>)
0
+ else
0
+ result << %(<p id="comment-message">#{context['message']}</p>)
0
+ end
0
         end
0
         result
0
       end

Comments

    No one has commented yet.