-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path03-discuss.html
More file actions
107 lines (99 loc) · 2.61 KB
/
03-discuss.html
File metadata and controls
107 lines (99 loc) · 2.61 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
layout: page
title: Discussion
permalink: /discuss
---
<p>
<a target="_blank" class="button" href="https://github.com/datacleaner/DataCleaner/issues/new?labels=Discussion">
<i class="fa icon fa-commenting" aria-hidden="true"></i>
New discussion post
</a>
</p>
<div class="tableContainer">
<table class="discussTable" id="discussTable">
<tr>
<th>Title</th>
<th>Author</th>
<th>Created</th>
<th>Replies</th>
</tr>
<tr id="discussTableLoading">
<td colspan="4">
Loading data ...
</td>
</tr>
</table>
</div>
<p>
Our discussions are powered by GitHub issues. Ensure that you use the label
'Discussion' or 'Question' when creating an issue, and it will show up on this list.
</p>
<script type='text/javascript'>
function formatDate(s) {
var d = new Date(s);
var month = d.getUTCMonth()+1;
if (month < 10) {
month = '0' + month;
}
var date = d.getUTCDate();
if (date < 10) {
date = '0' + date;
}
return d.getUTCFullYear() + '-' + month + '-' + date;
}
var postsUrl = "https://api.github.com/repos/datacleaner/DataCleaner/issues";
var responseCount = 0;
var labels = ["Question","VOTE","Discussion"];
var issues = {};
$(labels).each(function() {
requestIssues(this, labels.length);
});
function requestIssues(label, requestCount) {
$.getJSON({
dataType: "json",
url: postsUrl,
data: {
"labels": label,
"state": "all",
"sort": "updated",
"direction": "desc"
},
success: function(data) {
$(data).each(function() {
issues[this.id] = this;
});
responseCount++;
if (responseCount == requestCount) {
updateTable();
}
}
});
}
function updateTable() {
$(Object.values(issues))
.sort(function (a,b) {
return new Date(b.updated_at) - new Date(a.updated_at);
})
.each(function() {
var iconStyle = "comment";
if (this.comments > 0) {
iconStyle = "comments";
}
if (this.title.startsWith("[VOTE]")) {
iconStyle = "check-circle";
}
var output =
"<tr class='discussPost'>"
+ "<td class='topic'>"
+ "<i class='fa icon fa-" + iconStyle + "' aria-hidden='true'></i>"
+ "<a target='_blank' href='" + this.html_url + "'>" + this.title + "</a>"
+ "</td>"
+ "<td class='author'><a target='_blank' href='" + this.user.html_url + "'><img class='discussAvatar' src='" + this.user.avatar_url + "' />" + this.user.login + "</a></td>"
+ "<td class='created'>" + formatDate(this.created_at) + "</td>"
+ "<td class='replies'>" + this.comments + "</td>"
+ "</tr>";
$('#discussTable').append(output);
});
$('#discussTableLoading').remove();
}
</script>