Mise à jour des contextes de sélection et de table lumineuse pour le chargement après...
authorBenoît Pin <benoit.pin@gmail.com>
Sun, 3 Aug 2014 07:24:10 +0000 (09:24 +0200)
committerBenoît Pin <benoit.pin@gmail.com>
Sun, 3 Aug 2014 07:24:10 +0000 (09:24 +0200)
skins/getPhotoContextInfos.py
skins/lightboxcontext.py
skins/photo_film_viewer.js
skins/photo_layout_macros.pt
skins/selectioncontext.py

index b070a83..b241808 100755 (executable)
@@ -36,7 +36,7 @@ for i, p in enumerate(portfolio.listNearestFolderContents(contentFilter={'portal
        d = {'src': '%s/getThumbnail' % purl
                ,'href': purl
                ,'thumbSize':size
-               ,'title' : p.Title()
+               ,'title' : p.Description()
                ,'displayed' : p == context
                ,'className': (selected and 'selected' or '') + ((p == context) and ' displayed' or '')
                , 'index': i
index 9458974..fcc86f6 100644 (file)
@@ -71,8 +71,9 @@ for i, uid in enumerate(lightboxUids) :
     d = {'src': '%s/getThumbnail' % b.getURL()
         ,'href': href
         ,'thumbSize': size
-        ,'title' : b.Title
+        ,'title' : b.Description
         ,'className': className
+        ,'displayed' : uid == photouid
         , 'index': i
         }
     infos.append(d)
index 3140763..884dac0 100644 (file)
@@ -5,7 +5,6 @@ Licence Creative Commons http://creativecommons.org/licenses/by-nc/2.0/
 */
 
 var FilmSlider;
-var s;
 
 (function(){
 
@@ -17,7 +16,6 @@ var DEFAULT_IMAGE_SIZES = [500, 600, 800];
 
 FilmSlider = function(filmBar, slider, ctxInfos, image, toolbar, breadcrumbs) {
        var thisSlider = this;
-       s = this;
        this.filmBar = filmBar;
        this.filmBarWidth = getObjectWidth(this.filmBar);
        var film = filmBar.firstChild;
@@ -357,6 +355,18 @@ FilmSlider.prototype.mouseOutHandler = function(evt) {
        }
 };
 
+FilmSlider.prototype.translateImgUrl = function(url) {
+       var canonicalImgUrl;
+       if (this.ctxUrlTranslation[0]) {
+               canonicalImgUrl = url.replace(this.ctxUrlTranslation[0],
+                                                                         this.ctxUrlTranslation[1]);
+       }
+       else {
+               canonicalImgUrl = url;
+       }
+       return canonicalImgUrl;
+};
+
 FilmSlider.prototype.thumbnailClickHandler = function(evt) {
        var target = getTargetedObject(evt);
        while (target.tagName !== 'A' && target !== this.filmBar) { target = target.parentNode; }
@@ -373,12 +383,7 @@ FilmSlider.prototype.thumbnailClickHandler = function(evt) {
                history.pushState(target.href, '', target.href);
                
                var imgBaseUrl = target.href;
-               var canonicalImgUrl;
-               if (this.ctxUrlTranslation[0]) {
-                       canonicalImgUrl = imgBaseUrl.replace(this.ctxUrlTranslation[0],
-                                                                                                this.ctxUrlTranslation[1]);
-               }
-               else { canonicalImgUrl = imgBaseUrl; }
+               var canonicalImgUrl = this.translateImgUrl(imgBaseUrl);
                
                var ajaxUrl = imgBaseUrl + '/photo_view_ajax';
                var thisFS = this;
@@ -732,6 +737,7 @@ FilmSlider.prototype.updateBreadcrumbs = function(url, title) {
 
 FilmSlider.prototype.startThumbnailsLoadQueue = function(evt) {
        var thumbnails = this.film.getElementsByTagName('img');
+       if (thumbnails.length === 1) { return; }
        this.thumbnailsLoadingOrder = [];
        var leftSize = this.center;
        var rightSize = thumbnails.length - this.center - 1;
@@ -754,7 +760,7 @@ FilmSlider.prototype.startThumbnailsLoadQueue = function(evt) {
        var next = this.thumbnailsLoadingOrder.shift();
        var self = this;
        addListener(next, 'load', function(evt){self._loadNextThumb(evt);});
-       next.src = next.parentNode.href + '/getThumbnail';
+       next.src = this.translateImgUrl(next.parentNode.href) + '/getThumbnail';
 };
 
 FilmSlider.prototype._loadNextThumb = function(evt) {
@@ -762,7 +768,7 @@ FilmSlider.prototype._loadNextThumb = function(evt) {
        if (!next) {return;}
        var self = this;
        addListener(next, 'load', function(evt){self._loadNextThumb(evt);});
-       next.src = next.parentNode.href + '/getThumbnail';
+       next.src = this.translateImgUrl(next.parentNode.href) + '/getThumbnail';
 };
 
 
index 21616da..82d3d11 100644 (file)
                           blank_img string:$portal_url/transparent.gif">
             <td tal:repeat="info contextInfos/infos">
               <a tal:attributes="href info/href;
+                                 title info/title;
                                  class info/className;
-                                 portfolio:position info/index">
+                                 portfolio:position info/index;">
                 <img tal:define="size info/thumbSize;
                                  margin_top python:(slide_size - size['height']) / 2"
                      tal:attributes="src python:info['src'] if info['displayed'] else blank_img;
index df3e63b..fa7c090 100644 (file)
@@ -82,8 +82,9 @@ for i, uid in enumerate(selection) :
     d = {'src': '%s/getThumbnail' % b.getURL()
         ,'href': toUrl(path)
         ,'thumbSize': size
-        ,'title' : b.Title
-        ,'className': className
+        ,'title' : b.Description
+        ,'className' : className
+        ,'displayed' : uid == photouid
         , 'index': i
         }
     infos.append(d)