2 * @class FeedViewer.FeedPost
3 * @extends Ext.panel.Panel
5 * Shows the detail of a feed post
8 * Create a new Feed Post
9 * @param {Object} config The config object
11 Ext.define('FeedViewer.FeedPost', {
13 extend: 'Ext.panel.Panel',
14 alias: 'widget.feedpost',
19 initComponent: function(){
21 dockedItems: [this.createToolbar()],
22 tpl: Ext.create('Ext.XTemplate',
23 '<div class="post-data">',
24 '<span class="post-date">{pubDate:this.formatDate}</span>',
25 '<h3 class="post-title">{title}</h3>',
26 '<h4 class="post-author">by {author:this.defaultValue}</h4>',
28 '<div class="post-body">{content:this.getBody}</div>',
30 getBody: function(value, all){
31 return Ext.util.Format.stripScripts(value);
34 defaultValue: function(v){
35 return v ? v : 'Unknown';
38 formatDate: function(value){
42 return Ext.Date.format(value, 'M j, Y, g:i a');
47 this.callParent(arguments);
52 * @param {Ext.data.Model} rec The record
54 setActive: function(rec) {
56 this.update(rec.data);
60 * Create the top toolbar
62 * @return {Ext.toolbar.Toolbar} toolbar
64 createToolbar: function(){
70 handler: this.openTab,
71 text: 'View in new tab',
76 config.cls = 'x-docked-noborder-top';
80 handler: this.goToPost,
85 return Ext.create('widget.toolbar', config);
89 * Navigate to the active post in a new window
93 window.open(this.active.get('link'));
97 * Open the post in a new tab
101 this.fireEvent('opentab', this, this.active);