module Hancock::Faq::Controllers::Categories

Public Instance Methods

category_class() click to toggle source
# File lib/hancock/faq/controllers/categories.rb, line 38
def category_class
  Hancock::Faq::Category
end
index() click to toggle source
# File lib/hancock/faq/controllers/categories.rb, line 8
def index
  @categories = category_class.enabled.sorted.page(params[:page]).per(per_page)
  @root_categories = category_class.enabled.roots.sorted.all
  # index_crumbs
end
page_title() click to toggle source
Calls superclass method
# File lib/hancock/faq/controllers/categories.rb, line 29
def page_title
  if @category
    @category.page_title
  else
    super
  end
end
per_page() click to toggle source
# File lib/hancock/faq/controllers/categories.rb, line 45
def per_page
  10
end
question_class() click to toggle source
# File lib/hancock/faq/controllers/categories.rb, line 41
def question_class
  Hancock::Faq::Question
end
questions_per_page() click to toggle source
# File lib/hancock/faq/controllers/categories.rb, line 48
def questions_per_page
  10
end
show() click to toggle source
# File lib/hancock/faq/controllers/categories.rb, line 14
def show
  @category = category_class.enabled.find(params[:id])
  if !@category.text_slug.blank? and @category.text_slug != params[:id]
    redirect_to hancock_faq_category_path(@category), status_code: 301
    return
  end
  @seo_parent_page = find_seo_page(hancock_faq_categories_path)

  @children = @category.children.enabled.sorted.all
  @questions = @category.questions.enabled.sorted.all.page(params[:page]).per(questions_per_page)

  # index_crumbs
  # category_crumbs
end