Roo.bootstrap.CardUploader.superclass.constructor.call(this, config);
- this.imageCollection = new Roo.util.MixedCollection(function(r) { return r.id });
+ this.imageCollection = new Roo.util.MixedCollection(function(r) { return r.data.id });
};
getAutoCreate : function()
{
var btn = Roo.bootstrap.Button.prototype.getAutoCreate.call(this);
-
+ btn.cls += ' w-100 mb-2';
var cfg = {
cls : 'roo-card-uploader-wrap',
cn : [
is_uploaded : false,
src : url,
title : file.name,
- mimetype : file.mimetype,
+ mimetype : file.type,
+ preview : false,
})
},
// hidden input element?
// if the file is not an image...
//then we need to use something other that and header_image
-
+ var t = this;
// remove.....
-
+ var footer = [
+ {
+ xns : Roo.bootstrap,
+ xtype : 'CardFooter',
+ items: [
+ {
+ xns : Roo.bootstrap,
+ xtype : 'Element',
+ cls : 'd-flex',
+ items : [
+
+ {
+ xns : Roo.bootstrap,
+ xtype : 'Button',
+ html : String.format("<small>{0}</small>", data.title),
+ cls : 'col-11 text-left',
+ size: 'sm',
+ weight: 'link',
+ fa : 'download',
+ listeners : {
+ click : function() {
+ this.downloadCard(data.id)
+ }
+ }
+ },
+
+ {
+ xns : Roo.bootstrap,
+ xtype : 'Button',
+
+ size : 'sm',
+ weight: 'danger',
+ cls : 'col-1',
+ fa : 'times',
+ listeners : {
+ click : function() {
+ this.removeCard(data.id)
+ }
+ }
+ }
+ ]
+ }
+
+ ],
+ }
+
+ ];
+
var cn = this.addxtype(
{
xns : Roo.bootstrap,
xtype : 'Card',
closeable : true,
- header_image : data.src,
+ header : !data.mimetype.match(/image/) && !data.preview ? "Document": false,
+ header_image : data.mimetype.match(/image/) ? data.src : data.preview,
data : data,
-
+ html : false,
listeners : {
click : function() {
// view..
}
},
- items : [
- {
- xns : Roo.bootstrap,
- xtype : 'CardFooter',
- items: [
- {
- xns : Roo.bootstrap,
- xtype : 'Element',
- cls : 'd-flex'
- itesm : [
-
- {
- xns : Roo.bootstrap,
- xtype : 'Element',
- html : String.format("{0}", data.title),
- cls : 'p-9'
- },
- {
- xns : Roo.bootstrap,
- xtype : 'Button',
- html : 'Delete',
- cls : 'ml-auto p-3'
- fa : 'times'
- }
-
- ],
- }
-
- ]
+ items : footer
}