-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment.html
61 lines (60 loc) · 1.81 KB
/
comment.html
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
<script>
var w2 = window.whistleBridge;
var showModal = w2.showModal;
var MAX_LEN = 100;
w2.addNetworkListener(function(options) {
if (options.name !== 'Set Comment') {
return;
}
var selectedList = options.selectedList;
var activeItem = options.activeItem;
if (options.activeList) {
selectedList = options.activeList;
} else if (activeItem && !activeItem.selected) {
selectedList = [activeItem];
}
var comment = '';
var body = [
'<h5>Enter a comment to associate with the selected Sessions:</h5>',
'<input maxlength="' + MAX_LEN + '" style="width: 430px;"',
'oninput="handleInput" onkeyup="handleKeyUp"',
'placeholder="Input a comment" class="form-control" />'
];
var setComment = function() {
selectedList.forEach(function(item) {
item.customData = item.customData || {};
item.customData.comment = comment.substring(0, MAX_LEN);
});
comment = '';
hideModal();
w2.updateUI();
};
var hideModal = showModal({
width: 450,
title: 'Set Comment',
body: body.join('\n'),
footer: [
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>',
'<button type="button" class="btn btn-primary" onclick="setComment" data-dismiss="modal">Set Comment</button>'
].join('\n'),
onShow: function(dialog) {
try {
var input = dialog.container.find('input');
input.select();
input.focus();
} catch (e) {}
},
methods: {
handleInput: function(e) {
comment = e.target.value;
},
handleKeyUp: function(e) {
if (e.keyCode === 13) {
setComment();
}
},
setComment: setComment
}
});
});
</script>