Class: Admin::Blog::SettingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/admin/blog/settings_controller.rb

Overview

@Name: Admin Blog Settings controller @Use: Creating , modifying, deleting blog settings for the cms @Created date: 08-06-2012 @Modified Date: 29-06-2012

@Company:  Mindfire Solutions

Instance Method Summary collapse

Methods inherited from ApplicationController

#find_tags

Methods included from BlogHelper

#blog_archive_list, #blog_post_teaser, #next_or_previous?

Instance Method Details

#commentsObject

Checking for the blog is commentable or not then do commentable or uncommentable



23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/admin/blog/settings_controller.rb', line 23

def comments
  value = BlogPost::CommentSetting.is_comments_allowed?
  
  if value      
    BlogPost::CommentSetting.do_uncommentable
  else
    BlogPost::CommentSetting.do_commentable
  end

  redirect_to request.env['HTTP_REFERER']
end

#moderationObject

Checking for the blog is moderatable or not then do moderatable or moderatable



36
37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/admin/blog/settings_controller.rb', line 36

def moderation
  value = BlogPost::CommentSetting.is_comments_moderated?

  if value
    BlogPost::CommentSetting.do_unmoderatable
  else
    BlogPost::CommentSetting.do_moderatable
  end

  redirect_to request.env['HTTP_REFERER']
end

#notification_recipientsObject

notification_recipients for notifying recipients



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'app/controllers/admin/blog/settings_controller.rb', line 49

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 => params[:recipients])
    unless request.xhr? 
      redirect_to admin_blog_posts_path
    else
      render :text => "<script type='text/javascript'>parent.window.location = '#{admin_blog_posts_path}';</script>",
             :layout => false
    end
  end
end