Sha256: 2e1060dab113bf9c1810de3e397e48f37df122dc865305118d453370cf88ad18

Contents?: true

Size: 743 Bytes

Versions: 6

Compression:

Stored size: 743 Bytes

Contents

module Kuhsaft
  class PagesController < ::ApplicationController
    respond_to :html

    def index
      @search = params[:search]
      if @search.present?
        @pages = Kuhsaft::Page.unscoped.published.content_page.search(@search)
      end
    end

    def show
      url = locale.to_s
      url += "/#{params[:url]}" if params[:url].present?
      @page = Kuhsaft::Page.find_by_url(url)

      if @page.present? && @page.redirect? && @page.redirect_url.present?
        redirect_to "/#{@page.redirect_url}"
      elsif @page.present?
        respond_with @page
      elsif @page.blank? && respond_to?(:handle_404)
        handle_404
      else
        raise ActionController::RoutingError.new('Not Found')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kuhsaft-1.8.1 app/controllers/kuhsaft/pages_controller.rb
kuhsaft-2.0.1 app/controllers/kuhsaft/pages_controller.rb
kuhsaft-2.0.0 app/controllers/kuhsaft/pages_controller.rb
kuhsaft-1.8.0 app/controllers/kuhsaft/pages_controller.rb
kuhsaft-1.7.1 app/controllers/kuhsaft/pages_controller.rb
kuhsaft-1.7.0 app/controllers/kuhsaft/pages_controller.rb