Permalink
Browse files

Allow disabling of input filters.

  • Loading branch information...
1 parent 5b429d3 commit 1b7aec407f732d8c13dd33de5e95fdae8c150ba6 @ntalbott ntalbott committed May 23, 2008
@@ -18,7 +18,6 @@ def destroy
@comment.destroy
announce_comment_removed
ResponseCache.instance.expire_response(@comment.page.url)
- #redirect_to admin_page_comments_path(@comment.page)
redirect_to :back
end
@@ -29,12 +28,11 @@ def edit
def update
@comment = Comment.find(params[:id])
begin
-
TextFilter.descendants.each do |filter|
@comment.content_html = filter.filter(@comment.content) if filter.filter_name == @comment.filter_id
end
@comment.update_attributes(params[:comment])
- ResponseCache.instance.clear #expire_response(page.url)
+ ResponseCache.instance.clear
flash[:notice] = "Comment Saved"
redirect_to :action => :index
rescue Exception => e
@@ -9,8 +9,12 @@ def create
@comment = @page.comments.build(params[:comment])
@comment.request = request
- TextFilter.descendants.each do |filter|
- @comment.content_html = filter.filter(@comment.content) if filter.filter_name == @comment.filter_id
+ if Radiant::Config['comments.filters_enabled'] == "true"
+ TextFilter.descendants.each do |filter|
+ @comment.content_html = filter.filter(@comment.content) if filter.filter_name == @comment.filter_id
+ end
+ else
+ @comment.content_html = help.simple_format(help.h(@comment.content))
end
if !@comment.is_spam?
@@ -22,4 +26,19 @@ def create
redirect_to "#{@page.url}#comment_#{@comment.id}" and return
end
+ private
+
+ @@help = nil
+ def help
+ unless @@help
+ class << (@@help = Object.new)
+ include ERB::Util
+ include ActionView::Helpers::TextHelper
+ include ActionView::Helpers::TagHelper
+ public :h
+ end
+ end
+ @@help
+ end
+
end
@@ -11,7 +11,7 @@
</cite>
- <blockquote><%= comment.content %></blockquote>
+ <blockquote><%= comment.content_html %></blockquote>
</td>
<td class="controls right">
<div class="nowrap">
View
@@ -38,6 +38,7 @@ def activate
'notification_to' => '',
'akismet_key' => '',
'akismet_url' => '',
+ 'filters_enabled' => 'true',
}.each{|k,v| Radiant::Config.create(:key => "comments.#{k}", :value => v) unless Radiant::Config["comments.#{k}"]}
end

0 comments on commit 1b7aec4

Please sign in to comment.