Skip to content

Commit e0c4002

Browse files
committed
add missing template
1 parent 8b3f717 commit e0c4002

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
{% extends sitebase.html %}
2+
{%block head%}
3+
<style type="text/css">
4+
.navlist li
5+
{
6+
display: inline;
7+
padding-right: 20px;
8+
}
9+
.portal-select {
10+
width: 15em;
11+
}
12+
</style>
13+
<script>
14+
function check_submit(action) {
15+
//disable submit buttons
16+
$("#add-button").prop('disabled', true);
17+
$("#remove-button").prop('disabled', true);
18+
$("#messages").html("");
19+
var errors = "";
20+
var boxes = oTable.$(".selected:checked", {"page": "all"});
21+
//serialize the checked boxes
22+
var data = "";
23+
for(i=0;i<boxes.length;i++) {
24+
data += "&selected="+boxes[i].value;
25+
}
26+
if(data.length === 0) {
27+
//No checked rows, so add error message if needed and then don't submit
28+
if(!$('#checkbox-error').length) { errors += "Please select at least one user<br/>"; }
29+
}
30+
if(errors.length > 0) {
31+
$("#add-button").prop('disabled', false);
32+
$("#remove-button").prop('disabled', false);
33+
bootstrapAlert(errors, "danger", 80000);
34+
return false;
35+
}
36+
37+
$("#action").val(action);
38+
data = $('#user-form').serialize() + data;
39+
$.post('{{submit_url}}', data, function(data,textStatus,jqXHR){
40+
$("#add-button").prop('disabled', false);
41+
$("#remove-button").prop('disabled', false);
42+
if(data.indexOf("ERROR") > -1) {
43+
bootstrapAlert(data, "danger", 2200);
44+
}
45+
else {
46+
$('#info-table').DataTable().ajax.url("{% raw qiita_config.portal_dir %}/admin/purge_usersAjax/").load();
47+
bootstrapAlert(data, "success", 2200);
48+
}
49+
});
50+
}
51+
52+
function render_checkbox(data, type, full) {
53+
return "<input type='checkbox' class='selected' onclick='checkbox_change()' value='" + full['email'] + "' />";
54+
}
55+
56+
function checkbox_change() {
57+
$("#checkbox-error").remove();
58+
}
59+
60+
function checkbox_action(action) {
61+
var boxes = oTable.$(':checkbox', {"filter":"applied", "page": "all"});
62+
if(action == 'check') { boxes.prop('checked',true); }
63+
else if(action == 'uncheck') { boxes.prop('checked',false); }
64+
else if(action='invert') { boxes.each( function() {
65+
$(this).is(':checked') ? $(this).prop('checked',false) : $(this).prop('checked',true);
66+
});}
67+
return false;
68+
}
69+
70+
71+
$(document).ready(function() {
72+
oTable = $('#info-table').dataTable({
73+
"order": [[6, 'desc']], // sort by creation timestamp, newest first
74+
"deferRender": true,
75+
"iDisplayLength": 50,
76+
"oLanguage": {
77+
"sZeroRecords": "Nice and clean: No users found that registered more than 30 days ago and are not yet validated."
78+
},
79+
"columns": [
80+
{"className": 'select', "data": null},
81+
{% for h in headers %}
82+
{"data": "{{h}}"},
83+
{% end %}
84+
],
85+
'aoColumnDefs': [
86+
{ 'mRender': render_checkbox, 'mData': 2, 'aTargets': [ 0 ] }
87+
],
88+
'ajax':{
89+
"url": '/admin/purge_usersAjax/',
90+
"dataSrc": ''
91+
}
92+
});
93+
});
94+
</script>
95+
{%end%}
96+
{%block content%}
97+
Listing all users that are not yet validated but registered more than 30 days ago.
98+
<div class='row' style="margin-top:15px">
99+
<div class='col-lg-12'>
100+
<input type=button onclick="checkbox_action('check')" class="btn btn-xs btn-info" value="Select All"> | <input type=button onclick="checkbox_action('uncheck')" class="btn btn-xs btn-info" value="Select None"> | <input type=button onclick="checkbox_action('inverse')" class="btn btn-xs btn-info" value="Select Inverse"><br/>
101+
<table id="info-table" class="table">
102+
<thead>
103+
<tr>
104+
<td>Select</td>
105+
{% for head in headers %}
106+
<td>{{head}}</td>
107+
{% end %}
108+
</tr>
109+
</thead>
110+
<tbody>
111+
</tbody>
112+
</table>
113+
</div>
114+
</div>
115+
<div class="row bottomfloat" style="background-color: #FFF;">
116+
<div class='col-lg-12' style="background-color: #FFF;">
117+
<form role="form" id="user-form">
118+
<input type="hidden" name="action" id="action" value="">
119+
<input type="button" id="remove-button" value="Remove Users from Qiita Database" class="btn btn-sm btn-danger" onclick="check_submit('Remove')">
120+
</form>
121+
</div>
122+
</div>
123+
{% end %}

0 commit comments

Comments
 (0)