Class: Admin::Blog::SettingsController

Inherits:
Admin::BaseController
  • Object
show all
Defined in:
app/controllers/admin/blog/settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#commentsObject



29
30
31
32
33
34
35
36
37
# File 'app/controllers/admin/blog/settings_controller.rb', line 29

def comments
  enabled = BlogComment.toggle!
  unless request.xhr?
    redirect_back_or_default(admin_blog_posts_path)
  else
    render :json => {:enabled => enabled},
           :layout => false
  end
end

#moderationObject



19
20
21
22
23
24
25
26
27
# File 'app/controllers/admin/blog/settings_controller.rb', line 19

def moderation
  enabled = BlogComment::Moderation.toggle!
  unless request.xhr?
    redirect_back_or_default(admin_blog_posts_path)
  else
    render :json => {:enabled => enabled},
           :layout => false
  end
end

#notification_recipientsObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/admin/blog/settings_controller.rb', line 3

def notification_recipients
  @recipients = BlogComment::Notification.recipients

  if request.post?
    BlogComment::Notification.recipients = params[:recipients]
    flash[:notice] = t('admin.blog.settings.notification_recipients.updated',
                       :recipients => BlogComment::Notification.recipients)
    unless request.xhr? or from_dialog?
      redirect_back_or_default(admin_blog_posts_path)
    else
      render :text => "<script type='text/javascript'>parent.window.location = '#{admin_blog_posts_path}';</script>",
             :layout => false
    end
  end
end