blob: 0083db54b3b09c1e07e47c678d2e523a642ce5cf (
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
{% 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 bg-primary text-white"
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>
<span class="input-group-text input-link"
id="pin-search-button"
data-item-type="{{pin_model}}"
title="{% trans 'Pin the current search' %}">
<i class="fa fa-thumb-tack" aria-hidden="true"></i>
</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 pin_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 pin_model %}";
if (typeof enable_save == "undefined") {
enable_save = function(){};
}
if (typeof load_bookmark_list == "undefined") {
load_bookmark_list = function(){};
}
$(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>
|