/
tools.html
93 lines (78 loc) · 1.96 KB
/
tools.html
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
<!-- extend base layout -->
{% extends "__base.html" %}
{% macro consolidator() %}
<div class="well well-large">
<div class="well well-sm">
Consolidate duplicate series-pages by URL.
<button id="consolidate-series-btn">Go</button>
</div>
<div class="well well-sm">
Consolidate duplicate releases by URL.
<button id="consolidate-releases-btn">Go</button>
</div>
<div class="well well-sm">
Fix double-escaped titles and descriptions.
<button id="fix-escapes-btn">Go</button>
</div>
<div class="well well-sm">
Delete tags that only occur once across the entire database.
<button id="clean-singleton-tags-btn">Go</button>
</div>
</div>
{% endmacro %}
{% block content %}
{% include '_block_flash.html' %}
{% if g.user.is_admin() %}
<div class="well well-large">
<div>
<h2>System management tools</h2>
</div>
</div>
{{consolidator()}}
{% endif %}
{% endblock %}
{% block footer %}
{% if g.user.is_mod() %}
<script>
function handle_success(data, textStatus, jqXHR)
{
alert("Response: " + textStatus + "\nmessage: " + data['message']);
}
function do_post(post_data)
{
$.ajax({
url : '/api',
type : 'POST',
dataType : 'json',
contentType : 'application/json',
data : JSON.stringify(post_data),
success : handle_success,
});
}
$('#consolidate-series-btn').click(function() {
var post_data = {
'mode' : 'flatten-series-by-url'
}
do_post(post_data)
});
$('#consolidate-releases-btn').click(function() {
var post_data = {
'mode' : 'delete-duplicate-releases'
}
do_post(post_data)
});
$('#fix-escapes-btn').click(function() {
var post_data = {
'mode' : 'fix-escapes'
}
do_post(post_data)
});
$('#clean-singleton-tags-btn').click(function() {
var post_data = {
'mode' : 'clean-singleton-tags'
}
do_post(post_data)
});
</script>
{% endif %}
{% endblock %}