This repository has been archived by the owner on Feb 28, 2019. It is now read-only.
forked from Jasonette/Jasonette-Web
-
Notifications
You must be signed in to change notification settings - Fork 5
/
footer.js
78 lines (78 loc) · 1.97 KB
/
footer.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
67
68
69
70
71
72
73
74
75
76
77
78
var Footer = {
$type: "nav",
class: "footer nav nav-justified",
_title: null,
_items: [],
_footer: null,
_style: null,
_tpl: {
tabs: function(item) {
return {
class: "nav-item",
$components: [{
$type: "img",
src: item.image,
$init: function() {
Style.node(this);
}
}, {
$text: item.text, class: "letter"
}]
}
}
},
_update: function(body) {
if (body.footer) {
this._footer = body.footer;
}
},
$update: function() {
if (this._footer.tabs) {
if (this._footer.tabs.items) {
if (this._footer.tabs.style) {
this._style = this._footer.tabs.style;
}
this.$components = this._footer.tabs.items.map(this._tpl.tabs)
}
} else if (this._footer.input) {
if (this._footer.input.style) {
this._style = this._footer.input.style;
}
var i = this._footer.input;
var inputItems = [];
if (i.left && i.left.image) {
var lb = {
$type: "img",
src: i.left.image
};
if (i.left.style) lb.style = Style.transform(i.left.style);
inputItems.push({
class: "input-item button-item",
$components: [lb]
})
}
if (i.textfield) {
var tf = {$type: "input"};
if (i.textfield.placeholder) tf.placeholder = i.textfield.placeholder;
if (i.textfield.style) tf.style = Style.transform(i.textfield.style);
inputItems.push({
class: "input-item textfield",
$components: [tf]
});
}
if (i.right && i.right.text) {
var rb = {
$type: "span",
$text: i.right.text
};
if (i.right.style) rb.style = Style.transform(i.right.style);
inputItems.push({
class: "input-item button-item",
$components: [rb]
})
}
this.$components = inputItems;
}
Style.node(this);
}
}