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)
14 * Create a new DocumentViewer
15 * @param {Object} config The config object
18 Roo.bootstrap.DocumentViewer = function(config){
19 Roo.bootstrap.DocumentViewer.superclass.constructor.call(this, config);
24 * Fire after initEvent
25 * @param {Roo.bootstrap.DocumentViewer} this
31 * @param {Roo.bootstrap.DocumentViewer} this
36 * Fire after download button
37 * @param {Roo.bootstrap.DocumentViewer} this
42 * Fire after trash button
43 * @param {Roo.bootstrap.DocumentViewer} this
50 Roo.extend(Roo.bootstrap.DocumentViewer, Roo.bootstrap.Component, {
56 getAutoCreate : function()
60 cls : 'roo-document-viewer',
64 cls : 'roo-document-viewer-body',
68 cls : 'roo-document-viewer-thumb',
72 cls : 'roo-document-viewer-image'
80 cls : 'roo-document-viewer-footer',
83 cls : 'btn-group btn-group-justified roo-document-viewer-btn-group',
91 cls : 'btn btn-default roo-document-viewer-download',
92 html : '<i class="fa fa-download"></i>'
102 cls : 'btn btn-default roo-document-viewer-trash',
103 html : '<i class="fa fa-trash"></i>'
116 initEvents : function()
119 this.bodyEl = this.el.select('.roo-document-viewer-body', true).first();
120 this.bodyEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
122 this.thumbEl = this.el.select('.roo-document-viewer-thumb', true).first();
123 this.thumbEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
125 this.imageEl = this.el.select('.roo-document-viewer-image', true).first();
126 this.imageEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
128 this.footerEl = this.el.select('.roo-document-viewer-footer', true).first();
129 this.footerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
131 this.downloadBtn = this.el.select('.roo-document-viewer-download', true).first();
132 this.downloadBtn.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
134 this.trashBtn = this.el.select('.roo-document-viewer-trash', true).first();
135 this.trashBtn.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
137 this.bodyEl.on('click', this.onClick, this);
138 this.downloadBtn.on('click', this.onDownload, this);
139 this.trashBtn.on('click', this.onTrash, this);
141 this.footerEl.hide();
142 this.downloadBtn.hide();
143 this.trashBtn.hide();
145 if(this.showDownload){
146 this.footerEl.show();
147 this.downloadBtn.show();
151 this.footerEl.show();
152 this.trashBtn.show();
159 // this.thumbEl.setStyle('line-height', this.thumbEl.getHeight(true) + 'px');
162 this.fireEvent('initial', this);
166 onClick : function(e)
170 this.fireEvent('click', this);
173 onDownload : function(e)
177 this.fireEvent('download', this);
180 onTrash : function(e)
184 this.fireEvent('trash', this);