X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=Roo%2Fbootstrap%2FCardUploader.js;h=7f0d5f1f101f15235aed878059fc36018fec042f;hp=aaf4df7a8ce7640c0311c0714f5fb6e9fa7a24aa;hb=b34d62126ce450a86d8af5e79059ea0f4a3529b8;hpb=f23648e68ee576b98060b387acf5f29662400531 diff --git a/Roo/bootstrap/CardUploader.js b/Roo/bootstrap/CardUploader.js index aaf4df7a8c..7f0d5f1f10 100644 --- a/Roo/bootstrap/CardUploader.js +++ b/Roo/bootstrap/CardUploader.js @@ -28,9 +28,27 @@ Roo.bootstrap.CardUploader = function(config){ return r.data.id }); - + this.addEvents({ + // raw events + /** + * @event preview + * When a image is clicked on - and needs to display a slideshow or similar.. + * @param {Roo.bootstrap.Card} this + * @param {Object} The image information data + * + */ + 'preview' : true, + /** + * @event download + * When a the download link is clicked + * @param {Roo.bootstrap.Card} this + * @param {Object} The image information data contains + */ + 'download' : true + + }); }; - + Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, { @@ -199,6 +217,25 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, { }, + /** + * addCard - add an Attachment to the uploader + * @param data - the data about the image to upload + * + * { + id : 123 + title : "Title of file", + is_uploaded : false, + src : "http://.....", + srcfile : { the File upload object }, + mimetype : file.type, + preview : false, + is_deleted : 0 + .. any other data... + } + * + * + */ + addCard : function (data) { // hidden input element? @@ -227,7 +264,8 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, { fa : 'download', listeners : { click : function() { - this.downloadCard(data.id) + + t.fireEvent( "download", t, data ); } } }, @@ -269,9 +307,10 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, { items : footer, initEvents : function() { Roo.bootstrap.Card.prototype.initEvents.call(this); + var card = this; this.imgEl = this.el.select('.card-img-top').first(); if (this.imgEl) { - this.imgEl.on('click', function() { t.previewCard( data.id); }, this); + this.imgEl.on('click', function() { t.fireEvent( "preview", t, data ); }, this); this.imgEl.set({ 'pointer' : 'cursor' }); }