]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * @class Ext.chooser.InfoPanel\r | |
3 | * @extends Ext.panel.Panel\r | |
4 | * @author Ed Spencer\r | |
5 | * \r | |
6 | * This panel subclass just displays information about an image. We have a simple template set via the tpl property,\r | |
7 | * and a single function (loadRecord) which updates the contents with information about another image.\r | |
8 | */\r | |
9 | Ext.define('Ext.chooser.InfoPanel', {\r | |
10 | extend: 'Ext.panel.Panel',\r | |
11 | alias : 'widget.infopanel',\r | |
12 | id: 'img-detail-panel',\r | |
13 | \r | |
14 | width: 150,\r | |
15 | minWidth: 150,\r | |
16 | \r | |
17 | tpl: [\r | |
18 | '<div class="details">',\r | |
19 | '<tpl for=".">',\r | |
20 | '<img src="icons/{thumb}" />',\r | |
21 | '<div class="details-info">',\r | |
22 | '<b>Example Name:</b>',\r | |
23 | '<span>{name}</span>',\r | |
24 | '<b>Example URL:</b>',\r | |
25 | '<span><a href="http://dev.sencha.com/deploy/touch/examples/{url}" target="_blank">{url}.html</a></span>',\r | |
26 | '<b>Type:</b>',\r | |
27 | '<span>{type}</span>',\r | |
28 | '</div>',\r | |
29 | '</tpl>',\r | |
30 | '</div>'\r | |
31 | ],\r | |
32 | \r | |
33 | afterRender: function(){\r | |
34 | this.callParent();\r | |
35 | if (!Ext.isWebKit) {\r | |
36 | this.el.on('click', function(){\r | |
37 | alert('The Sencha Touch examples are intended to work on WebKit browsers. They may not display correctly in other browsers.');\r | |
38 | }, this, {delegate: 'a'});\r | |
39 | } \r | |
40 | },\r | |
41 | \r | |
42 | /**\r | |
43 | * Loads a given image record into the panel. Animates the newly-updated panel in from the left over 250ms.\r | |
44 | */\r | |
45 | loadRecord: function(image) {\r | |
46 | this.body.hide();\r | |
47 | this.tpl.overwrite(this.body, image.data);\r | |
48 | this.body.slideIn('l', {\r | |
49 | duration: 250\r | |
50 | });\r | |
51 | },\r | |
52 | \r | |
53 | clear: function(){\r | |
54 | this.body.update('');\r | |
55 | }\r | |
56 | }); |