7 * @class Roo.bootstrap.DocumentViewer
8 * @extends Roo.bootstrap.Component
9 * Bootstrap DocumentViewer class
10 * @cfg {Boolean} showDownload (true|false) show download button (default true)
11 * @cfg {Boolean} showTrash (true|false) show trash button (default true)
12 * @cfg {Boolean} clickToDownload (true|false) click to download (default true)
15 * Create a new DocumentViewer
16 * @param {Object} config The config object
19 Roo.bootstrap.DocumentViewer = function(config){
20 Roo.bootstrap.DocumentViewer.superclass.constructor.call(this, config);
25 * Fire after initEvent
26 * @param {Roo.bootstrap.DocumentViewer} this
32 * @param {Roo.bootstrap.DocumentViewer} this
37 * Fire after trash button
38 * @param {Roo.bootstrap.DocumentViewer} this
45 Roo.extend(Roo.bootstrap.DocumentViewer, Roo.bootstrap.Component, {
51 clickToDownload : true,
53 getAutoCreate : function()
57 cls : 'roo-document-viewer',
61 cls : 'roo-document-viewer-body',
65 cls : 'roo-document-viewer-thumb',
69 cls : 'roo-document-viewer-image'
77 cls : 'roo-document-viewer-footer',
80 cls : 'btn-group btn-group-justified roo-document-viewer-btn-group',
88 cls : 'btn btn-default roo-document-viewer-download',
89 html : '<i class="fa fa-download"></i>'
99 cls : 'btn btn-default roo-document-viewer-trash',
100 html : '<i class="fa fa-trash"></i>'
113 initEvents : function()
116 this.bodyEl = this.el.select('.roo-document-viewer-body', true).first();
117 this.bodyEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
119 this.thumbEl = this.el.select('.roo-document-viewer-thumb', true).first();
120 this.thumbEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
122 this.imageEl = this.el.select('.roo-document-viewer-image', true).first();
123 this.imageEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
125 this.footerEl = this.el.select('.roo-document-viewer-footer', true).first();
126 this.footerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
128 this.trashBtn = this.el.select('.roo-document-viewer-trash', true).first();
129 this.trashBtn.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
131 this.bodyEl.on('click', this.onClick, this);
133 this.trashBtn.on('click', this.onTrash, this);
139 // this.thumbEl.setStyle('line-height', this.thumbEl.getHeight(true) + 'px');
142 this.fireEvent('initial', this);
146 onClick : function(e)
150 this.fireEvent('click', this);
153 onTrash : function(e)
157 this.fireEvent('trash', this);