sync
authorJulian Knowles <julian@roojs.com>
Tue, 14 Jan 2014 10:18:39 +0000 (18:18 +0800)
committerJulian Knowles <julian@roojs.com>
Tue, 14 Jan 2014 10:18:39 +0000 (18:18 +0800)
Roo/bootstrap/ButtonGroup.js [new file with mode: 0644]
Roo/bootstrap/Menu.js [new file with mode: 0644]
Roo/bootstrap/MenuItem.js [new file with mode: 0644]
Roo/bootstrap/Navbar.Button.js [new file with mode: 0644]

diff --git a/Roo/bootstrap/ButtonGroup.js b/Roo/bootstrap/ButtonGroup.js
new file mode 100644 (file)
index 0000000..398b8a4
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * - LGPL
+ *
+ * page contgainer.
+ * 
+ */ 
+Roo.bootstrap.ButtonGroup = function(config){
+    Roo.bootstrap.ButtonGroup.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.bootstrap.ButtonGroup, Roo.bootstrap.Component,  {
+    
+    size: '',
+    align: '',
+    dropdirection: '',
+    
+    autoCreate : {
+        cls: 'btn-group',
+        html : null
+    },
+
+    getAutoCreate : function(){
+        
+        var cfg = Roo.apply({}, Roo.bootstrap.ButtonGroup.superclass.getAutoCreate.call(this));
+        
+        cfg.html = this.html || cfg.html;
+        
+        if (['vertical','justified'].indexOf(this.align)!==-1) {
+            cfg.cls = 'btn-group-' + this.align;
+            
+            if (this.align==='justified') {
+                console.log(this.items)
+            }
+        }
+        
+        if (['lg','sm','xs'].indexOf(this.size)!==-1) {
+            cfg.cls += ' btn-group-' + this.size;
+        }
+        
+        if (['dropup'].indexOf(this.dropdirection)) {
+            cfg.cls += ' dropup';
+        }
+        
+        return cfg;
+    }
+   
+});
+
\ No newline at end of file
diff --git a/Roo/bootstrap/Menu.js b/Roo/bootstrap/Menu.js
new file mode 100644 (file)
index 0000000..16f2895
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * - LGPL
+ *
+ * row
+ * 
+ */ 
+Roo.bootstrap.Menu = function(config){
+    Roo.bootstrap.Menu.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component,  {
+    
+    html : false,
+    align : '',
+    triggerEl : false,
+    
+    
+    getChildContainer : function() {
+        return this.el;  
+    },
+    
+    getAutoCreate : function(){
+        
+       //if (['right'].indexOf(this.align)!==-1) {
+       //    cfg.cn[1].cls += ' pull-right'
+       //}
+       
+        return {
+                tag : 'ul',
+                cls : 'dropdown-menu',
+                
+            };
+    },
+    initEvents : function() {
+        Roo.log("ADD event");
+        Roo.log(this.triggerEl.dom);
+        this.triggerEl.on('click', this.toggle, this);
+        
+    },
+    toggle  : function(e)
+    {
+        Roo.log(e.getTarget());
+        Roo.log(this.triggerEl.dom);
+        if (Roo.get(e.getTarget()).findParent('.dropdown-menu')) {
+            return;
+        }
+        var isActive = this.triggerEl.hasClass('open');
+        // if disabled.. ingore
+        this.clearMenus(e);
+        //if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
+         // if mobile we use a backdrop because click events don't delegate
+        // $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
+        // }
+       //var relatedTarget = { relatedTarget: this }
+       //$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
+       //if (e.isDefaultPrevented()) return;
+        
+       this.triggerEl.toggleClass('open');
+       
+       //  .trigger('shown.bs.dropdown', relatedTarget)
+       this.triggerEl.focus();
+       Roo.log(e);
+       e.preventDefault(); 
+        
+        
+    },
+    clearMenus : function()
+    {
+        //$(backdrop).remove()
+        this.triggerEl.select('a.dropdown-toggle',true).each(function(aa) {
+            if (!aa.hasClass('open')) {
+                return;
+            }
+            // triger close...
+            aa.removeClass('open');
+          //var parent = getParent($(this))
+          //var relatedTarget = { relatedTarget: this }
+          
+           //$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
+          //if (e.isDefaultPrevented()) return
+           //$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
+        })
+    }
+    
+   
+});
+
+
\ No newline at end of file
diff --git a/Roo/bootstrap/MenuItem.js b/Roo/bootstrap/MenuItem.js
new file mode 100644 (file)
index 0000000..dbcf0b3
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * - LGPL
+ *
+ * row
+ * 
+ */ 
+Roo.bootstrap.MenuItem = function(config){
+    Roo.bootstrap.MenuItem.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.bootstrap.MenuItem, Roo.bootstrap.Component,  {
+      
+       href : false,
+    html : false,
+    
+    
+    
+    getAutoCreate : function(){
+        var cfg= {
+       // cls: '',
+           tag : 'li',
+           cn : [
+               {
+                   tag : 'a',
+                   href : '#',
+                   html : 'Link'
+               }
+           ]
+       };
+           
+        cfg.cn[0].href = this.href || cfg.cn[0].href ;
+        cfg.cn[0].html = this.html || cfg.cn[0].html ;
+        return cfg;
+    }
+   
+});
+
+
\ No newline at end of file
diff --git a/Roo/bootstrap/Navbar.Button.js b/Roo/bootstrap/Navbar.Button.js
new file mode 100644 (file)
index 0000000..1603ecd
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * - LGPL
+ *
+ * row
+ * 
+ */ 
+Roo.bootstrap.Navbar.Button = function(config){
+    Roo.bootstrap.Navbar.Button.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.bootstrap.Navbar.Button, Roo.bootstrap.Component,  {
+    
+    href : false,
+    html : false,
+    
+    autoCreate : {
+        cls: 'btn',
+        tag : 'button',
+        html: 'hello'
+    },
+    
+    getAutoCreate : function(){
+        
+        var cfg = {
+            cls: 'btn',
+            tag : 'button',
+            html: 'hello',
+            cn : []
+            
+        } ;
+        cfg.cn.push({
+            html : this.html || '',
+            //href : this.
+             //       )
+        });
+        cfg.cn.push({
+            tag: 'span',
+            cls : 'carat'
+        });
+        
+        return cfg;
+    }
+   
+});
+
+
\ No newline at end of file