Merge branch 'view-refactor' of stigma:platforma into zuber-view-refactor
[redakcja.git] / project / templates / explorer / panels / gallery.html
index a5ac559..0d66972 100644 (file)
 panel_hooks = {
     load: function() {
         var contentDiv = this.contentDiv;
-        $('.id_folders', contentDiv).change(function() {
+        $('select[name=folders]', contentDiv).change(function() {
+            var select = this;
             $('.images', contentDiv).fadeOut('slow', function() { 
-                $(this).html('').load('{% url folder_image_ajax %}' + $('.id_folders', contentDiv).val() + '/',  function() {
+                $(this).html('').load('{% url folder_image_ajax %}' + $(select).val() + '/',  function() {
+                    $('.images', contentDiv).fadeIn('slow');
                     $('.images-wrap', contentDiv).data('lazyload:lastCheckedScrollTop', -10000);
+                    $('.image-box').click(function() {
+                        var src = $('img', $(this)).attr('src');
+                        var idx = src.lastIndexOf('/');
+                        var bigSrc = src.substring(0, idx) + '/big' + src.substring(idx, src.length);
+                        var zoom = $('<div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: scroll">'
+                            + '<img src="' + bigSrc + '" />'
+                            + '</div>').click(function() {
+                                $(this).remove();
+                            })
+                        zoom.appendTo(contentDiv);
+                    });
                 });
             })
         });
@@ -21,6 +34,8 @@ panel_hooks = {
         $('.images-wrap', contentDiv).lazyload('.image-box', 
             {threshold: 640 * 10, scrollTreshold: 640 * 5}
         );
+        
+        this._endload();
     },
     refresh: function() {
         return true; // gallery is always fresh