beef-articles 0.3.35 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/controllers/admin/comments_controller.rb +10 -0
- data/app/controllers/comments_controller.rb +10 -6
- data/app/views/admin/comments/index.html.erb +7 -4
- data/app/views/articles/index.html.erb +1 -1
- data/generators/articles_migration/templates/migration.rb +1 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -20,6 +20,9 @@ class Admin::CommentsController < Admin::BaseController
|
|
20
20
|
|
21
21
|
def destroy
|
22
22
|
@comment = Comment.find(params[:id])
|
23
|
+
if spam_markable? and params[:spam]
|
24
|
+
Viking.mark_as_spam(@comment.spam_signature)
|
25
|
+
end
|
23
26
|
@comment.destroy
|
24
27
|
flash[:notice] = 'Comment was successfully deleted.'
|
25
28
|
|
@@ -28,4 +31,11 @@ class Admin::CommentsController < Admin::BaseController
|
|
28
31
|
format.xml { head :ok }
|
29
32
|
end
|
30
33
|
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def spam_markable?
|
38
|
+
@spam_markable ||= defined?( Viking ) and Comment.new.respond_to?(:spam_signature)
|
39
|
+
end
|
40
|
+
helper_method :spam_markable?
|
31
41
|
end
|
@@ -8,9 +8,8 @@ class CommentsController < ApplicationController
|
|
8
8
|
|
9
9
|
@comment = @commentable.comments.build(params[:comment])
|
10
10
|
|
11
|
-
if defined?( Viking )
|
12
|
-
|
13
|
-
viking_response = viking.check_comment( :user_ip => request.remote_ip,
|
11
|
+
if defined?( Viking )
|
12
|
+
viking_response = Viking.check_comment( :user_ip => request.remote_ip,
|
14
13
|
:article_date => @commentable.published_at,
|
15
14
|
:comment_author => @comment.name,
|
16
15
|
:comment_type => 'comment',
|
@@ -20,9 +19,14 @@ class CommentsController < ApplicationController
|
|
20
19
|
:referrer => request.referer,
|
21
20
|
:permalink => @commentable )
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
if viking_response
|
23
|
+
logger.info "VIKING RESPONSE: #{viking_response.inspect}"
|
24
|
+
@comment.spam_filter = !viking_response[:spam]
|
25
|
+
@comment.spam_signature = viking_response[:signature] if @comment.respond_to?(:spam_signature)
|
26
|
+
else
|
27
|
+
logger.warn "VIKING OPTIONS INCORRECT"
|
28
|
+
@comment.spam_filter = true
|
29
|
+
end
|
26
30
|
else
|
27
31
|
@comment.spam_filter = true
|
28
32
|
end
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<%= sortable_table_header :name => "Name", :sort => "name" %>
|
10
10
|
<%= sortable_table_header :name => "Comment", :sort => "comment" %>
|
11
11
|
<%= sortable_table_header :name => "Created", :sort => "created_at" %>
|
12
|
-
<th>Actions</th>
|
12
|
+
<th colspan="<% spam_markable? ? 3 : 2 %>">Actions</th>
|
13
13
|
</tr>
|
14
14
|
</thead>
|
15
15
|
<tbody>
|
@@ -21,19 +21,22 @@
|
|
21
21
|
<td><%= mail_to comment.email, comment.name %></td>
|
22
22
|
<td><%=h comment.comment %></td>
|
23
23
|
<td class="date"><%= comment.created_at.to_formatted_s(:short) %></td>
|
24
|
-
|
24
|
+
<% if spam_markable? %>
|
25
|
+
<td><%= link_to 'Spam', admin_comment_path(comment, :spam => true), :confirm => 'Are you sure you want to delete this comment and mark it as spam?', :method => :delete, :class => 'spam' %></td>
|
26
|
+
<% end -%>
|
27
|
+
<td><%= link_to 'Destroy', admin_comment_path(comment), :confirm => 'Are you sure you want to delete this comment?', :method => :delete, :class => 'delete' %></td>
|
25
28
|
</tr>
|
26
29
|
<% end %>
|
27
30
|
</tbody>
|
28
31
|
<tfoot>
|
29
32
|
<tr>
|
30
|
-
<% if
|
33
|
+
<% if spam_markable? -%>
|
31
34
|
<th>Article</th>
|
32
35
|
<% end -%>
|
33
36
|
<%= sortable_table_header :name => "Name", :sort => "name" %>
|
34
37
|
<%= sortable_table_header :name => "Comment", :sort => "comment" %>
|
35
38
|
<%= sortable_table_header :name => "Created", :sort => "created_at" %>
|
36
|
-
<th>Actions</th>
|
39
|
+
<th colspan="<% spam_markable? ? 3 : 2 %>">Actions</th>
|
37
40
|
</tr>
|
38
41
|
</tfoot>
|
39
42
|
</table>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<h1>Articles</h1>
|
6
6
|
|
7
|
-
<%= link_to
|
7
|
+
<%= link_to('RSS', {:tag => params[:tag], :page => nil, :format => 'rss'}, :class => 'rss') unless params[:year] %>
|
8
8
|
|
9
9
|
|
10
10
|
<!-- so:main-content -->
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beef-articles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve England
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-19 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -110,5 +110,5 @@ specification_version: 3
|
|
110
110
|
summary: Article/Blogging engine
|
111
111
|
test_files:
|
112
112
|
- test/articles_test.rb
|
113
|
-
- test/test_helper.rb
|
114
113
|
- test/schema.rb
|
114
|
+
- test/test_helper.rb
|