fonction d'upload d'ordonnance PDF
This commit is contained in:
parent
02d0857738
commit
fde4b659cd
@ -13,6 +13,14 @@
|
||||
@import "../mixins/css3";
|
||||
|
||||
|
||||
#pdf_prescription{
|
||||
font-weight:bold;
|
||||
padding:20px;
|
||||
border:2px solid #226198;
|
||||
margin-top:20px;
|
||||
|
||||
}
|
||||
|
||||
#busy{
|
||||
|
||||
position:absolute;
|
||||
|
@ -9,4 +9,16 @@ class Prescription < ActiveRecord::Base
|
||||
|
||||
DONE_BYS = [["GB",1],["MB",2],["VB",3],["MV",4],["EA",5],["PG",6]]
|
||||
|
||||
def file_type
|
||||
|
||||
|
||||
mime = `file --mime -br "#{self.file.path}"`.strip.split(';')[0]
|
||||
mime
|
||||
|
||||
end
|
||||
|
||||
def is_pdf?
|
||||
true if self.file_type == "application/pdf"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ class PrescriptionUploader < CarrierWave::Uploader::Base
|
||||
# Add a white list of extensions which are allowed to be uploaded.
|
||||
# For images you might use something like this:
|
||||
def extension_white_list
|
||||
%w(jpg jpeg gif png)
|
||||
%w(jpg jpeg gif png pdf)
|
||||
end
|
||||
|
||||
# Override the filename of the uploaded files:
|
||||
|
@ -15,7 +15,15 @@
|
||||
=simple_format @prescription.notes
|
||||
|
||||
.file
|
||||
=image_tag @prescription.file.url if @prescription.file?
|
||||
|
||||
-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"
|
||||
|
||||
|
||||
|
||||
#right_bar.bar_transparent_dark.position_absolute_bottom
|
||||
.left
|
||||
|
Loading…
x
Reference in New Issue
Block a user