Roo/bootstrap/Container.js
authorAlan Knowles <alan@roojs.com>
Wed, 17 Feb 2016 03:20:24 +0000 (11:20 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 17 Feb 2016 03:20:24 +0000 (11:20 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/Container.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 2128202..ac645e5 100644 (file)
@@ -153,13 +153,14 @@ Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component,  {
                         tag: 'i',
                         cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus') 
                     });
+                    
                 }
                 
                 h.push(
                     {
                         tag: 'span',
                         cls : 'panel-title',
-                        html : this.header
+                        html : (this.expandable ? ' ' : '') + this.header
                     },
                     {
                         tag: 'span',
index 39cfeba..050077d 100644 (file)
@@ -1119,13 +1119,14 @@ Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component,  {
                         tag: 'i',
                         cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus') 
                     });
+                    
                 }
                 
                 h.push(
                     {
                         tag: 'span',
                         cls : 'panel-title',
-                        html : this.header
+                        html : (this.expandable ? ' ' : '') + this.header
                     },
                     {
                         tag: 'span',
@@ -25235,7 +25236,7 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
             
             files.push(file);
             
-            this.el.createChild({
+            var preview = new Roo.Element({
                 tag : 'div',
                 cls : 'roo-document-manager-preview',
                 cn : [
@@ -25243,7 +25244,25 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
                         tag : 'div',
                         tooltip : file.filename,
                         cls : 'roo-document-manager-thumb',
-                        html : '<img src="' + baseURL +'/Images/Thumb/50/' + file.id + '/' + file.filename + '">'
+                        html : '<img src="' + baseURL +'/Images/Thumb/50x80/' + file.id + '/' + file.filename + '">'
+                    },
+                    {
+                        tag : 'button',
+                        cls : 'close',
+                        html : 'x'
+                    }
+                ]
+            }, true);
+            
+            var preview = this.el.createChild({
+                tag : 'div',
+                cls : 'roo-document-manager-preview',
+                cn : [
+                    {
+                        tag : 'div',
+                        tooltip : file.filename,
+                        cls : 'roo-document-manager-thumb',
+                        html : '<img src="' + baseURL +'/Images/Thumb/50x80/' + file.id + '/' + file.filename + '">'
                     },
                     {
                         tag : 'button',
@@ -25251,9 +25270,12 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
                         html : 'x'
                     }
                 ]
-
             });
             
+            var close = preview.select('button.close', true).first();
+            
+            close.on('click', this.onRemove, this, { item : preview, data : file} );
+            
             return;
             
         }, this);
index f244eb1..436b990 100644 (file)
@@ -42,7 +42,7 @@ return;}A.cls+=' col-'+D+'-'+B[D];});if(this.hidden){A.cls+=' hidden';}if(this.a
 Roo.bootstrap.Container=function(A){Roo.bootstrap.Container.superclass.constructor.call(this,A);this.addEvents({"expand":true,"collapse":true});};Roo.extend(Roo.bootstrap.Container,Roo.bootstrap.Component,{jumbotron:false,well:'',panel:'',header:'',footer:'',sticky:'',tag:false,alert:false,fa:false,icon:false,expandable:false,rheader:'',expanded:true,getChildContainer:function(){if(!this.el){return false;
 }if(this.panel.length){return this.el.select('.panel-body',true).first();}return this.el;},getAutoCreate:function(){var A={tag:this.tag||'div',html:'',cls:''};if(this.jumbotron){A.cls='jumbotron';}if(this.sticky.length){var bd=Roo.get(document.body);if(!bd.hasClass('bootstrap-sticky')){bd.addClass('bootstrap-sticky');
 Roo.select('html',true).setStyle('height','100%');}A.cls+='bootstrap-sticky-'+this.sticky;}if(this.well.length){switch(this.well){case 'lg':case 'sm':A.cls+=' well well-'+this.well;break;default:A.cls+=' well';break;}}if(this.hidden){A.cls+=' hidden';}if(this.alert&&["success","info","warning","danger"].indexOf(this.alert)>-1){A.cls+=' alert alert-'+this.alert;
-}var B=A;if(this.panel.length){A.cls+=' panel panel-'+this.panel;A.cn=[];if(this.header.length){var h=[];if(this.expandable){A.cls=A.cls+' expandable';h.push({tag:'i',cls:(this.expanded?'fa fa-minus':'fa fa-plus')});}h.push({tag:'span',cls:'panel-title',html:this.header}
+}var B=A;if(this.panel.length){A.cls+=' panel panel-'+this.panel;A.cn=[];if(this.header.length){var h=[];if(this.expandable){A.cls=A.cls+' expandable';h.push({tag:'i',cls:(this.expanded?'fa fa-minus':'fa fa-plus')});}h.push({tag:'span',cls:'panel-title',html:(this.expandable?' ':'')+this.header}
 ,{tag:'span',cls:'panel-header-right',html:this.rheader});A.cn.push({cls:'panel-heading',cn:h});}B=false;A.cn.push({cls:'panel-body'+(this.expanded?'':' hide'),html:this.html});if(this.footer.length){A.cn.push({cls:'panel-footer',html:this.footer});}}if(B){B.html=this.html||A.html;
 if(this.fa){B.html='<i class="fa fa-'+this.fa+'"></i>'+B.html;}if(this.icon){B.html='<i class="glyphicon glyphicon-'+this.icon+'"></i>'+B.html;}}if((!this.cls||!this.cls.length)&&(!A.cls||!A.cls.length)){A.cls='container';}return A;},initEvents:function(){if(!this.expandable){return;
 }var A=this.headerEl();if(!A){return;}A.on('click',this.onToggleClick,this);},onToggleClick:function(){var A=this.headerEl();if(!A){return;}if(this.expanded){this.collapse();return;}this.expand();},expand:function(){if(this.fireEvent('expand',this)){this.expanded=true;
@@ -1066,7 +1066,8 @@ this.uploader.on('click',this.onUpload,this);},onUpload:function(e){e.preventDef
 ]});},this);if(this.files.length>11){this.uploader.hide();}var B={"Accept":"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};A.open(this.method,this.url,true);for(var C in B){var D=B[C];if(D){A.setRequestHeader(C,D);}}var E=this;
 A.onload=function(){E.xhrOnLoad(A);};A.onerror=function(){E.xhrOnError(A);};var F=new FormData();F.append('returnHTML','NO');Roo.each(this.files,function(G,H){if(typeof(G.id)!='undefined'&&G.id*1>0){return;}F.append(this.getParamName(H),G,G.name);},this);
 if(this.fireEvent('prepare',this,F)!=false){A.send(F);};},getParamName:function(i){if(!this.multiple){return this.paramName;}return this.paramName+"_"+i;},refresh:function(){Roo.each(this.el.select('.roo-document-manager-preview',true).elements,function(el){el.remove();
-},this);var A=[];Roo.each(this.files,function(B){if(typeof(B.id)=='undefined'&&B.id*1<1){return;}A.push(B);this.el.createChild({tag:'div',cls:'roo-document-manager-preview',cn:[{tag:'div',tooltip:B.filename,cls:'roo-document-manager-thumb',html:'<img src="'+baseURL+'/Images/Thumb/50/'+B.id+'/'+B.filename+'">'}
-,{tag:'button',cls:'close',html:'x'}]});return;},this);this.files=A;this.uploader.show();if(this.files.length>11){this.uploader.hide();}},xhrOnLoad:function(A){if(A.readyState!==4){this.refresh();this.fireEvent('exception',this,A);return;}var B=Roo.decode(A.responseText);
-if(!B.success){this.refresh();this.fireEvent('exception',this,A);return;}var i=0;Roo.each(this.files,function(C,D){if(typeof(C.id)!='undefined'&&C.id*1>0){return;}this.files[D]=B.data[i];i++;return;},this);this.refresh();},xhrOnError:function(){Roo.log('xhr on error');
-var A=Roo.decode(xhr.responseText);Roo.log(A);}});
+},this);var A=[];Roo.each(this.files,function(B){if(typeof(B.id)=='undefined'&&B.id*1<1){return;}A.push(B);var C=new Roo.Element({tag:'div',cls:'roo-document-manager-preview',cn:[{tag:'div',tooltip:B.filename,cls:'roo-document-manager-thumb',html:'<img src="'+baseURL+'/Images/Thumb/50x80/'+B.id+'/'+B.filename+'">'}
+,{tag:'button',cls:'close',html:'x'}]},true);var C=this.el.createChild({tag:'div',cls:'roo-document-manager-preview',cn:[{tag:'div',tooltip:B.filename,cls:'roo-document-manager-thumb',html:'<img src="'+baseURL+'/Images/Thumb/50x80/'+B.id+'/'+B.filename+'">'}
+,{tag:'button',cls:'close',html:'x'}]});var D=C.select('button.close',true).first();D.on('click',this.onRemove,this,{item:C,data:B});return;},this);this.files=A;this.uploader.show();if(this.files.length>11){this.uploader.hide();}},xhrOnLoad:function(A){if(A.readyState!==4){this.refresh();
+this.fireEvent('exception',this,A);return;}var B=Roo.decode(A.responseText);if(!B.success){this.refresh();this.fireEvent('exception',this,A);return;}var i=0;Roo.each(this.files,function(C,D){if(typeof(C.id)!='undefined'&&C.id*1>0){return;}this.files[D]=B.data[i];
+i++;return;},this);this.refresh();},xhrOnError:function(){Roo.log('xhr on error');var A=Roo.decode(xhr.responseText);Roo.log(A);}});