-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.js
72 lines (64 loc) · 2.93 KB
/
main.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
/*
<?php foreach ($modules as $module): ?>
<tr>
<td>
<?php if ($module["github"]): ?>
<a href="https://github.com/<?php echo $module["github"]; ?>"><?php echo $module["composer"]; ?></a>
<?php elseif ($module["gitlab"]): ?>
<a href="https://gitlab.cwp.govt.nz/<?php echo $module["gitlab"]; ?>"><?php echo $module["composer"]; ?></a>
<?php else: ?>
<?php echo $module["composer"]; ?>
<?php endif; ?>
</td>
<td><?php echo $module["type"]; ?></td>
<?php if ($module["github"]): ?>
<td class="progress first">
<a href="https://travis-ci.org/<?php echo $module["github"]; ?>">
<img src="http://img.shields.io/travis/<?php echo $module["github"]; ?>.svg?style=flat-square" />
</a>
</td>
<td class="progress">
<img src="http://img.shields.io/scrutinizer/coverage/g/<?php echo $module["github"]; ?>.svg?style=flat-square" />
</td>
<td class="progress last">
<a href="https://scrutinizer-ci.com/g/<?php echo $module["github"]; ?>">
<img src="http://img.shields.io/scrutinizer/g/<?php echo $module["github"]; ?>.svg?style=flat-square" />
</a>
</td>
<?php else: ?>
<td colspan="3">
Gitlab
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
*/
$.ajax({
"url": "modules.json",
"dataType": "json"
}).then(function(modules) {
var rows = [];
modules.forEach(function(module) {
var row = "<tr>";
if (module.github) {
row += "<td><a href='https://github.com/" + module.github + "'>" + module.composer + "</a></td>";
} else if (module.gitlab) {
row += "<td><a href='https://gitlab.cwp.govt.nz/" + module.gitlab + "'>" + module.composer + "</a></td>";
} else {
row += "<td>" + module.composer + "</td>";
}
row += "<td>" + module.type + "</td>";
if (module.github) {
row += "<td class='progress first'><a href='https://travis-ci.org/" + module.github + "'><img src='http://img.shields.io/travis/" + module.github + ".svg?style=flat-square' /></a></td>";
row += "<td class='progress'><img src='http://img.shields.io/scrutinizer/coverage/g/" + module.github + ".svg?style=flat-square' /></td>";
row += "<td class='progress last'><a href='https://scrutinizer-ci.com/g/" + module.github + "'><img src='http://img.shields.io/scrutinizer/g/" + module.github + ".svg?style=flat-square' /></a></td>";
} else if (module.gitlab) {
row += "<td colspan='3'>Module on Gitlab</td>";
} else {
row += "<td colspan='3'>Module definition incomplete</td>";
}
row += "</tr>";
rows.push(row);
});
$("tbody").html(rows.join(""));
});