forked from code-dot-org/code-dot-org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshowProjectAdmin.js
More file actions
36 lines (33 loc) · 1.11 KB
/
showProjectAdmin.js
File metadata and controls
36 lines (33 loc) · 1.11 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
/* global dashboard */
import $ from 'jquery';
/**
* Dynamic generation and event bindings for project admin section of the admin box
*/
export default () => {
if ($('.project_admin').length) {
if (dashboard.project.isProjectLevel()) {
if (dashboard.project.isFrozen()) {
$('.project_admin').html($('<span>❄ Frozen! To use as an example, copy this id: <input type="text" disabled value="' +
dashboard.project.getCurrentId() +
'"/></span>'));
} else {
$('.project_admin').html($('<button id="freeze" class="btn btn-default btn-sm">Freeze for use as an exemplar ❄</button>'));
$('#freeze').click(function () {
dashboard.project.freeze(function () {
window.location.reload();
});
});
}
}
}
if ($('.admin-abuse').length) {
var abuseScore = dashboard.project.getAbuseScore();
if (abuseScore) {
$('.admin-abuse').show();
$('.admin-abuse-score').text(abuseScore);
$('.admin-abuse-reset').click(function () {
dashboard.project.adminResetAbuseScore();
});
}
}
};