-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpriceList.js
78 lines (65 loc) · 1.85 KB
/
priceList.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
/* global tabris */
var editIssues = require('./editIssues')
var updateStatus = require('./updateStatus')
var MARGINLEFT = 10
function createEditableGroup (props) {
var container = tabris.create('Composite', {
layoutData: {top: ['prev()', 0], left: 0, right: 0},
highlightOnTouch: true
}).on('tap', function () {
switch (props.case) {
case 'issues':
editIssues(props.data, editableText)
break
case 'status':
updateStatus(props.data, editableText)
break
default:
break
}
}).appendTo(props.parent)
tabris.create('TextView', {
text: props.label,
font: '11px',
textColor: '#6E7783',
layoutData: {top: 6, left: MARGINLEFT, right: 0}
}).appendTo(container)
var editableText = tabris.create('TextView', {
text: props.bodyText,
font: '16px',
textColor: '#252c41',
layoutData: {top: ['prev()', 6], left: MARGINLEFT, right: 40}
}).appendTo(container)
tabris.create('ImageView', {
image: {src: 'images/view_more.png', scale: 3},
layoutData: {right: 20},
centerY: 0
}).appendTo(container)
return null
}
function createLine (props) {
var alignment
var margin
if (props.alignment === 'top') {
// alignment is require to be specific because is using a fraction
// and there will be a gap depending on its position.
alignment = {top: 0, bottom: 0.5, left: 0, right: 0}
margin = 0
} else {
alignment = {top: 0.5, bottom: 0, left: 0, right: 0}
margin = ['prev()', 6]
}
var dividerContainer = tabris.create('Composite', {
layoutData: {top: margin, left: 0, right: 0},
height: 1
}).appendTo(props.parent)
tabris.create('TextView', {
background: '#dddfe6',
layoutData: alignment
}).appendTo(dividerContainer)
return null
}
module.exports = {
editableGroup: createEditableGroup,
line: createLine
}