lib/spud_blog/engine.rb in tb_blog-1.1.1 vs lib/spud_blog/engine.rb in tb_blog-1.1.2
- old
+ new
@@ -21,15 +21,21 @@
initializer :admin do
if Spud::Blog.enable_sitemap == true
Spud::Core.config.sitemap_urls += [:blog_sitemap_url]
end
if Spud::Blog.config.blog_enabled
- Spud::Core.config.admin_applications += [{
+ blog_app = {
:name => 'Blog Posts',
:thumbnail => 'spud/admin/posts_thumb.png',
:url => '/admin/posts',
:order => 1
- }]
+ }
+ if Spud::Blog.config.default_comment_approval == false
+ blog_app[:badge] = ->(user){
+ SpudPostComment.where(:approved => false).count()
+ }
+ end
+ Spud::Core.config.admin_applications += [blog_app]
end
if Spud::Blog.config.news_enabled
Spud::Core.config.admin_applications += [{
:name => 'News Posts',
:thumbnail => 'spud/admin/news_thumb.png',