blob: 25d8b32b9ec8061a5110a3071b9fe3e5ab47117d (
plain)
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
|
{% load i18n %}<div class="input-group search-widget">
<input type="{{ widget.type }}" name="{{ widget.name }}"
{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
<span class="input-group-append">
<span class="input-group-text input-link"
title="{% trans 'Search' %}"
id="submit-search">
<i class="fa fa-search" aria-hidden="true"></i>
</span>
<button type="button" class="input-group-text input-link" data-toggle="modal"
data-target="#modal-advanced-search"
title="{% trans 'Criteria' %}">
<i class="fa fa-cogs" aria-hidden="true"></i>
</button>
<span class="input-group-text input-link disabled"
id="clear-search-button"
title="{% trans 'Clear' %}">
<i class="fa fa-times" aria-hidden="true"></i>
</span>
<span class="input-group-text input-sep">
</span>
<a class="input-group-text input-link async-link disabled"
id="save-search-button"
data-target="#modal-dynamic-form"
data-modal-open="#modal-dynamic-form"
title="{% trans 'Bookmark this search' %}"
href="{% url 'save-search-query' app_name model %}">
<i class="fa fa-star-o" aria-hidden="true"></i>
</a>
<span class="input-group-text input-link dropdown-toggle"
data-toggle="dropdown"
title="{% trans 'Bookmarks' %}"
id="load-bookmark">
<i class="fa fa-bookmark" aria-hidden="true"></i>
</span>
<div class="dropdown-menu" id="bookmark-list">
</div>
</span>
</div>
<script type="text/javascript">
var bookmark_url = "{% url 'bookmark-list' app_name model %}";
$(document).ready(function(){
$(".search-widget input").keypress(function(e) {
var key = e.key;
if (key === "Enter") {
$(".search_button").click();
$(this).focus();
e.stopPropagation();
return false;
} else {
$("#id_search_vector").addClass('input-progress');
}
if (key === "Escape") {
$("#clear-search-button").click();
$(this).focus();
}
});
$(".search-widget input").keyup(function(e) {
enable_save();
});
enable_save();
load_bookmark_list();
});
</script>
|