sideplace_app/app/views/public/annonces/_photo_form.html.haml

119 lines
4.0 KiB
Plaintext

#annonce_photo_form
%h3 Les photos de mon annonce
%p
-if @annonce.nbr_photo_restantes.to_i > 0
Vous pouvez encore ajouter
-if @annonce.nbr_photo_restantes > 1
=@annonce.nbr_photo_restantes
photos
-else
une photo
-else
Vous ne pouvez plus ajouter de photos.
-if @annonce.nbr_photos < 15
Si vous souhaitez ajouter d'autres photos vous pouvez prendre une option payante.
%form#fileupload{:action => public_annonce_photos_path(:annonce_id => @annonce.id),:method=>"POST", :enctype=>"multipart/form-data"}
- if @annonce.annonce_photos.visibles.count < @annonce.nbr_photos.to_i
=link_to "Ajouter des images", "#", :onclick => "$(this).next('input').click();return false;", :class => "btn btn-primary"
%input{:multiple => "", :name => "files[]", :type => "file", :style => "display:none;"}
.clear
#annonce_photos
=render @annonce.annonce_photos.visibles
.clear
.fileupload-progress.fade{:style => "float:left;"}
#upload_details{:style => ""}
.content
.fileupload-buttonbar
%button.btn.btn-warning.cancel{:type => "reset"}
%i.icon-ban-circle.icon-white
%span Annuler tout les téléchargements
%span.fileupload-loading
=#%table.table.table-striped{:role => "presentation"}
.progress-extended{:style => "float:left;padding: 10px;font-size:14px;line-height:20px;"}
.progress.progress-success.progress-striped.active{"aria-valuemax" => "100", "aria-valuemin" => "0", :role => "progressbar",:style => "width:200px;float:left;margin: 10px;height:20px;"}
.bar{:style => "width:0%;"}
.clear
:plain
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td>
<span class="preview"></span>
</td>
<td>
<p class="name">{%=file.name%}</p>
{% if (file.error) { %}
<div><span class="label label-important">Error</span> {%=file.error%}</div>
{% } %}
</td>
<td>
<p class="size">{%=o.formatFileSize(file.size)%}</p>
{% if (!o.files.error) { %}
<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
{% } %}
</td>
<td>
{% if (!o.files.error && !i && !o.options.autoUpload) { %}
<button class="btn btn-primary start">
<i class="icon-upload icon-white"></i>
<span>Start</span>
</button>
{% } %}
{% if (!i) { %}
<button class="btn btn-warning cancel">
<i class="icon-ban-circle icon-white"></i>
<span>Annuler</span>
</button>
{% } %}
</td>
</tr>
{% } %}
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-download fade", :style => "display:none;">
</tr>
{% } %}
</script>
:javascript
nbr_photos_able = 2
:coffeescript
$('#fileupload').fileupload({
paramName:"files",
dataType:"script",
autoUpload:true,
filesContainer:".ulpoad_files",
maxNumberOfFiles:2
}).bind('fileuploadadded',(e, data)->
$("#upload_details").show();
).bind('fileuploadfinished',(e, data)->
)