Skip to content
Browse files

removing pdfkit middleware

  • Loading branch information...
1 parent 7ecf0c3 commit b6cdbbe63252b4e1dff835d88ce96e452d76aa27 @Omnipresent committed May 9, 2011
View
BIN app/controllers/.medicalhistories_controller.rb.swp
Binary file not shown.
View
23 app/controllers/medicalhistories_controller.rb
@@ -3,17 +3,24 @@ def index
@medicalhistories = Medicalhistory.all
end
+ def pdf
+ redirect_to "http://cricinfo.com"
+ end
+
def show
@medicalhistory = Medicalhistory.find(params[:id])
- respond_to do |format|
- format.pdf {
- html = render_to_string(:layout=>false, :action=>"show.html.erb")
+ respond_to do |format|
+ format.html # show.html.erb
+ format.pdf {
+ html = render_to_string(:template => "medicalhistories/show.html.erb")
kit = PDFKit.new(html)
- kit.stylesheets << "#{Rails.root}/public/stylesheets/application.css"
- send_data(kit.to_pdf, :filename => "labels.pdf", :type => 'application/pdf')
- return
- }
- end
+ kit.stylesheets << "#{Rails.root}/public/stylesheets/pdf.css"
+ send_data(kit.to_pdf, :filename => "#{@medicalhistory.fname}.pdf",
+ :type => 'application/pdf', :disposition => 'inline')
+ return
+ }
+
+ end
end
def new
View
BIN app/views/medicalhistories/.index.html.erb.swp
Binary file not shown.
View
2 app/views/medicalhistories/index.html.erb
@@ -12,7 +12,7 @@
<td><%= link_to "Show", medicalhistory %></td>
<td><%= link_to "Edit", edit_medicalhistory_path(medicalhistory) %></td>
<td><%= link_to "Delete", medicalhistory, :confirm => 'Are you sure?', :method => :delete %></td>
- <td><%= link_to "PDF", medicalhistory_path(medicalhistory, :format => "pdf")%></td>
+ <td><%= link_to "PDF", medicalhistory_path(medicalhistory, :format => "pdf")%></td>
</tr>
<% end %>
</table>
View
10 app/views/medicalhistories/show.html.erb
@@ -1,9 +1,9 @@
- <%= render :partial => 'about_show', :locals => { :f => @medicalhistory} %>
+ <%= render :partial => 'medicalhistories/about_show.html.erb', :locals => { :f => @medicalhistory} %>
- <%= render :partial => 'insurance_show', :locals => { :f => @medicalhistory} %>
+ <%= render :partial => 'medicalhistories/insurance_show.html.erb', :locals => { :f => @medicalhistory} %>
- <%= render :partial => 'medical_show', :locals => { :f => @medicalhistory} %>
+ <%= render :partial => 'medicalhistories/medical_show.html.erb', :locals => { :f => @medicalhistory} %>
- <%= render :partial => 'dental_show', :locals => { :f => @medicalhistory} %>
+ <%= render :partial => 'medicalhistories/dental_show.html.erb', :locals => { :f => @medicalhistory} %>
- <%= render :partial => 'consent_show', :locals => { :f => @medicalhistory} %>
+ <%= render :partial => 'medicalhistories/consent_show.html.erb', :locals => { :f => @medicalhistory} %>
View
2 config/application.rb
@@ -38,7 +38,7 @@ class Application < Rails::Application
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
- config.middleware.use "PDFKit::Middleware", :print_media_type => true
+# config.middleware.use "PDFKit::Middleware", :print_media_type => true
#test
end
end
View
BIN config/environments/.development.rb.swp
Binary file not shown.
View
12 config/environments/development.rb
@@ -23,17 +23,5 @@
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
- config.action_controller.asset_host = Proc.new { |source, request|
- print "Source: " + source
- print "\n"
- print "request.media_type: " + request.media_type
- print "\n"
- print "request.format: " + request.format
- print "\n"
- # if request.host.to_s.match(/pdf/)
- #print "CAME HEREEEEEEEEEEEEEEEE"
- # end
- # source.ends_with?(pdf) "file://#{Rails.root.join('public')}" : "#{request.protocol}#{request.host_with_port}"
- }
end
View
5 config/initializers/pdfkit.rb
@@ -2,4 +2,9 @@
PDFKit.configure do |config|
config.wkhtmltopdf = Rails.root.join('bin', 'wkhtmltopdf-amd64').to_s if ::Rails.env == 'production'
+ config.default_options = {
+ :page_size => 'Legal',
+ :print_media_type => true,
+ :disable_javascript => true
+ }
end
View
3 config/routes.rb
@@ -1,12 +1,9 @@
Dentalassistant::Application.routes.draw do
-
-
match "login" => "user_sessions#new", :as => :login
match "logout" => "user_sessions#destroy", :as => :logout
resources :users
resources :user_sessions
resources :medicalhistories
-
resources :forms
root :to => 'medicalhistories#new'
View
14 public/stylesheets/pdf.css
@@ -0,0 +1,14 @@
+
+label.show_label{
+ display: inline-block;
+ font-weight: bold;
+ text-align: left;
+ margin: 2px 10px;
+ width: 200px;
+}
+fieldset {
+ margin-bottom: 20px;
+}
+legend {
+ font-weight: bold;
+}

0 comments on commit b6cdbbe

Please sign in to comment.
Something went wrong with that request. Please try again.