aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2010-08-10 14:37:22 +1200
committerPhilip Arndt <parndt@gmail.com>2010-08-10 14:37:22 +1200
commit97accf9489e1951fa1f2fa69e82e829d23f7d067 (patch)
treef296cfb8d7bbc6d946bbe6237fc0d04122eba44b /app
parent69026512c92f5d8173ceecf20a8c8cafb0966eb5 (diff)
downloadrefinerycms-blog-97accf9489e1951fa1f2fa69e82e829d23f7d067.tar.gz
refinerycms-blog-97accf9489e1951fa1f2fa69e82e829d23f7d067.tar.bz2
refinerycms-blog-97accf9489e1951fa1f2fa69e82e829d23f7d067.zip
Make comment moderation toggleable
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/blog/settings_controller.rb3
-rw-r--r--app/models/blog_comment.rb17
2 files changed, 19 insertions, 1 deletions
diff --git a/app/controllers/admin/blog/settings_controller.rb b/app/controllers/admin/blog/settings_controller.rb
index 9ea2997..962e8d1 100644
--- a/app/controllers/admin/blog/settings_controller.rb
+++ b/app/controllers/admin/blog/settings_controller.rb
@@ -5,7 +5,8 @@ class Admin::Blog::SettingsController < Admin::BaseController
end
def moderation
-
+ BlogComment::Moderation.toggle
+ redirect_back_or_default(admin_blog_posts_path)
end
end
diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb
index ada3f14..aced256 100644
--- a/app/models/blog_comment.rb
+++ b/app/models/blog_comment.rb
@@ -6,4 +6,21 @@ class BlogComment < ActiveRecord::Base
named_scope :approved, :conditions => {:approved => true}
named_scope :rejected, :conditions => {:approved => false}
+
+ module Moderation
+ class << self
+ def enabled?
+ RefinerySetting.find_or_set(:comment_moderation, {
+ :value => true,
+ :scoping => :blog
+ })
+ end
+
+ def toggle
+ currently = self.enabled?
+ RefinerySetting[:comment_moderation] = !currently
+ end
+ end
+ end
+
end