13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
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
Ext.define('FV.view.article.Preview', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.articlepreview',
 
    requires: ['Ext.toolbar.Toolbar'],
 
    cls: 'preview',
    autoScroll: true,
    border: false,
    
    initComponent: function() {
        Ext.apply(this, {
            tpl: new Ext.XTemplate(
                '<div class="post-data">',
                    '<span class="post-date">{pubDate:this.formatDate}</span>',
                    '<h3 class="post-title">{title}</h3>',
                    '<h4 class="post-author">by {author:this.defaultValue}</h4>',
                '</div>',
                '<div class="post-body">{content:this.getBody}</div>', {
 
                getBody: function(value, all) {
                    return Ext.util.Format.stripScripts(value);
                },
 
                defaultValue: function(v) {
                    return v ? v : 'Unknown';
                },
 
                formatDate: function(value) {
                    if (!value) {
                        return '';
                    }
                    return Ext.Date.format(value, 'M j, Y, g:i a');
                }
            }),
 
            dockedItems: [{
                dock: 'top',
                xtype: 'toolbar',
                items: [{
                    iconCls: 'tab-new',
                    text: 'View in new tab',
                    action: 'viewintab'
                }, {
                    iconCls: 'post-go',
                    text: 'Go to post',
                    action: 'gotopost'
                }]
            }]
        });
 
        this.callParent(arguments);
    }
});