-
Notifications
You must be signed in to change notification settings - Fork 3
/
search_panel.qtpl
47 lines (46 loc) · 1.82 KB
/
search_panel.qtpl
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
{% code
type SearchPanel struct {
action string
counter int
labelButton string
placeholder string
suggestions string
showObject string
}
func NewSearchPanel(action, suggestions, showObject, labelButton, placeholder string, counter int) *SearchPanel {
if placeholder == "" {
placeholder = "Smart search"
}
return &SearchPanel{
action,
counter,
labelButton,
placeholder,
suggestions,
showObject,
}
}
%}
{%- func (s *SearchPanel) Render() -%}
<form id="fSearch" action="{%s s.action %}" method="GET" target="#content"
onsubmit="return saveForm(this, {%s s.showObject %}, function(error, status) { $('#content').html(error.responseText); } );">
<input type="hidden" name="html" value=true />
<input type="hidden" name="counter" value={%d s.counter %} />
<input id="inpS" name="name" type="search" placeholder="{%s= s.placeholder %}" required
autocapitalize="none" autocorrect="off" autocomplete="off" autofocus=true
{%- if s.suggestions > "" -%}
src="{%s s.suggestions %}" data="search-name" onkeyup="return inputSearchKeyUp(this,event,true);"
{%- endif -%}/>
{%- if s.labelButton > "" -%}
<button type="submit"><i class="fa fa-search">{%s= s.labelButton %}</i></button>
{%- endif -%}
<output></output>
{%- if s.suggestions > "" -%}
<div class="suggestions-wrapper">
<span class="suggestions-addon" data-addon-type="spinner"></span>
<select name="id" size=10 class="suggestions-constraints suggestions-select-hide search-name" data-placeholder="search-name"></select>
<div class="suggestions-suggestions"></div>
</div>
{%- endif -%}
</form>
{% endfunc %}