*** *** ** ** ** ** * * * * * * * ** ** ** ** ** ** * ____ _ _ ____ _ _ | _ \ __ _(_) |___ / ___(_)_ __| |___ | |_) / _` | | / __| | | _| | '__| / __| | _ < (_| | | \__ \ | |_| | | | | \__ \ |_| \_\__,_|_|_|___/ \____|_|_| |_|___/
Work in progress below…
* pdfkit * wkhtmltopdf-binary * bootstrap-sass * sqlite3 (only development) * pg (only production)
* see public/example.html
* import twitter bootstrap css files * require twitter bootstrap javascripts * change application layout to use twitter bootstrap html structure
* generate welcome controller with index action: `rails g controller welcome index` * use welcome#index as homepage * update homepage text contents
* generate certificate scaffold: `rails g scaffold certificate name email` * remove unused certificate resource routes, actions, views * add certificate model validations * update certificate controller and views code
* add erb version of the example.html template * add controller code to handle pdf representation of certificate
“‘ruby
# ... format.pdf do kit = PDFKit.new(certificate_html) filename = "#{@certificate.name.parameterize}.pdf" send_data kit.to_pdf, :filename => filename, :content_type => 'application/pdf' end def certificate_html template = ERB.new File.read(Rails.root.join('app/views/certificates/example.html.erb')) template.result(binding) end
“‘
* remove autogenerate scaffold.css file * add some css styles