Fix broken js on empty search configuration
This commit is contained in:
parent
ab6e02cc5e
commit
a851764012
1 changed files with 78 additions and 43 deletions
|
@ -22,7 +22,8 @@
|
|||
<script src="themes/iph/js/query-builder.ru.js"></script>
|
||||
<script>
|
||||
var rules_example =
|
||||
{
|
||||
<#if searchFields?has_content>
|
||||
{
|
||||
"condition": "AND",
|
||||
"rules": [
|
||||
{
|
||||
|
@ -56,7 +57,23 @@
|
|||
}
|
||||
],
|
||||
"valid": true
|
||||
};
|
||||
};
|
||||
<#else>
|
||||
{
|
||||
"condition": "AND",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ALLTEXT",
|
||||
"field": "everywhere",
|
||||
"type": "string",
|
||||
"input": "text",
|
||||
"operator": "contains",
|
||||
"value": "publication"
|
||||
}
|
||||
],
|
||||
"valid": true
|
||||
};
|
||||
</#if>
|
||||
var rules_start;
|
||||
if (localStorage.getItem('queryBuilderFormSaved') === true || localStorage.getItem('queryBuilderFormSaved') === 'true') {
|
||||
rules_start = JSON.parse(localStorage.getItem('queryBuilderForm'));
|
||||
|
@ -66,6 +83,7 @@
|
|||
|
||||
$('#builder').queryBuilder({
|
||||
filters: [
|
||||
<#if searchFields?has_content>
|
||||
<#list searchFields as field>
|
||||
<#if field.hasFilters == "true">
|
||||
<@multivalueField field=field />
|
||||
|
@ -73,6 +91,14 @@
|
|||
<@freeField field=field />
|
||||
</#if>
|
||||
</#list>
|
||||
<#else>
|
||||
{
|
||||
id: 'ALLTEXT',
|
||||
label: 'Everywhere',
|
||||
type: 'string',
|
||||
operators: ['contains', 'not_contains']
|
||||
},
|
||||
</#if>
|
||||
|
||||
],
|
||||
lang_code: 'ru',
|
||||
|
@ -162,12 +188,21 @@
|
|||
type: 'string',
|
||||
input: 'select',
|
||||
values: {
|
||||
|
||||
<#if searchFields??>
|
||||
<#list searchFilters as filter>
|
||||
<#if filter.field == field.field>
|
||||
'"${filter.id}"':'${filter.name}',
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
<#else>
|
||||
{
|
||||
id: 'ALLTEXT',
|
||||
label: 'Everywhere',
|
||||
type: 'string',
|
||||
operators: ['contains', 'not_contains']
|
||||
},
|
||||
</#if>
|
||||
},
|
||||
operators: ['contains', 'not_contains']
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue