Adds unmoderated support through changing approved to state.
This commit is contained in:
parent
64c036501c
commit
ac0b754237
3 changed files with 9 additions and 3 deletions
|
@ -2,6 +2,11 @@ class Admin::Blog::CommentsController < Admin::BaseController
|
|||
|
||||
crudify :blog_comment, :title_attribute => :name, :order => 'created_at DESC'
|
||||
|
||||
def index
|
||||
@blog_comments = BlogComment.unmoderated
|
||||
render :action => 'index'
|
||||
end
|
||||
|
||||
def approved
|
||||
@blog_comments = BlogComment.approved
|
||||
render :action => 'index'
|
||||
|
|
|
@ -4,8 +4,9 @@ class BlogComment < ActiveRecord::Base
|
|||
|
||||
acts_as_indexed :fields => [:name, :email, :body]
|
||||
|
||||
named_scope :approved, :conditions => {:approved => true}
|
||||
named_scope :rejected, :conditions => {:approved => false}
|
||||
named_scope :unmoderated, :conditions => {:state => nil}
|
||||
named_scope :approved, :conditions => {:state => 'approved'}
|
||||
named_scope :rejected, :conditions => {:state => 'rejected'}
|
||||
|
||||
module Moderation
|
||||
class << self
|
||||
|
|
|
@ -31,7 +31,7 @@ class RefineryBlogGenerator < Rails::Generator::NamedBase
|
|||
Rails::Generator::GeneratedAttribute.new('name', 'string'),
|
||||
Rails::Generator::GeneratedAttribute.new('email', 'string'),
|
||||
Rails::Generator::GeneratedAttribute.new('body', 'text'),
|
||||
Rails::Generator::GeneratedAttribute.new('approved', 'boolean'),
|
||||
Rails::Generator::GeneratedAttribute.new('state', 'string'),
|
||||
Rails::Generator::GeneratedAttribute.new('blog_post_id', 'integer')
|
||||
], :id => true
|
||||
},{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue