-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbs3Template.js
66 lines (58 loc) · 1.62 KB
/
bs3Template.js
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
55
56
57
58
59
60
61
62
63
64
65
66
import BaseTemplate from './baseTemplate'
import {ClassName} from './../constants'
/**
* This class registers overridable partials in the {Default} hash constant. Subclasses can override this
* {Default} config by passing in any keys as overrides.
*
* Interpolation is delayed until #createTemplate is called in order to allow Subclasses to make use of any
* superclasses' partials. Tokens are denoted by %% e.g. %header% will be replaced by config.header.
*
*/
const Default = {
// keep templates under the markup key so they can be whacked and not included in the general config overrides
markup: {
arrow: {
left: `«`,
right: `»`
}
}
}
const BS3Template = class extends BaseTemplate {
constructor(...configs) {
super(Default, ...configs)
}
generateView(className) {
let html = `<div class="${className} ${ClassName.VIEW}">
<table>
<thead>
<tr>
<th colspan="7" class="${ClassName.LABEL_TITLE}"></th>
</tr>
<tr>
<th class="${ClassName.PREV}">%arrow.left%</th>
<th colspan="5" class="${ClassName.SWITCH}"></th>
<th class="${ClassName.NEXT}">%arrow.right%</th>
</tr>
</thead>
<tbody>`
if (className !== ClassName.DAYS) {
html += `<tr>
<td colspan="7"></td>
</tr>`
}
html += `
</tbody>
<tfoot>
<tr>
<th colspan="7" class="${ClassName.TODAY}"></th>
</tr>
<tr>
<th colspan="7" class="${ClassName.CLEAR}"></th>
</tr>
</tfoot>
</table>
</div>`
return html
}
}
export default BS3Template