Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / examples / app / feed-viewer / app / view / article / Preview.js
1 Ext.define('FV.view.article.Preview', {
2         extend: 'Ext.panel.Panel',
3         alias: 'widget.articlepreview',
4
5     requires: ['Ext.toolbar.Toolbar'],
6
7         cls: 'preview',
8         autoScroll: true,
9         border: false,
10         
11         initComponent: function() {
12                 Ext.apply(this, {
13                         tpl: new Ext.XTemplate(
14                             '<div class="post-data">',
15                                 '<span class="post-date">{pubDate:this.formatDate}</span>',
16                                 '<h3 class="post-title">{title}</h3>',
17                                 '<h4 class="post-author">by {author:this.defaultValue}</h4>',
18                             '</div>',
19                             '<div class="post-body">{content:this.getBody}</div>', {
20
21                                 getBody: function(value, all) {
22                                         return Ext.util.Format.stripScripts(value);
23                                 },
24
25                                 defaultValue: function(v) {
26                                         return v ? v : 'Unknown';
27                                 },
28
29                                 formatDate: function(value) {
30                                         if (!value) {
31                                                 return '';
32                                         }
33                                         return Ext.Date.format(value, 'M j, Y, g:i a');
34                                 }
35                         }),
36
37                         dockedItems: [{
38                                 dock: 'top',
39                                 xtype: 'toolbar',
40                                 border: false,
41                                 items: [{
42                                         text: 'View in new tab',
43                                         action: 'viewintab'
44                                 }, {
45                                         text: 'Go to post',
46                                         action: 'gotopost'
47                                 }]
48                         }]
49                 });
50
51                 this.callParent(arguments);
52         }
53 });