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',
87 cls : 'btn-group roo-document-viewer-download',
91 cls : 'btn btn-default',
92 html : '<i class="fa fa-download"></i>'
98 cls : 'btn-group roo-document-viewer-trash',
102 cls : 'btn btn-default',
103 html : '<i class="fa fa-trash"></i>'
116 initEvents : function()
118 this.bodyEl = this.el.select('.roo-document-viewer-body', true).first();
119 this.bodyEl.setVisibilityMode(Roo.Element.DISPLAY);
121 this.thumbEl = this.el.select('.roo-document-viewer-thumb', true).first();
122 this.thumbEl.setVisibilityMode(Roo.Element.DISPLAY);
124 this.imageEl = this.el.select('.roo-document-viewer-image', true).first();
125 this.imageEl.setVisibilityMode(Roo.Element.DISPLAY);
127 this.footerEl = this.el.select('.roo-document-viewer-footer', true).first();
128 this.footerEl.setVisibilityMode(Roo.Element.DISPLAY);
130 this.downloadBtn = this.el.select('.roo-document-viewer-download', true).first();
131 this.downloadBtn.setVisibilityMode(Roo.Element.DISPLAY);
133 this.trashBtn = this.el.select('.roo-document-viewer-trash', true).first();
134 this.trashBtn.setVisibilityMode(Roo.Element.DISPLAY);
136 this.bodyEl.on('click', this.onClick, this);
137 this.downloadBtn.on('click', this.onDownload, this);
138 this.trashBtn.on('click', this.onTrash, this);
140 this.downloadBtn.hide();
141 this.trashBtn.hide();
143 if(this.showDownload){
144 this.downloadBtn.show();
148 this.trashBtn.show();
151 if(!this.showDownload && !this.showTrash) {
152 this.footerEl.hide();
159 this.fireEvent('initial', this);
163 onClick : function(e)
167 this.fireEvent('click', this);
170 onDownload : function(e)
174 this.fireEvent('download', this);
177 onTrash : function(e)
181 this.fireEvent('trash', this);