-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecklist_status.vm
33 lines (29 loc) · 1.1 KB
/
checklist_status.vm
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
## @noparams
## Macro title: My Macro
## Macro has a body: Y or N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: My Name
## Date created: dd/mm/yyyy
## Installed by: PF
<span id="checklist-status" class="aui-lozenge">To dos</span>
<script type="text/javascript">
(function ($) {
AJS.toInit(function() {
var checkList = $('#checklist-status');
var setStatus = function() {
var checked = $('li.checked').length;
if (checked == 18) {
checkList.removeClass('aui-lozenge-moved aui-lozenge-current').addClass('aui-lozenge-success').text('Completed');
} else if (checked > 0) {
checkList.removeClass('aui-lozenge-moved aui-lozenge-success').addClass('aui-lozenge-current').text('In Progress');
} else {
checkList.removeClass('aui-lozenge-current aui-lozenge-success').addClass('aui-lozenge-moved').text('To do');
}
};
setStatus();
AJS.bind("inline-tasks.status-update.complete", setStatus);
});
})(AJS.$);
</script>