/
edit_four.html
70 lines (61 loc) · 1.96 KB
/
edit_four.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
{% extends "lifeflow/editor/base.html" %}
{% block body %}
<div class="breadcrumbs">
<span> <a href="../1/">Title & Summary</a> </span>
<span> <a href="../2">Body & Files</a> </span>
<span> <a href="../3/">Flows</a> </span>
<span class="selected">Tags </span>
<span> <a href="../5/">Series</a> </span>
<span> <a href="../6/">Date & Options</a> </span>
<span> <a href="../7/">Authors & Translations</a> </span>
</div>
<script>
$(document).ready(function() {
$("a.selectable").click(function () {
$(this).toggleClass("selected");
});
$("#select-list").hover(
function() {},
function() {
var selected = $.map($("a.selected"),function(x) { return x.id; });
if (selected.length == 0) selected.push(-1);
var data = { "tags":selected };
update_model("{{model}}",{{ object.pk }}, data);
});
});
var delete_tag = function(pk) {
delete_model("tag",pk);
var id = "#tag_" + pk;
$(id).fadeOut('slow');
$("#select_" + pk).fadeOut('slow');
}
</script>
<div class="editing">
<ul>
<li id="select-list">
<p> Click on the tags to associate with this article. </p>
<div id="selectables" class="selectables">
{% for tag, selected in tags %}
<a id="select_{{ tag.pk}}" class="selectable {% if selected %} selected{% endif %}" id="{{ tag.pk }}"> {{ tag.title }}</a>
{% endfor %}
</div>
</li>
<li>
<form method="post" action="/editor/create_model/">
<table>
<tr><td><p> Create a new tag. </p></td></tr>
<tr><td>Title: </td><td><input name="title"></td></tr>
<input type="hidden" value="tag" name="model">
<tr><td></td><td><button type="submit" class="button positive"> Create </button></td></tr>
</table>
</form>
</li>
<li>
<p> Delete unnecessary tags. </p>
{% for tag, selected in tags %}
<a id="tag_{{ tag.pk}}" class="button negative" onclick="delete_tag({{ tag.pk }})"> Delete "{{ tag }}" </a>
{% endfor %}
</li>
</ul>
</div>
{% endblock %}