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 : 'img',
49                             cls : 'roo-document-viewer-thumb',
50                             style : 'width: ' + this.width + 'px; height: ' + this.height + 'px;',
51                         }
52                     ]
53                 },
54                 {
55                     tag : 'div',
56                     cls : 'roo-document-viewer-footer',
57                     cn : {
58                         tag : 'div',
59                         cls : 'btn-group btn-group-justified roo-document-viewer-btn-group',
60                         cn : [
61                             {
62                                 tag : 'div',
63                                 cls : 'btn-group',
64                                 cn : [
65                                     {
66                                         tag : 'button',
67                                         cls : 'btn btn-default roo-document-viewer-trash',
68                                         html : '<i class="fa fa-trash"></i>'
69                                     }
70                                 ]
71                             }
72                         ]
73                     }
74                 }
75             ]
76         };
77         
78         return cfg;
79     },
80     
81     initEvents : function()
82     {
83         
84         this.bodyEl = this.el.select('.roo-document-viewer-body', true).first();
85         this.bodyEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
86         
87         this.imageEl = this.el.select('.roo-document-viewer-image', true).first();
88         this.imageEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
89         
90         this.thumbEl = this.el.select('.roo-document-viewer-thumb', true).first();
91         this.thumbEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
92         
93         this.footerEl = this.el.select('.roo-document-viewer-footer', true).first();
94         this.footerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
95         
96         this.trashBtn = this.el.select('.roo-document-viewer-trash', true).first();
97         this.trashBtn.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
98         
99         this.bodyEl.on('click', this.onClick, this);
100         
101         this.trashBtn.on('click', this.onTrash, this);
102         
103         this.fireEvent('initial', this);
104     },
105     
106     onClick : function()
107     {
108         
109     },
110     
111     onTrash : function()
112     {
113         
114     }
115     
116 });