forked from df1163/Open-Source-Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.html
72 lines (68 loc) · 2.15 KB
/
edit.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
<html>
<script>
function isOneChecked() {
// All <input> tags...
var chx = document.getElementsByTagName('input');
for (var i=0; i<chx.length; i++) {
// If you have more than one radio group, also check the name attribute
// for the one you want as in && chx[i].name == 'choose'
// Return true from the function on first match of a checked item
if (chx[i].type == 'radio' && chx[i].checked) {
return true;
}
}
// End of the loop, return false
alert("At least choose one value")
return false;
}
</script>
<body>
<h3>Current category: {{ currentCategory|escape }}</h3>
<div>
<form action="/add_item" method="post">
Add new item: <input type="text" name="item_name">
<input type="hidden" name="category_name" value="{{ currentCategory|escape }}">
<br>
<input type="submit" value="Add">
</form>
</div>
<hr>
<div>
<h3>Select one item you want to remove:</h3>
{% if currentItem %}
<form action="/remove_item" onsubmit="return isOneChecked()" method="post">
{% for item in currentItem %}
<input type="radio" name="remove" value="{{ item.name|escape }}">{{ item.name|escape }}<br>
{% endfor %}
<input type="hidden" name="category_name" value="{{ currentCategory|escape }}">
<input type="submit" value="Delete">
</form>
{% endif %}
</div>
<hr>
<div>
<h3>Select one item you want to rename:</h3>
{% if currentItem %}
<form action="/rename_item" onsubmit="return isOneChecked()" method="post">
{% for item in currentItem2 %}
<input type="radio" name="rename" value="{{ item.name|escape }}">{{ item.name|escape }}<br>
{% endfor %}
<input type="hidden" name="category_name" value="{{ currentCategory|escape }}">
<input type="text" name="new_name">
<input type="submit" value="Rename">
</form>
{% endif %}
</div>
<hr>
<div>
<h3>Export category:</h3>
<form action="/export_category" method="post">
<input type="hidden" name="category_name" value="{{ currentCategory|escape }}">
<input type="submit" name="export" value="Export">
</form>
</div>
<div>
<a href="/">Back to Main Menu</a>
</div>
</body>
</html>