Sha256: 54133a9c993bd4078019be8cadd782ceb036f9ef9a34be9a84fe67e43ff0267b

Contents?: true

Size: 1.02 KB

Versions: 13

Compression:

Stored size: 1.02 KB

Contents

class Ecm::Cms::PageController < Ecm::Cms::Configuration.base_controller.constantize
  # add the page resolver
  include Ecm::Cms::ControllerExtensions::PageResolver
  include Ecm::Cms::ControllerExtensions::PartialResolver

  # avoid error 500 on missing template
  rescue_from ActionView::MissingTemplate do
    respond_to do |format|
      format.html do
        render(file: "#{Rails.root}/public/404", formats: [:html],
               layout: false,
               status: 404
              )
      end
      format.xml  { head :not_found }
      format.any  { head :not_found }
    end
  end

  def respond
    respond_to do |format|
      format.html { render template: params[:page] }
      format.txt  { render template: params[:page], layout: false, formats: [:text] }
      format.pdf do
        output = render_to_string template: params[:page], formats: [:html, :pdf], layout: false
        self.response_body = WickedPdf.new.pdf_from_string(output)
      end if Gem::Specification.find_all_by_name('wicked_pdf').any?
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ecm_cms2-4.0.1 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-4.0.0 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-3.0.3 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-3.0.2 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-3.0.1 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-3.0.0 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-2.1.4 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-2.1.3 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-2.1.2 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-2.1.1 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-2.1.0 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-2.0.4 app/controllers/ecm/cms/page_controller.rb
ecm_cms2-2.0.3 app/controllers/ecm/cms/page_controller.rb