X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/654e7cf77f7241bfc866a4879829367d39179577..320fd24b68185b73f1180c425271e037331baa46:/project/templates/explorer/panels/gallery.html?ds=inline

diff --git a/project/templates/explorer/panels/gallery.html b/project/templates/explorer/panels/gallery.html
index d339bce6..0d669726 100644
--- a/project/templates/explorer/panels/gallery.html
+++ b/project/templates/explorer/panels/gallery.html
@@ -1,30 +1,47 @@
-<div class="panel">
-    <div class="images-wrap">
-        <div class="images">
-            <p>Aby zobaczyć obrazki wybierz folder poniżej:</p>
-            <p><select name="folders" class="id_folders">
-            <option value="" selected="selected">-- Wybierz folder z obrazkami --</option>
-            <option value="andersen_basnie">andersen_basnie</option>
-            </select></p>
-        </div>
-    </div>
+<div class="toolbar" style="height: 24px">
+    {{ form.folders }}
+</div>
+
+<div class="images-wrap" style="position: absolute; top: 24px; left:0px; right:0px; bottom: 0px;">
+    <div class="images"><!-- To jest div na obrazki, które są wstawiane później --></div>
 </div>
 <script type="text/javascript" charset="utf-8">
 
 panel_hooks = {
-	load: function() {
-		var contentDiv = this.contentDiv;
-		$('.id_folders', contentDiv).change(function() 
-		{
-        	$('.images', contentDiv).load('{% url folder_image_ajax %}' + $('.id_folders', panel).val() + '/', 
-				function() {
+    load: function() {
+        var contentDiv = this.contentDiv;
+        $('select[name=folders]', contentDiv).change(function() {
+            var select = this;
+            $('.images', contentDiv).fadeOut('slow', 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);
+                    });
                 });
-		});
-		
-		$('.images-wrap', contentDiv).lazyload('.image-box', 
-			{threshold: 640 * 10, scrollTreshold: 640 * 5}
-		);
-	}
+            })
+        });
+        
+        $('.images-wrap', contentDiv).lazyload('.image-box', 
+            {threshold: 640 * 10, scrollTreshold: 640 * 5}
+        );
+        
+        this._endload();
+    },
+    refresh: function() {
+        return true; // gallery is always fresh
+    },
+    dirty: function() {
+        return true; // and it doesn't get dirty 
+    }
 };
 </script>