sync
authorAlan Knowles <alan@roojs.com>
Thu, 26 Nov 2015 04:39:56 +0000 (12:39 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 26 Nov 2015 04:39:56 +0000 (12:39 +0800)
1  2 
Roo/bootstrap/NavItem.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

@@@ -168,20 -166,19 +168,19 @@@ Roo.extend(Roo.bootstrap.NavItem, Roo.b
          if(this.tagtype == 'span'){
              return;
          }
 -        
 -        var p = this.parent();
 -        
 -        // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
 -        if (p.parentType == 'NavHeaderbar' && !this.menu) {
 -            // remove the collapsed menu expand...
 -            p.parent().el.select('.navbar-collapse',true).removeClass('in');  
 -        }
 -        
 -        if(this.animateRef && this.href.charAt(0) == '#'){
++ 
 +        Roo.log(this.href);
 +        var dom = this.el.select('a',true).dom;
 +        if(this.animateRef && this.href.indexOf('#') > -1){
 +            Roo.log(["test:",dom.href.split("#")[0], document.location.toString().split("#")[0]]);
 +            if (dom.href.split("#")[0] != document.location.toString().split("#")[0]) {
 +                return; // ignore... - it's a 'hash' to another page.
 +            }
 +            
 +            e.preventDefault();
              this.scrollToElement(e);
-             return;
          }
          
-         var p = this.parent();
          if (['tabs','pills'].indexOf(p.type)!==-1) {
              if (typeof(p.setActiveItem) !== 'undefined') {
                  p.setActiveItem(this);
@@@ -3911,31 -3914,24 +3916,36 @@@ Roo.extend(Roo.bootstrap.NavItem, Roo.b
          if(this.tagtype == 'span'){
              return;
          }
-             this.scrollToElement(e);
-             return;
-         }
++<<<<<<< HEAD
 +        Roo.log(this.href);
 +        var dom = this.el.select('a',true).dom;
 +        if(this.animateRef && this.href.indexOf('#') > -1){
 +            Roo.log(["test:",dom.href.split("#")[0], document.location.toString().split("#")[0]]);
 +            if (dom.href.split("#")[0] != document.location.toString().split("#")[0]) {
 +                return; // ignore... - it's a 'hash' to another page.
 +            }
 +            
 +            e.preventDefault();
++=======
          
          var p = this.parent();
-         if (['tabs','pills'].indexOf(p.type)!==-1) {
-             if (typeof(p.setActiveItem) !== 'undefined') {
-                 p.setActiveItem(this);
-             }
-         }
+         
          // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
          if (p.parentType == 'NavHeaderbar' && !this.menu) {
              // remove the collapsed menu expand...
              p.parent().el.select('.navbar-collapse',true).removeClass('in');  
          }
          
+         if(this.animateRef && this.href.charAt(0) == '#'){
++>>>>>>> 090586fe59dab343aa24087d7f4bc00ab354bb55
+             this.scrollToElement(e);
+         }
+         
+         if (['tabs','pills'].indexOf(p.type)!==-1) {
+             if (typeof(p.setActiveItem) !== 'undefined') {
+                 p.setActiveItem(this);
+             }
+         }
      },
      
      isActive: function () {
@@@ -94,10 -95,8 +95,15 @@@ this.setActiveItem(this.navItems[i-1]);
  //Roo/bootstrap/NavItem.js
  Roo.bootstrap.NavItem=function(A){Roo.bootstrap.NavItem.superclass.constructor.call(this,A);this.addEvents({"click":true,'changed':true,'scrollto':true});};Roo.extend(Roo.bootstrap.NavItem,Roo.bootstrap.Component,{href:false,html:'',badge:'',icon:false,glyphicon:false,active:false,preventDefault:false,tabId:false,tagtype:'a',disabled:false,animateRef:false,was_active:false,getAutoCreate:function(){var A={tag:'li',cls:'nav-item'};if(this.active){A.cls=typeof(A.cls)=='undefined'?'active':A.cls+' active';}if(this.disabled){A.cls+=' disabled';}if(this.href||this.html||this.glyphicon||this.icon){A.cn=[{tag:this.tagtype,href:this.href||"#",html:this.html||''}];if(this.icon){A.cn[0].html='<i class="'+this.icon+'"></i> <span>'+A.cn[0].html+'</span>'}if(this.glyphicon){A.cn[0].html='<span class="glyphicon glyphicon-'+this.glyphicon+'"></span> '+A.cn[0].html;}if(this.menu){A.cn[0].html+=" <span class='caret'></span>";}if(this.badge!==''){A.cn[0].html+=' <span class="badge">'+this.badge+'</span>';}}return A;},initEvents:function(){if(typeof(this.menu)!='undefined'){this.menu.parentType=this.xtype;this.menu.triggerEl=this.el;this.menu=this.addxtype(Roo.apply({},this.menu));}
  this.el.select('a',true).on('click',this.onClick,this);if(this.tagtype=='span'){this.el.select('span',true).on('click',this.onClick,this);}
++<<<<<<< HEAD
 +this.parent().register(this);},onClick:function(e){if(this.preventDefault||this.href=='#'){e.preventDefault();}if(this.disabled){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId);if(tg&&tg.transition){Roo.log("waiting for the transitionend");return;}
 +Roo.log("fire event clicked");if(this.fireEvent('click',this,e)===false){return;};if(this.tagtype=='span'){return;}
 +Roo.log(this.href);var A=this.el.select('a',true).dom;if(this.animateRef&&this.href.indexOf('#')>-1){Roo.log(["test:",A.href.split("#")[0],document.location.toString().split("#")[0]]);if(A.href.split("#")[0]!=document.location.toString().split("#")[0]){return;}
 +e.preventDefault();this.scrollToElement(e);return;}var p=this.parent();if(['tabs','pills'].indexOf(p.type)!==-1){if(typeof(p.setActiveItem)!=='undefined'){p.setActiveItem(this);}}if(p.parentType=='NavHeaderbar'&&!this.menu){p.parent().el.select('.navbar-collapse',true).removeClass('in');}},isActive:function(){return this.active},setActive:function(A,B,C){if(this.active&&!A&this.navId){this.was_active=true;var nv=Roo.bootstrap.NavGroup.get(this.navId);if(nv){nv.clearWasActive(this);}}
++=======
+ this.parent().register(this);},onClick:function(e){if(this.preventDefault||this.href=='#'||(this.animateRef&&this.href.charAt(0)=='#')){e.preventDefault();}if(this.disabled){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId);if(tg&&tg.transition){Roo.log("waiting for the transitionend");return;}
+ Roo.log("fire event clicked");if(this.fireEvent('click',this,e)===false){return;};if(this.tagtype=='span'){return;}var p=this.parent();if(p.parentType=='NavHeaderbar'&&!this.menu){p.parent().el.select('.navbar-collapse',true).removeClass('in');}if(this.animateRef&&this.href.charAt(0)=='#'){this.scrollToElement(e);}if(['tabs','pills'].indexOf(p.type)!==-1){if(typeof(p.setActiveItem)!=='undefined'){p.setActiveItem(this);}}},isActive:function(){return this.active},setActive:function(A,B,C){if(this.active&&!A&this.navId){this.was_active=true;var nv=Roo.bootstrap.NavGroup.get(this.navId);if(nv){nv.clearWasActive(this);}}
++>>>>>>> 090586fe59dab343aa24087d7f4bc00ab354bb55
  this.active=A;if(!A){this.el.removeClass('active');}else if(!this.el.hasClass('active')){this.el.addClass('active');}if(B){this.fireEvent('changed',this,A);}if(!this.navId||!this.tabId||!A||C){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId);if(!tg){return;}var D=tg.getPanelByName(this.tabId);if(!D){return;}if(false==tg.showPanel(D)){var nv=Roo.bootstrap.NavGroup.get(this.navId);if(nv){var E=nv.getWasActive();if(E){E.setActive(true,false,true);}}}},setDisabled:function(A){this.disabled=A;if(!A){this.el.removeClass('disabled');}else if(!this.el.hasClass('disabled')){this.el.addClass('disabled');}},tooltipEl:function(){return this.el.select(''+this.tagtype+'',true).first();},scrollToElement:function(e){var c=document.body;var A=Roo.get(c).select('a[name='+this.href.replace('#','')+']',true).first();if(!A){return;}var o=A.calcOffsetsTo(c);var B={target:A,value:o[1]}
  this.fireEvent('scrollto',this,B,e);Roo.get(c).scrollTo('top',B.value,true);return;}});
  //Roo/bootstrap/NavSidebarItem.js