navigation MDL-25317 Fixed scroll issue and ajax expansion bug within the navigation JS
authorSam Hemelryk <sam@moodle.com>
Fri, 19 Nov 2010 02:41:05 +0000 (02:41 +0000)
committerSam Hemelryk <sam@moodle.com>
Fri, 19 Nov 2010 02:41:05 +0000 (02:41 +0000)
blocks/dock.js
blocks/navigation/navigation.js

index 6f9a351..5a2d56b 100644 (file)
@@ -627,6 +627,7 @@ M.core_dock.resize = function() {
         var titletop = item.nodes.docktitle.getY()-docky-buffer;
         var containery = this.nodes.container.getY();
         var containerheight = containery-docky+this.nodes.buttons.get('offsetHeight');
+        var scrolltop = panel.contentBody.get('scrollTop');
         panel.contentBody.setStyle('height', 'auto');
         panel.removeClass('oversized_content');
         var panelheight = panel.get('offsetHeight');
@@ -643,6 +644,10 @@ M.core_dock.resize = function() {
         } else {
             panel.setTop(titletop-containerheight+buffer);
         }
+
+        if (scrolltop) {
+            panel.contentBody.set('scrollTop', scrolltop);
+        }
     }
 
     if (this.cfg.position=='right') {
index 07e5f23..e5e4fae 100644 (file)
@@ -138,7 +138,11 @@ M.block_navigation.classes.tree = function(Y, id, properties) {
  */
 M.block_navigation.classes.tree.prototype.init_load_ajax = function(e, branch) {
     e.stopPropagation();
-    if (e.target.get('nodeName').toUpperCase() != 'P') {
+    var target = e.target;
+    if (target.test('span')) {
+        target = target.ancestor('p');
+    }
+    if (!target || !target.test('p')) {
         return true;
     }
     var cfginstance = '', Y = this.Y;
@@ -150,11 +154,11 @@ M.block_navigation.classes.tree.prototype.init_load_ajax = function(e, branch) {
         data:'elementid='+branch.id+'&id='+branch.branchid+'&type='+branch.type+'&sesskey='+M.cfg.sesskey+cfginstance,
         on: {
             complete:this.load_ajax,
-            success:function() {Y.detach('click', this.init_load_ajax, e.target);}
+            success:function() {Y.detach('click', this.init_load_ajax, target);}
         },
         context:this,
         arguments:{
-            target:e.target
+            target:target
         }
     });
     return true;