]> git.proxmox.com Git - extjs.git/blame - extjs/examples/classic/calendar/src/template/Month.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / classic / calendar / src / template / Month.js
CommitLineData
6527f429
DM
1/**\r
2 * @class Ext.calendar.template.Month\r
3 * @extends Ext.XTemplate\r
4 * <p>This is the template used to render the {@link Ext.calendar.template.Month MonthView}. Internally this class defers to an\r
5 * instance of {@link Ext.calerndar.BoxLayoutTemplate} to handle the inner layout rendering and adds containing elements around\r
6 * that to form the month view.</p> \r
7 * <p>This template is automatically bound to the underlying event store by the \r
8 * calendar components and expects records of type {@link Ext.calendar.EventRecord}.</p>\r
9 * @constructor\r
10 * @param {Object} config The config object\r
11 */\r
12Ext.define('Ext.calendar.template.Month', {\r
13 extend: 'Ext.XTemplate',\r
14 \r
15 requires: ['Ext.calendar.template.BoxLayout'],\r
16 \r
17 constructor: function(config){\r
18 \r
19 Ext.apply(this, config);\r
20 \r
21 this.weekTpl = new Ext.calendar.template.BoxLayout(config);\r
22 this.weekTpl.compile();\r
23 \r
24 var weekLinkTpl = this.showWeekLinks ? '<div class="ext-cal-week-link-hd">&#160;</div>' : '';\r
25 \r
26 this.callParent([\r
27 '<div class="ext-cal-inner-ct {extraClasses}">',\r
28 '<div class="ext-cal-hd-ct ext-cal-month-hd">',\r
29 weekLinkTpl,\r
30 '<table class="ext-cal-hd-days-tbl" cellpadding="0" cellspacing="0">',\r
31 '<tbody>',\r
32 '<tr>',\r
33 '<tpl for="days">',\r
34 '<th class="ext-cal-hd-day{[xindex==1 ? " ext-cal-day-first" : ""]}" title="{.:date("l, F j, Y")}">{.:date("D")}</th>',\r
35 '</tpl>',\r
36 '</tr>',\r
37 '</tbody>',\r
38 '</table>',\r
39 '</div>',\r
40 '<div class="ext-cal-body-ct">{weeks}</div>',\r
41 '</div>'\r
42 ]);\r
43 },\r
44\r
45 // private\r
46 applyTemplate : function(o){\r
47 var days = [],\r
48 weeks = this.weekTpl.apply(o),\r
49 dt = o.viewStart,\r
50 D = Ext.calendar.util.Date;\r
51 \r
52 for(var i = 0; i < 7; i++){\r
53 days.push(D.add(dt, {days: i}));\r
54 }\r
55 \r
56 var extraClasses = this.showHeader === true ? '' : 'ext-cal-noheader';\r
57 if(this.showWeekLinks){\r
58 extraClasses += ' ext-cal-week-links';\r
59 }\r
60 \r
61 return this.applyOut({\r
62 days: days,\r
63 weeks: weeks,\r
64 extraClasses: extraClasses\r
65 }, []).join('');\r
66 },\r
67 \r
68 apply: function(values) {\r
69 return this.applyTemplate.apply(this, arguments);\r
70 }\r
71});