Permalink
Browse files

fix(project): use an object as parameter for generateFields

BREAKING CHANGE: it’s now expecting an object as second parameter for the function generateFields.
  • Loading branch information...
jeremyvergnas committed Jan 27, 2017
1 parent 91a6709 commit 33be1659384073ea6b6cee3587917506ae5b42f7
Showing with 33 additions and 33 deletions.
  1. +30 −30 src/bootstrap/filter.html
  2. +3 −3 src/filter.js
@@ -5,28 +5,28 @@
<div class="col-md-12">
<div class="col-md-4">
<form-field
change.delegate="onChange($parent.$index, $index) & debounce:200"
value.bind="field.data.field"
element.bind="field.field">
change.delegate="onChange($parent.$index, $index) & debounce:200"
value.bind="field.data.field"
element.bind="field.field">
</form-field>
</div>

<div class="col-md-4">
<form-field
change.delegate="onChange($parent.$index, $index) & debounce:200"
value.bind="field.data.operator"
element.bind="field.operator">
change.delegate="onChange($parent.$index, $index) & debounce:200"
value.bind="field.data.operator"
element.bind="field.operator">
</form-field>
</div>

<div class="col-md-4">
<div class="input-group">
<div class="${field.data.hasError ? 'has-error' : ''}">
<form-field
if.bind="field.value.type !== 'select'"
keypress.delegate="onChange($parent.$index, $index, true) & debounce:50"
value.bind="field.data.value"
element.bind="field.value">
if.bind="field.value.type !== 'select'"
keypress.delegate="onChange($parent.$index, $index, true) & debounce:50"
value.bind="field.data.value"
element.bind="field.value">
</form-field>
<form-field
change.delegate="onChange($parent.$index, $index, true) & debounce:50"
@@ -38,16 +38,16 @@

<div class="input-group-btn">
<button
class="btn btn-primary add-filter "
if.bind="$last"
click.delegate="create($parent.$index)"
t="${$first ? '+ And' : '+'}">+
class="btn btn-primary add-filter "
if.bind="$last"
click.delegate="create($parent.$index)"
t="${$first ? '+ And' : '+'}">+
</button>
<button
class="btn btn-danger remove-filter"
if.bind="filter.length > 1"
click.delegate="destroy($parent.$index, $index)"
t="${$first ? '- And' : '-'}">-
class="btn btn-danger remove-filter"
if.bind="filter.length > 1"
click.delegate="destroy($parent.$index, $index)"
t="${$first ? '- And' : '-'}">-
</button>
</div>
</div>
@@ -65,10 +65,10 @@

<div class="col-md-4" style="margin-bottom: 15px;">
<form-field
if.bind="field.value.type !== 'select'"
keypress.delegate="onChange($parent.$index, $index, true) & debounce:500"
value.bind="field.data.between"
element.bind="field.value">
if.bind="field.value.type !== 'select'"
keypress.delegate="onChange($parent.$index, $index, true) & debounce:500"
value.bind="field.data.between"
element.bind="field.value">
</form-field>
<form-field
change.delegate="onChange($parent.$index, $index, true) & debounce:500"
@@ -84,16 +84,16 @@
<div class="col-md-offset-4 col-md-4">
<div class="btn-group btn-group btn-group-justified">
<a
class="btn btn-primary add-block btn-sm"
if.bind="$last"
click.delegate="create()"
t="+ Or">+
class="btn btn-primary add-block btn-sm"
if.bind="$last"
click.delegate="create()"
t="+ Or">+
</a>
<a
class="btn btn-danger remove-block btn-sm"
if.bind="filters.length > 1"
click.delegate="destroy($index)"
t="- Or">-;
class="btn btn-danger remove-block btn-sm"
if.bind="filters.length > 1"
click.delegate="destroy($index)"
t="- Or">-;
</a>
</div>
</div>
@@ -240,7 +240,7 @@ export class Filter extends CriteriaBuilder {
columns = this.entity.asObject();
}

this.generateFields(columns, null, metaData);
this.generateFields(columns, {metaData});

if (Object.keys(metaData.associations).length < 1) {
return;
@@ -266,11 +266,11 @@ export class Filter extends CriteriaBuilder {
continue;
}

this.generateFields(repoData, entityName);
this.generateFields(repoData, {entityName});
}
}

generateFields(columns, entityName, metaData) {
generateFields(columns, {entityName, metaData} = {}) {
let excludeColumns = (this.excludeColumns) ? this.excludeColumns.replace(/\s/g, '').split(',') : [];

if (this.showIdColumns) {

0 comments on commit 33be165

Please sign in to comment.