-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.js
28 lines (22 loc) · 887 Bytes
/
template.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
// template function
function goalsTemplate(id, title, goals, state){
var goalspanel;
var top = "<div class='panel-group'>";
top = top + "<div class='panel panel-default'>";
top = top + "<div class='panel-heading'>";
top = top + "<h4 class='panel-title'>";
top = top + "<a data-toggle='collapse' href='#collapse";
var success = "<div class='panel-body alert alert-success'>";
var pending = "<div class='panel-body alert alert-danger'>";
goalspanel = top + id + "'>" + title + "</a></h4> </div> <div id='collapse" + id +"' class='panel-collapse collapse'> ";
// goals loop
for(var i = 0; i < goals.length ; i++){
if(state[i] === 1){
goalspanel = goalspanel + success + goals[i] + "</div>";
}else{
goalspanel = goalspanel + pending + goals[i] + "</div>";
}
}
goalspanel = goalspanel + "</div></div></div>";
return goalspanel;
}