Roo/bootstrap/CardUploader.js
[roojs1] / Roo / bootstrap / CardUploader.js
index 08af892..eea32db 100644 (file)
@@ -18,9 +18,7 @@
 
 Roo.bootstrap.CardUploader = function(config){
     
-    if (test) {
-        //code
-    }
     
     Roo.bootstrap.CardUploader.superclass.constructor.call(this, config);
     
@@ -41,15 +39,15 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Button,  {
     
     getAutoCreate : function()
     {
-        var btn = Roo.bootstrap.Button.getAutoCreate.prototype.call(this);
-        
+        var btn = Roo.bootstrap.Button.prototype.getAutoCreate.call(this);
+        btn.cls += ' w-100 mb-2';
         var cfg = {
             cls : 'roo-card-uploader-wrap',
             cn : [
                 btn,
                 {
                     tag : 'input',
-                    cls : 'd=none roo-card-upload-selector',
+                    cls : 'd-none roo-card-upload-selector',
                     type : 'file',
                     multiple : 'multiple'
                 },
@@ -72,6 +70,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Button,  {
     
     initEvents : function()
     {
+        Roo.bootstrap.Button.prototype.initEvents.call(this);
         this.urlAPI = (window.createObjectURL && window) || 
                                 (window.URL && URL.revokeObjectURL && URL) || 
                                 (window.webkitURL && webkitURL);
@@ -81,8 +80,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Button,  {
          
         this.selectorEl = this.el.select('.roo-card-upload-selector', true).first();
         
-        this.bodyEl.on('click', this.beforeSelectFile, this);
-        this.selectorEl.on('change', this.onFileSelected, this);
+         this.selectorEl.on('change', this.onFileSelected, this);
         if (this.images) {
             var t = this;
             this.images.forEach(function(img) {
@@ -96,7 +94,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Button,  {
     },
     
    
-    beforeSelectFile : function(e)
+    onClick : function(e)
     {
         e.preventDefault();
          
@@ -168,27 +166,52 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Button,  {
                 closeable : true,
                 header_image : data.src,
                 data : data,
-                
+                html : false,
                 listeners : {
                     click : function() {
                         // view..
                     }
                 },
-                cn : [
+                items : [
                     {
                         xns : Roo.bootstrap,
                         xtype : 'CardFooter',
-                        cn: [
+                        items: [
                             {
                                 xns : Roo.bootstrap,
                                 xtype : 'Element',
-                                html : data.title
-                            },
-                            {
-                                xns : Roo.bootstrap,
-                                xtype : 'Button',
-                                html : 'Delete',
-                                fa : 'cross'
+                                cls : 'd-flex',
+                                items : [
+                                    
+                                    {
+                                        xns : Roo.bootstrap,
+                                        xtype : 'Button',
+                                        html : String.format("<small>{0}</small>", data.title),
+                                        cls : 'col-8 text-left',
+                                        size: 'sm',
+                                        weight: 'info',
+                                        fa : 'download',
+                                        listeners : {
+                                            click : function() {
+                                                // download
+                                            }
+                                        }
+                                    },
+                                    {
+                                        xns : Roo.bootstrap,
+                                        xtype : 'Element',
+                                        cls : 'col-1'
+                                    },
+                                    {
+                                        xns : Roo.bootstrap,
+                                        xtype : 'Button',
+                                        html : 'Delete',
+                                        size : 'sm',
+                                        weight: 'danger',
+                                        cls : 'col-3',
+                                        fa : 'times'
+                                    }
+                                ]
                             }
                             
                         ],