f08db909f31cf3e8b14c2f74c65024eebc496f37
[roojs1] / examples / dialog / test.js
1 var test = {
2
3     dialog : false,
4     callback : false,
5
6     show : function(data, cb)
7     {
8         if (!this.dialog) {
9             this.create();
10         }
11
12         this.callback = cb;
13         this.data = data;
14         this.dialog.show();
15     },
16
17     create : function()
18     {
19         var _this = this;
20         this.dialog = Roo.factory({
21             xtype : 'Modal',
22             xns : Roo.bootstrap,
23             title : 'Upload an Image',
24             buttons : Roo.bootstrap.Modal.OKCANCEL,
25             items: [
26                 {
27                     xtype : 'Row',
28                     xns : Roo.bootstrap,
29                     items: [
30                         {
31                             xtype : 'Column',
32                             xns : Roo.bootstrap,
33                             items: [
34                                 {
35                                     xtype : 'UploadCropbox',
36                                     xns : Roo.bootstrap,
37                                     minWidth : 720,
38                                     minHeight: 480,
39                                     listeners : {
40                                         arrange : function (_self, formData)
41                                         {
42                                             console.log("ARRANGE");
43                                             console.log(formData);
44                                         },
45                                         crop : function (_self, data)
46                                         {
47                                             console.log("CROP");
48                                             console.log(data);
49                                         },
50                                         resize : function (_self)
51                                         {
52                                             console.log("RESIZE");
53                                         },
54                                         rotate : function (_self)
55                                         {
56                                             console.log("ROTATE");
57                                         },
58                                         render : function (_self)
59                                         {
60                                             console.log("RENDER");
61                                             console.log(_self);
62                                             _this.cropbox = _self;
63                                         }
64                         
65                                     }
66                                 }
67                             ]
68                         }
69                     ]
70                 }
71             ],
72             listeners : {
73                 btnclick : function (e)
74                 {
75                     console.log(e);
76                     if(e == 'cancel') {
77                         _this.dialog.hide();
78                         return;
79                     }
80
81                     _this.cropbox.crop();
82                 }
83             }
84         });
85     }
86 }
87
88 Roo.onReady(function() {
89     
90     Roo.get('show-dialog-btn').on('click',function () {
91         test.show({});
92         console.log(test);
93     });
94 });