app/controllers/ecm/cms/page_controller.rb in ecm_cms2-1.1.1 vs app/controllers/ecm/cms/page_controller.rb in ecm_cms2-2.0.2
- old
+ new
@@ -4,21 +4,26 @@
include Ecm::Cms::ControllerExtensions::PartialResolver
# avoid error 500 on missing template
rescue_from ActionView::MissingTemplate do
respond_to do |format|
- format.html {
- render(:file => "#{Rails.root}/public/404", :formats => [:html],
- :layout => false,
- :status => 404
- )
- }
+ 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
- render :template => params[:page]
+ respond_to do |format|
+ format.html { render template: params[:page] }
+ 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
-