Class: Blog::CategoriesController

Inherits:
BlogController
  • Object
show all
Includes:
SettingsHelper
Defined in:
app/controllers/blog/categories_controller.rb

Overview

Name: Categories controller Use: Creating , modifying, deleting blog categories for the cms Created date: 27-06-2012

Modified date: 27-06-2012
Company : Mindfire Solutions

Instance Method Summary collapse

Methods included from SettingsHelper

#blog_posts_per_page, commentable, moderatable, uncommentable, unmoderatable

Instance Method Details

#find_tagsObject

finding tags for blog posts



31
32
33
# File 'app/controllers/blog/categories_controller.rb', line 31

def find_tags
  @tags = BlogPost.tag_counts_on(:tags)
end

#load_cssObject

load_assets includes all css files for this controller



26
27
28
# File 'app/controllers/blog/categories_controller.rb', line 26

def load_css
  AssetManager.include_css [:blog_home, :home]
end

#showObject

show to show category per id



17
18
19
20
21
22
23
# File 'app/controllers/blog/categories_controller.rb', line 17

def show
  @category = BlogCategory.find(params[:id])
  @blog_posts = @category.posts.live.includes(:comments, :categories).paginate({
    :page => params[:page],
    :per_page => blog_posts_per_page
  })
end