-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSpecRunner.html
199 lines (191 loc) · 9.15 KB
/
SpecRunner.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Qunit tests</title>
<link rel="stylesheet" type="text/css" href="dist/jquery.wquerybuilder.css">
<link rel="stylesheet" type="text/css" href="lib/qunit-1.14.0.css">
</head>
<body>
<!-------------------------------------------------------------------------------->
<!-- And here is where the magic happens, use it like a theme on your-self page -->
<!-------------------------------------------------------------------------------->
<div id="querybuilder">
<div class="wquerybuilder wcol-12">
<div class="wcol wcol-3">
<fieldset>
<legend>Tables</legend>
<select size="22" name="wtables"></select>
</fieldset>
</div>
<div class="wcol wcol-3">
<fieldset>
<legend>Columns</legend>
<select size="22" name="wcolumns" multiple="multiple"></select>
</fieldset>
</div>
<div class="wcol wcol-6">
<div class="wcol wcol-6">
<fieldset>
<legend>Display the first</legend>
<input type="number" name="wtop" value="1000"/><br /><br />
<input type="button" value="Set limit" name="wsettop" />
<input type="button" value="Clear limit" name="wcleartop" />
</fieldset>
</div>
<div class="wcol wcol-6">
<fieldset>
<legend>Order by</legend>
<select name="worderby"></select><br />
<input type="radio" name="worderbytype" id="wasc" value="true" checked="checked" /> <label for="wasc">Ascending</label> <br />
<input type="radio" name="worderbytype" id="wdesc" value="false" /> <label for="wdesc">Descending</label>
</fieldset>
</div>
</div>
<div class="wcol wcol-6">
<fieldset>
<legend>Group by</legend>
<select name="wgroupby"></select><br />
</fieldset>
</div>
<div class="wcol wcol-6">
<fieldset>
<legend>Spare column</legend>
<div class="wcol wcol-12">
<div class="wcol wcol-6">
<div class="wcol wcol-12">
<label>Column name</label><br />
<input type="text" placeholder="Column name" name="wsparename" />
</div>
<div class="wcol wcol-12">
<br />
<label>Column content</label>
<select name="wcolumncontent"></select>
</div>
<div class="wcol wcol-12">
<br />
<label>Aggregate functions</label>
<select name="waggregate">
<option></option>
<option value="DAY">Day</option>
<option value="MONTH">Month</option>
<option value="YEAR">Year</option>
<option value="FORMAT" data-format="yyyy/mm/dd">Date</option>
<option value="FORMAT" data-format="yyyy/mm">Year/Month</option>
<option value="COUNT">Count</option>
<option value="SUM">Sum</option>
<option value="AVERAGE">Average</option>
</select>
</div>
<div class="wcol wcol-12">
<br />
<input type="button" value="Create column" name="wcreatespare" />
</div>
</div>
<div class="wcol wcol-6">
<fieldset class="winvisible">
<div class="wcol wcol-12">
<label>Created spare columns</label>
<select size="8" name="wspares" multiple="multiple"></select>
</div>
<div class="wcol wcol-12">
<br />
<input type="button" value="Delete column" name="wdeletespare" />
<input type="button" value="Delete all" name="wdeleteallspare" class="fr" />
</div>
</fieldset>
</div>
</div>
</fieldset>
</div>
<div class="wcol wcol-12">
<fieldset>
<legend>Union tables</legend>
<div class="wcol wcol-6">
<fieldset class="winvisible">
<label>First column</label>
<select name="wfirstcolumnunion"></select>
</fieldset>
</div>
<div class="wcol wcol-6">
<fieldset class="winvisible">
<label>Second column</label>
<select name="wsecondcolumnunion"></select>
</fieldset>
</div>
<div class="wcol wcol-12">
<br />
<input type="button" value="Create" name="wcreateunion" />
<input type="button" value="Delete all" name="wdeleteallunion" />
</div>
</fieldset>
</div>
<div class="wcol wcol-12">
<fieldset>
<legend>Filter of records</legend>
<div class="wcol wcol-5">
<fieldset class="winvisible">
<label>Column</label>
<select name="wcolumnfilter"></select>
</fieldset>
</div>
<div class="wcol wcol-2">
<fieldset class="winvisible">
<label>Operator</label>
<select name="woperator">
<option></option>
<option>=</option>
<option><></option>
<option>></option>
<option>>=</option>
<option><</option>
<option><=</option>
<option>$</option>
<option>!$</option>
</select>
</fieldset>
</div>
<div class="wcol wcol-5">
<fieldset class="winvisible">
<label>Value</label><br>
<input type="text" name="wvaluefilter" /><br />
</fieldset>
</div>
<div class="wcol wcol-12">
<br />
<input type="button" value="Create" name="wcreatefilter" />
<input type="button" value="Delete all" name="wdeletefilter" />
</div>
</fieldset>
</div>
<div class="wcol wcol-12">
<fieldset>
<legend>SQL Result</legend>
<input type="button" value="Clear all" name="wclearall" />
<textarea rows="8" disabled= disabled name="wresult">Result of created query</textarea>
</fieldset>
</div>
<div style="clear:both;"></div>
</div>
</div>
<!----------------------- /And here is where the magic ends ---------------------->
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="lib/qunit-1.14.0.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="dist/squel.min.js"></script>
<script type="text/javascript" src="dist/jquery.wquerybuilder.js"></script>
<script type="text/javascript" src="spec/jquery.wquerybuilder.spec.js"></script>
<script>
// Calling query builder
$(function () {
var obj = {
Users: ["Id", "FullName", "Username", "Email", "Location", "Country", "ZIP", "Phone"],
Products: ["Id", "Name", "Type", "Weight", "Size", "Factory", "Height", "Area"],
Storage: ["ProductId", "Qtd"],
};
$("#querybuilder").wquerybuilder({ data: obj });
});
</script>
</body>
</html>