Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / examples / view / chooser / InfoPanel.js
1 /*
2
3 This file is part of Ext JS 4
4
5 Copyright (c) 2011 Sencha Inc
6
7 Contact:  http://www.sencha.com/contact
8
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
11
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
13
14 */
15 /**
16  * @class Ext.chooser.InfoPanel
17  * @extends Ext.panel.Panel
18  * @author Ed Spencer
19  * 
20  * This panel subclass just displays information about an image. We have a simple template set via the tpl property,
21  * and a single function (loadRecord) which updates the contents with information about another image.
22  */
23 Ext.define('Ext.chooser.InfoPanel', {
24     extend: 'Ext.panel.Panel',
25     alias : 'widget.infopanel',
26     id: 'img-detail-panel',
27
28     width: 150,
29     minWidth: 150,
30
31     tpl: [
32         '<div class="details">',
33             '<tpl for=".">',
34                     (!Ext.isIE6? '<img src="icons/{thumb}" />' : 
35                     '<div style="width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'icons/{thumb}\')"></div>'),
36                 '<div class="details-info">',
37                     '<b>Example Name:</b>',
38                     '<span>{name}</span>',
39                     '<b>Example URL:</b>',
40                     '<span><a href="http://dev.sencha.com/deploy/touch/examples/{url}" target="_blank">{url}.html</a></span>',
41                     '<b>Type:</b>',
42                     '<span>{type}</span>',
43                 '</div>',
44             '</tpl>',
45         '</div>'
46     ],
47
48     /**
49      * Loads a given image record into the panel. Animates the newly-updated panel in from the left over 250ms.
50      */
51     loadRecord: function(image) {
52         this.body.hide();
53         this.tpl.overwrite(this.body, image.data);
54         this.body.slideIn('l', {
55             duration: 250
56         });
57     }
58 });