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 !
The Admin::Comments page styles the comment's using the spam engine's 
class wishes.

The Defensio engine passes in a spaminess class, which the public 
stylesheet reuses to highlight spam-like comments.
francois (author)
Mon Mar 03 10:43:43 -0800 2008
commit  bf56e8977833010e1a537b1873518fbf8be56ac6
tree    ea1dc21eee3703a2dd37a1160348bf24494907ee
parent  a27e961912a2338249258d7f838aef484de01365
...
71
72
73
 
 
 
 
74
75
76
...
71
72
73
74
75
76
77
78
79
80
0
@@ -71,6 +71,10 @@ class Comment < Content
0
     spam_engine(site).mark_as_ham(article.permalink_url(site, request), self)
0
   end
0
 
0
+ def spam_engine_classes
0
+ spam_engine(self.site).classes(self)
0
+ end
0
+
0
   protected
0
     def spam_engine(site)
0
       site.spam_engine
...
19
20
21
22
 
23
24
25
...
62
63
64
65
66
 
...
19
20
21
 
22
23
24
25
...
62
63
64
 
65
66
0
@@ -19,7 +19,7 @@ Comments for all articles
0
   <li class="event-comment<%= " shade" if (i % 2 > 0) %>" id="comment-<%= comment.id %>">
0
     <a name="comment-<%= comment.id %>"></a>
0
     <% unless comment.body.blank? -%>
0
- <blockquote><p>"<%= strip_tags(comment.body) %>"</p></blockquote>
0
+ <blockquote class="<%= comment.spam_engine_classes %>"><p>"<%= strip_tags(comment.body) %>"</p></blockquote>
0
     <% end -%>
0
     <span class="meta">
0
       <cite>&mdash; <%= author_link_for comment %><%= %( (#{comment.author_email})) unless comment.author_email.blank? %> said <%= time_ago_in_words comment.created_at %> ago</cite>
0
@@ -62,4 +62,4 @@ Comments for all articles
0
   if(comment) Element.addClassName(comment, 'focused');
0
   
0
 // ]]>
0
-</script>
0
\ No newline at end of file
0
+</script>
...
42
43
44
 
 
 
 
 
45
46
47
...
42
43
44
45
46
47
48
49
50
51
52
0
@@ -42,6 +42,11 @@ module Mephisto
0
         raise SubclassResponsibilityError
0
       end
0
 
0
+ # Returns a series of HTML classes that should be added to the comment's blockquote.
0
+ def classes(comment)
0
+ ""
0
+ end
0
+
0
       # Announces a new article was created.
0
       def announce_article(permalink_url, article)
0
         raise SubclassResponsibilityError
...
31
32
33
 
 
 
 
 
 
 
 
 
 
 
 
 
34
35
36
...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
0
@@ -31,6 +31,19 @@ module Mephisto
0
         )
0
       end
0
 
0
+ def classes(comment)
0
+ case (comment.spam_engine_data[:spaminess] || 0) * 100
0
+ when 0
0
+ "spam0"
0
+ when 0...30
0
+ "spam30"
0
+ when 30...75
0
+ "spam75"
0
+ else
0
+ "spam100"
0
+ end
0
+ end
0
+
0
       def ham?(permalink_url, comment)
0
         response = defensio.audit_comment(
0
           # Required parameters
...
1836
1837
1838
1839
 
 
 
 
...
1836
1837
1838
 
1839
1840
1841
1842
0
@@ -1836,4 +1836,7 @@ ul.nobull li label {
0
 .orange { background-color: #f63;}
0
 .red { background-color: #f33;}
0
 
0
-
0
+.spam0 { background: transparent; }
0
+.spam30 { background: #ffedcc; }
0
+.spam75 { background: #ffc354; }
0
+.spam100 { background: #ffa500; }

Comments

    No one has commented yet.