Skip to content

Commit 12450e1

Browse files
committed
Close #603 Add support for filter icons (via plugin)
1 parent 1e6194c commit 12450e1

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

examples/index.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ <h3>Output</h3>
168168
'bt-tooltip-errors': { delay: 100 },
169169
'sortable': null,
170170
'filter-description': { mode: 'bootbox' },
171-
// 'bt-selectpicker': null,
172-
'chosen-selectpicker': null,
171+
'bt-selectpicker': null,
172+
// 'chosen-selectpicker': null,
173173
'unique-filter': null,
174174
'bt-checkbox': { color: 'primary' },
175175
'invert': null,
@@ -211,6 +211,7 @@ <h3>Output</h3>
211211
en: 'Name',
212212
fr: 'Nom'
213213
},
214+
icon: 'glyphicon glyphicon-user',
214215
value_separator: ',',
215216
type: 'string',
216217
optgroup: 'core',
@@ -227,6 +228,7 @@ <h3>Output</h3>
227228
{
228229
id: 'age',
229230
label: 'Age',
231+
icon: 'glyphicon glyphicon-calendar',
230232
type: 'integer',
231233
input: 'text',
232234
value_separator: '|',
@@ -243,6 +245,7 @@ <h3>Output</h3>
243245
{
244246
id: 'bson',
245247
label: 'BSON',
248+
icon: 'glyphicon glyphicon-qrcode',
246249
type: 'string',
247250
input: 'textarea',
248251
operators: ['equal'],
@@ -255,6 +258,7 @@ <h3>Output</h3>
255258
{
256259
id: 'category',
257260
label: 'Category',
261+
icon: 'glyphicon glyphicon-th-list',
258262
type: 'integer',
259263
input: 'checkbox',
260264
optgroup: 'core',
@@ -280,6 +284,7 @@ <h3>Output</h3>
280284
{
281285
id: 'continent',
282286
label: 'Continent',
287+
icon: 'glyphicon glyphicon-globe',
283288
type: 'string',
284289
input: 'select',
285290
optgroup: 'core',
@@ -328,6 +333,7 @@ <h3>Output</h3>
328333
{
329334
id: 'state',
330335
label: 'State',
336+
icon: 'glyphicon glyphicon-globe',
331337
type: 'string',
332338
input: 'select',
333339
multiple: true,
@@ -363,6 +369,7 @@ <h3>Output</h3>
363369
{
364370
id: 'in_stock',
365371
label: 'In stock',
372+
icon: 'glyphicon glyphicon-log-in',
366373
type: 'integer',
367374
input: 'radio',
368375
optgroup: 'plugin',
@@ -378,6 +385,7 @@ <h3>Output</h3>
378385
{
379386
id: 'price',
380387
label: 'Price',
388+
icon: 'glyphicon glyphicon-usd',
381389
type: 'double',
382390
size: 5,
383391
validation: {
@@ -394,6 +402,7 @@ <h3>Output</h3>
394402
{
395403
id: 'rate',
396404
label: 'Rate',
405+
icon: 'glyphicon glyphicon-flash',
397406
type: 'integer',
398407
validation: {
399408
min: 0,
@@ -417,6 +426,7 @@ <h3>Output</h3>
417426
{
418427
id: 'id',
419428
label: 'Identifier',
429+
icon: 'glyphicon glyphicon-sunglasses',
420430
type: 'string',
421431
optgroup: 'plugin',
422432
placeholder: '____-____-____',
@@ -435,6 +445,7 @@ <h3>Output</h3>
435445
{
436446
id: 'coord',
437447
label: 'Coordinates',
448+
icon: 'glyphicon glyphicon-star-empty',
438449
type: 'string',
439450
default_value: 'C.5',
440451
description: 'The letter is the cadran identifier:\

src/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ QueryBuilder.templates.filterSelect = '\
6262
<optgroup label="{{= it.translate(it.settings.optgroups[optgroup]) }}"> \
6363
{{?}} \
6464
{{?}} \
65-
<option value="{{= filter.id }}">{{= it.translate(filter.label) }}</option> \
65+
<option value="{{= filter.id }}" {{? filter.icon}}data-icon="{{= filter.icon}}"{{?}}>{{= it.translate(filter.label) }}</option> \
6666
{{~}} \
6767
{{? optgroup !== null }}</optgroup>{{?}} \
6868
</select>';
@@ -82,7 +82,7 @@ QueryBuilder.templates.operatorSelect = '\
8282
<optgroup label="{{= it.translate(it.settings.optgroups[optgroup]) }}"> \
8383
{{?}} \
8484
{{?}} \
85-
<option value="{{= operator.type }}">{{= it.translate("operators", operator.type) }}</option> \
85+
<option value="{{= operator.type }}" {{? operator.icon}}data-icon="{{= operator.icon}}"{{?}}>{{= it.translate("operators", operator.type) }}</option> \
8686
{{~}} \
8787
{{? optgroup !== null }}</optgroup>{{?}} \
8888
</select>';

0 commit comments

Comments
 (0)