Sha256: 23df09a193f3b20a3e36b23f61cd3bd0ed7e94e8ffd36e77db065b9b1ec0275e

Contents?: true

Size: 971 Bytes

Versions: 3

Compression:

Stored size: 971 Bytes

Contents

module Spree
  class QuestionsController < Spree::BaseController 

    def index
      @questions = Question.page(params[:page])
      raise ActionController::RoutingError.new('No Matching Questions') if not params[:page].nil? and @questions.all.empty?
      
      @title = 'Frequently Asked Questions'
      @canonical_url = questions_path(:page => (not params[:page].nil? and params[:page].to_i > 1 ? params[:page] : nil))
    end

    def browse
      @taxon = Taxon.find_by_permalink!(params[:id])
      @questions = @taxon.questions.page(params[:page])
      raise ActionController::RoutingError.new('No Matching Questions') if @questions.all.empty?

      @title = "#{@taxon.name} Frequently Asked Questions"

      render :index
    end
  
    def show
      @question = Question.find_by_slug!(params[:id])
      
      @title = @question.question
      @description = @question.description
      
      @canonical_url = question_path(@question)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_grid_faq-0.1.0 app/controllers/spree/questions_controller.rb
spree_grid_faq-0.0.9 app/controllers/spree/questions_controller.rb
spree_grid_faq-0.0.8 app/controllers/spree/questions_controller.rb