Blame view

js/app/views/Viewport.js 2.88 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
 * @class AMDA-NG4.Viewport
 * @extends Ext.Panel
 * This is a default generated class which would usually be used to initialize your application's
 * main viewport. By default this is simply a welcome screen that tells you that the app was 
 * generated correctly.
 */
AMDA-NG4.Viewport = Ext.extend(Ext.Panel, {
    id        : 'viewport',
    layout    : 'card',
    fullscreen: true,

    initComponent: function() {
        var store = new Ext.data.Store({
            fields: ['text', 'href'],
            data  : [
                {
                    text: 'Touch API',
                    href: 'http://dev.sencha.com/deploy/touch/docs/'
                },
                {
                    text: 'Touch Examples',
                    href: 'http://dev.sencha.com/deploy/touch/examples/'
                }
            ]
        });

        Ext.apply(this, {
            dockedItems: [
                {
                    dock : 'left',
                    xtype: 'list',
                    store: store,
                    width: 250,

                    tpl         : '<tpl for="."><div class="link"><strong>{text}</strong></div></tpl>',
                    itemSelector: 'div.link',

                    listeners: {
                        itemtap: this.onListItemTap
                    },

                    dockedItems: [
                        {
                            xtype: 'toolbar',
                            dock : 'top',
                            ui   : 'light'
                        }
                    ]
                }
            ],

            items: [
                {
                    xtype : 'panel',
                    layout: 'fit',

                    dockedItems: [
                        {
                            dock : 'top',
                            xtype: 'toolbar',
                            title: 'Welcome to Sencha Touch'
                        }
                    ],

                    items: [
                        {
                            xtype: 'panel',
                            style: 'background:#fff',

                            styleHtmlContent: true,

                            html : [
                                '<h3>Getting Started</h3>',
                                '<p>You have successfully generated the AMDA-NG4 application. Currently this app is a blank slate, ',
                                'with just the minimum set of files and directories. The file creating this interface can be found ',
                                'in app/views/Viewport.js</p>'
                            ]
                        }
                    ]
                }
            ]
        });

        AMDA-NG4.Viewport.superclass.initComponent.apply(this, arguments);
    },

    onListItemTap: function(list, index, node, e) {
        var record = list.getRecord(node);

        window.open(record.get('href'));
    }
});