Roo/bootstrap/DocumentViewer.js
[roojs1] / Roo / bootstrap / DocumentViewer.js
1
2 /*
3 * Licence: LGPL
4 */
5
6 /**
7  * @class Roo.bootstrap.DocumentViewer
8  * @extends Roo.bootstrap.Component
9  * Bootstrap DocumentViewer class
10  * @cfg {Number} width default 300
11  * @cfg {Number} height default 300
12  * 
13  * @constructor
14  * Create a new DocumentViewer
15  * @param {Object} config The config object
16  */
17
18 Roo.bootstrap.DocumentViewer = function(config){
19     Roo.bootstrap.DocumentViewer.superclass.constructor.call(this, config);
20     
21     this.addEvents({
22         /**
23          * @event initial
24          * Fire after initEvent
25          * @param {Roo.bootstrap.DocumentViewer} this
26          */
27         "initial" : true
28         
29     });
30 };
31
32 Roo.extend(Roo.bootstrap.DocumentViewer, Roo.bootstrap.Component,  {
33     
34     width : 300,
35     height : 300,
36     
37     getAutoCreate : function()
38     {
39         var cfg = {
40             tag : 'div',
41             cls : 'roo-document-viewer',
42             cn : [
43                 {
44                     tag : 'div',
45                     cls : 'roo-document-viewer-body',
46                     cn : [
47                         {
48                             tag : 'div',
49                             cls : 'roo-document-viewer-preview',
50                             style : 'width: ' + this.width + 'px; height: ' + this.height + 'px;',
51                             cn : [
52                                 {
53                                     tag : 'img',
54                                     cls : 'roo-document-viewer-thumb'
55                                 }
56                             ]
57                         }
58                     ]
59                 },
60                 {
61                     tag : 'div',
62                     cls : 'roo-document-viewer-footer',
63                     cn : {
64                         tag : 'div',
65                         cls : 'btn-group btn-group-justified roo-document-viewer-btn-group',
66                         cn : [
67                             {
68                                 tag : 'div',
69                                 cls : 'btn-group',
70                                 cn : [
71                                     {
72                                         tag : 'button',
73                                         cls : 'btn btn-default roo-document-viewer-trash',
74                                         html : '<i class="fa fa-trash"></i>'
75                                     }
76                                 ]
77                             }
78                         ]
79                     }
80                 }
81             ]
82         };
83         
84         return cfg;
85     },
86     
87     initEvents : function()
88     {
89         
90         this.bodyEl = this.el.select('.roo-document-viewer-body', true).first();
91         this.bodyEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
92         
93         this.previewEl = this.el.select('.roo-document-viewer-preview', true).first();
94         this.previewEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
95         
96         this.thumbEl = this.el.select('.roo-document-viewer-thumb', true).first();
97         this.thumbEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
98         
99         this.footerEl = this.el.select('.roo-document-viewer-footer', true).first();
100         this.footerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
101         
102         this.trashBtn = this.el.select('.roo-document-viewer-trash', true).first();
103         this.trashBtn.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
104         
105         this.bodyEl.on('click', this.onClick, this);
106         
107         this.trashBtn.on('click', this.onTrash, this);
108         
109         this.fireEvent('initial', this);
110     },
111     
112     onClick : function()
113     {
114         
115     },
116     
117     onTrash : function()
118     {
119         
120     }
121     
122 });