forked from tzuryby/bangbang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
232 lines (221 loc) · 8.12 KB
/
demo.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bang Bang</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="assets/js/jquery.bangbang.js"></script>
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="assets/css/jquery.bangbang.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="content">
<div class="row">
<div class="span12">
<br><br>
<blockquote>
<p class="lead">Bang Bang</p>
<em>jQuery plugin to handle multiple tagged input.</em>
</blockquote>
</div>
</div>
<div class="row">
<div class="span12">
<br><br>
<form accept-charset="UTF-8" class="form-search" id="form" method="get">
<div class="alert alert-block">
<h4>Instructions</h4>
<br>
Start by typing <strong>!</strong> Then selecting a command to search by from the list using your arrow keys or typing the full command and hitting space. <br> For more help click the Advanced Search Help Link below.
</div>
<div class="bang_control">
<input autocomplete="off" class="none" id="search_txt" name="search" type="search" value="">
</div>
<br><br>
<input type="button" class="pull-right btn btn-primary" id="search_button" value="Searchy"/>
<br><br>
<a href="" class="help_link">Advanced Search Help</a>
<br><br>
<div class="span11 help" style="display:none">
<div class="well">
<table class="table">
<thead>
<tr>
<th>Search by</th>
<th>Command</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>First name</td>
<td>!fn</td>
<td>!fn John</td>
</tr>
<tr>
<td>Last name</td>
<td>!ln</td>
<td>!ln Smith</td>
</tr>
<tr>
<td>User with Email</td>
<td>!email</td>
<td>!email jsmith@email.com</td>
</tr>
<tr>
<td>User with Username</td>
<td>!username</td>
<td>!username jsmith</td>
</tr>
<tr>
<td>Address</td>
<td>!addr</td>
<td>!addr 1234 2nd ST.</td>
</tr>
<tr>
<td>Address Two</td>
<td>!addr2</td>
<td>!addr2 Apt. 1234.</td>
</tr>
<tr>
<td>City</td>
<td>!city</td>
<td>!city Urbandale</td>
</tr>
<tr>
<td>State</td>
<td>!state</td>
<td>!state IA</td>
</tr>
<tr>
<td>Zip</td>
<td>!zip</td>
<td>!zip 50169</td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div class="span12">
<h4>What is this?</h4>
Bang Bang is a way to group inputs on a single input field.
It's sort of like how tags work except differently. It was
originally written for our advanced search functionality.
The goal was a simple way to provide our support team with
a fast way to search for information and not have them click
a bunch of buttons, and checkboxes to filter their search
criteria.
<br><br>
<h4>Why is it called Bang Bang?</h4>
Because of the exclamation point ! is what triggers the
commands.
<br><br>
<h4>Does it work with bootstrap?</h4>
Yes, it should work with version 2.2.1
<br><br>
<h4>How does it work?</h4>
When you type ! followed by the command, a new text input
field is added to the form with the name of the command. It
doesn't look like it from the UI but it happens behind the
scenes.
You can call the jquery plugin with a list of tags like
this:<br><br>
<pre><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bang Bang</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="http://willywos.github.com/bangbang/jquery.bangbang.css" rel="stylesheet">
<script src="http://willywos.github.com/bangbang/jquery.bangbang.js"></script>
</head>
<body>
<form accept-charset="UTF-8" class="form-search" id="form" method="get">
<div class="bang_control">
<input autocomplete="off" class="none" id="search_txt" name="search" type="search" value="">
</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
$(".help_link").click(function(e) {
e.preventDefault();
$(".help").slideToggle();
});
var tags = [
"idnumber",
"f_name",
"m_name",
"l_name",
"gender",
"test1",
"test2"
];
var tagsTitles = [
"ID Number",
"First name",
"Middle name",
"Last name",
"Gender",
"Long tag test 1",
"Long tag test 2"
];
$("#search_txt").bang({ tags: tags, tagsTitles: tagsTitles });
$("#search_button").click(function(e) {
e.preventDefault();
$("#form").submit();
});
});
</script>
</body>
</html></pre>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$(".help_link").click(function(e) {
e.preventDefault();
$(".help").slideToggle();
});
var tags = [
"idnumber",
"f_name",
"m_name",
"l_name",
"gender",
"test1",
"test2"
];
var tagsTitles = [
"ID Number",
"First name",
"Middle name",
"Last name",
"Gender",
"Long tag test 1",
"Long tag test 2"
];
$("#search_txt").bang({ tags: tags, tagsTitles: tagsTitles });
$("#search_button").click(function(e) {
e.preventDefault();
$("#form").submit();
});
});
</script>
</body>
</html>