Sha256: fc826763fda7a4e2952c6b3bff18b4f4674f0cc87a4ae5af6ec218df5549deab
Contents?: true
Size: 853 Bytes
Versions: 1
Compression:
Stored size: 853 Bytes
Contents
class FormsController < ApplicationController respond_to :html, :pdf before_filter do @form = ActiveadminSelleoCms::Form.find(params[:id]) end def download respond_to do |format| format.pdf do render :pdf => @form.title.parameterize end end end def deliver respond_to do |format| format.html do pdf = WickedPdf.new.pdf_from_string( render_to_string('download.pdf.erb') ) pdf_path = File.join(ActiveadminSelleoCms::Form::PDF_PATH, "#{@form.title.parameterize}-#{Time.now.to_s.parameterize}.pdf") File.open(pdf_path, 'wb') do |file| file << pdf end ActiveadminSelleoCms::FormMailer.form_submission(pdf_path).deliver flash[:notice] = "Your form has been sent. Thank you." end end end def answer end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activeadmin-selleo-cms-0.0.46 | app/controllers/forms_controller.rb |