Prise en charge des paramètres thumb_size et slide_size par l'uploader.
authorBenoît Pin <pin@cri.ensmp.fr>
Mon, 31 Mar 2014 12:57:19 +0000 (14:57 +0200)
committerBenoît Pin <pin@cri.ensmp.fr>
Mon, 31 Mar 2014 12:57:19 +0000 (14:57 +0200)
skins/photo_layout_macros.pt
skins/portfolio_style.css.dtml
skins/portfolio_upload.js

index 48b8040..b9f63c5 100644 (file)
       </div>
       <br clear="all"/>
       <div metal:use-macro="here/batch_macros/macros/navigation">batch navigation</div>
       </div>
       <br clear="all"/>
       <div metal:use-macro="here/batch_macros/macros/navigation">batch navigation</div>
-      <script type="text/javascript">
-      // <!--
+      <script type="text/javascript" tal:content="python:'''
       (function(){
         var lb = document.getElementById('lightbox');
         var uploadUrl = absolute_url() + '/put_upload';
         new Lightbox(lb);
       (function(){
         var lb = document.getElementById('lightbox');
         var uploadUrl = absolute_url() + '/put_upload';
         new Lightbox(lb);
-        new DDImageUploader(lb, uploadUrl);
+        var options = {'slideSize' : %(slideSize)d,
+                       'thumbnailSize' : %(thumbnailSize)d};
+        new DDImageUploader(lb, uploadUrl, options);
       })();
       })();
-      // -->
+      ''' % {'slideSize' : portal_object.slide_size,
+             'thumbnailSize' : portal_object.thumb_size}">
       </script>
     </div>
 
       </script>
     </div>
 
index f88048e..1005ea0 100755 (executable)
@@ -307,7 +307,7 @@ div.lightbox {
   border-radius:3px;
   width:0;
   margin-left:11px;
   border-radius:3px;
   width:0;
   margin-left:11px;
-  top:208px;
+  top:<dtml-var expr="slide_size - 8">px;
 }
 
 .lightbox span.label {
 }
 
 .lightbox span.label {
index 7dface3..e675651 100644 (file)
@@ -7,13 +7,13 @@ var DDImageUploader;
 var MAX_PREVIEW = 2;
 var isThumbnail = /.*\/getThumbnail$/;
 
 var MAX_PREVIEW = 2;
 var isThumbnail = /.*\/getThumbnail$/;
 
-DDImageUploader = function(dropbox, uploadUrl) {
+DDImageUploader = function(dropbox, uploadUrl, options) {
        DDFileUploaderBase.apply(this, [dropbox, uploadUrl]);
 
        this.existingSlides = this.indexExistingSlides();
        DDFileUploaderBase.apply(this, [dropbox, uploadUrl]);
 
        this.existingSlides = this.indexExistingSlides();
-       this.slideSize = 222;
-       this.progressBarMaxSize = 200; // pixels
-       this.thumbnailSize = 180;
+       this.slideSize = options.slideSize || 222;
+       this.progressBarMaxSize = this.slideSize - 22 || 200; // pixels
+       this.thumbnailSize = options.thumbnailSize || 180;
        this.previewQueue = [];
        this._previewQueueRunning = false;
        this.previewsLoaded = 0;
        this.previewQueue = [];
        this._previewQueueRunning = false;
        this.previewsLoaded = 0;