version imprimable

This commit is contained in:
Nicolas Bally 2011-12-04 20:34:00 +01:00
parent fde4b659cd
commit 32c39322ae
6 changed files with 119 additions and 3 deletions

View File

@ -0,0 +1,66 @@
body{
font-family:arial;
}
#pdf_prescription{
a{
text-decoration:none;
color:black;
display: inline-block;
background: #3c74a8;
background: -webkit-gradient(linear, 0% 100%, 0% 0%, from(rgb(239,242,242)), to(rgb(255,255,255)));
background: -moz-linear-gradient(bottom, rgb(239,242,242), rgb(255,255,255));
box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
-moz-box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
-webkit-box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
border: none;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
color: RGB(46,46,46);
padding: 5px 15px;
margin:30px 5px 0px 5px;
font-weight:normal;
}
}
.notes{
padding:5px;
margin:5px;
font-size:15px;
border:1px solid #ffd148;
}
h2{
.tel{
float:right;
}
}
#ship_info{
border:1px solid #49bd22;
height:16px;
padding:10px;
}
.file{
text-align:center;
img{
}
}
.done{
padding:5px;
}

View File

@ -22,6 +22,12 @@ class Admin::PrescriptionsController < ApplicationController
@prescription.read = true
@prescription.save
end
def print
@prescription = Prescription.find(params[:id])
render :layout => false
end
def delete
end

View File

@ -19,9 +19,11 @@
-if @prescription.file?
-if @prescription.is_pdf?
#pdf_prescription=link_to "Cette ordonnance est au format pdf. Cliquez-ici pour la visualiser.", @prescription.file.url, :target => "_blank"
-else
=image_tag @prescription.file.url, :style => "width:100%;"
=link_to "Cliquez-ici pour télécharger image dans une nouvelle fenêtre.", @prescription.file.url, :target => "_blank"
=image_tag @prescription.file.url, :style => "max-width:100%;max-height:100%;"
=link_to "Cliquez-ici pour télécharger l'image dans une nouvelle fenêtre.", @prescription.file.url, :target => "_blank"
@ -45,4 +47,8 @@
=f.datetime_select :delivery_at, :order => [:day, :month, :year, :hour, :minute ]
=f.submit "Sauvegarder"
.delete= link_to i(:trash_stroke, :gray_light), admin_prescription_path(@prescription), :confirm => 'Voulez-vous vraiment supprimer cette commande ?', :method => :delete
.delete
= link_to i(:trash_stroke, :gray_light), admin_prescription_path(@prescription), :confirm => 'Voulez-vous vraiment supprimer cette commande ?', :method => :delete
&nbsp;&nbsp;
=link_to i(:print, :gray_light), print_admin_prescription_path(@prescription), :target => "_blank"

View File

@ -0,0 +1,37 @@
!!!
%html{:lang => "fr"}
%head
%meta{:"http-equiv" => "content-type" ,:content =>"text/html;charset=UTF-8" }
%title="Impression ordonnance"
= stylesheet_link_tag 'print', :media => "all"
%body
-if @prescription.done
#ship_info
La livraison est prévu le
=l @prescription.delivery_at
%h2
.tel= @prescription.tel
=@prescription.name
.date=l @prescription.created_at
-if @prescription.notes?
.notes
=simple_format @prescription.notes
.file
-if @prescription.file?
-if @prescription.is_pdf?
#pdf_prescription=link_to "Annexe : scan au format pdf", @prescription.file.url, :target => "_blank"
-else
=image_tag @prescription.file.url, :style => "max-width:100%;max-height:100%;"

View File

@ -99,6 +99,7 @@ Pharma::Application.routes.draw do
get :done
get :undone
get :file
get :print
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B