1 Ext.define('FV.view.article.Grid', {
2 extend: 'Ext.grid.Panel',
3 alias: 'widget.articlegrid',
8 requires: ['Ext.ux.PreviewPlugin', 'Ext.toolbar.Toolbar'],
12 initComponent: function() {
20 bodyField: 'description',
29 renderer: this.formatTitle
38 renderer: this.formatDate,
51 this.callParent(arguments);
58 formatTitle: function(value, p, record) {
59 return Ext.String.format('<div class="topic"><b>{0}</b><span class="author">{1}</span></div>', value, record.get('author') || "Unknown");
66 formatDate: function(date) {
72 d = Ext.Date.clearTime(now, true),
73 notime = Ext.Date.clearTime(date, true).getTime();
75 if (notime === d.getTime()) {
76 return 'Today ' + Ext.Date.format(date, 'g:i a');
79 d = Ext.Date.add(d, 'd', -6);
80 if (d.getTime() <= notime) {
81 return Ext.Date.format(date, 'D g:i a');
83 return Ext.Date.format(date, 'Y/m/d g:i a');