Dodanie login_required. Automatyczne tworzenie branchy, przy pierwszym użyciu.
[redakcja.git] / project / static / js / jquery.hpanel.js
index d33e47f..bec82e0 100644 (file)
@@ -5,7 +5,6 @@
         settings: {},
                current_data: {},
         resize_start: function(event, mydata) {
         settings: {},
                current_data: {},
         resize_start: function(event, mydata) {
-                       $.log('Overlay: ' + mydata.overlay);
                        $(document).bind('mousemove', mydata, $.hpanel.resize_changed).
                                bind('mouseup', mydata, $.hpanel.resize_stop); 
 
                        $(document).bind('mousemove', mydata, $.hpanel.resize_changed).
                                bind('mouseup', mydata, $.hpanel.resize_stop); 
 
                                        $(this).data('panel').css({
                                                'left': $(this).css('left'), 'width': $(this).css('width')}); 
                        });
                                        $(this).data('panel').css({
                                                'left': $(this).css('left'), 'width': $(this).css('width')}); 
                        });
-
                        $('.panel-overlay', event.data.root).css('display', 'none');
                        $('.panel-overlay', event.data.root).css('display', 'none');
+            $(event.data.root).trigger('stopResize');
         }
     };
     
     $.fn.makeHorizPanel = function(options) 
        {
         }
     };
     
     $.fn.makeHorizPanel = function(options) 
        {
-               $.log('Making an hpanel out of "#' +  $(this).attr('id') + '"'); 
                var root = $(this)
                var root = $(this)
-               var all_panels = $('.panel-wrap', root)
-               $.log('Panels: ' + all_panels);
 
                /* create an overlay */
                var overlay_root = $("<div class='panel-overlay'></div>");
 
                /* create an overlay */
                var overlay_root = $("<div class='panel-overlay'></div>");
 
                var prev = null;
 
 
                var prev = null;
 
-               all_panels.each(function(i) {
-                       var panel = $(all_panels[i]);
+               $('*.panel-wrap', root).each( function() 
+        {
+                       var panel = $(this);
                        var handle = $('.panel-slider', panel);
                        var handle = $('.panel-slider', panel);
-
-                       var overlay     = $("<div class='panel-content-overlay panel-wrap'><p>Panel #"+i+"</p></div>");
+                       var overlay = $("<div class='panel-content-overlay panel-wrap'>&nbsp;</div>");
                        overlay_root.append(overlay);
                        overlay.data('panel', panel);
                        overlay.data('next', null);
 
                        overlay_root.append(overlay);
                        overlay.data('panel', panel);
                        overlay.data('next', null);
 
+                       if (prev) prev.next = overlay;
+
                        if( panel.hasClass('last-panel') )                              
                        if( panel.hasClass('last-panel') )                              
+            {
                                overlay.css({'left': panel.css('left'), 'right': panel.css('right')});
                                overlay.css({'left': panel.css('left'), 'right': panel.css('right')});
-                       else
+            }
+                       else {
                                overlay.css({'left': panel.css('left'), 'width': panel.css('width')});
                                overlay.css({'left': panel.css('left'), 'width': panel.css('width')});
-
-                       if (prev) prev.next = overlay;
-
-                       if(handle) {
+                               $.log('Has handle: ' + panel.attr('id'));
                                overlay.append(handle.clone());
                                /* attach the trigger */
                                handle.mousedown(function(event) {
                                overlay.append(handle.clone());
                                /* attach the trigger */
                                handle.mousedown(function(event) {
                                        (handle.outerWidth() || 10) + 'px');
                                $('.panel-content-overlay', panel).css('right',
                                        (handle.outerWidth() || 10) + 'px');
                                        (handle.outerWidth() || 10) + 'px');
                                $('.panel-content-overlay', panel).css('right',
                                        (handle.outerWidth() || 10) + 'px');
-                       }
-                               
+                       };                              
+
                        prev = overlay;
         });
 
                        prev = overlay;
         });
 
-       root.bind('hpanel:panel-resize-start', $.hpanel.resize_start);
+       root.bind('hpanel:panel-resize-start', $.hpanel.resize_start);
     };
 })(jQuery);
 
     };
 })(jQuery);