visual_condition_builder 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3eccce1ce50046d5d3068dff5fab9d47aec22e5
4
- data.tar.gz: 3fa60cbf902a7ae3672d9db5c3a3174f887c5a20
3
+ metadata.gz: 95f4cbff7a8a8d97381f43c3824224b75a8b21e8
4
+ data.tar.gz: 20d29c136d3e7611004f7cd795a11dd994fd4186
5
5
  SHA512:
6
- metadata.gz: df6385f9f9eae40875d0e2a95dc99ca28ecc485c2b62a3ede4b08b839da1a511adfe0ae1acde0835c7c99e0e474c6ebfca8352af9d2bbacffdb4339b32667b25
7
- data.tar.gz: eac30cf124a32d36b6399bde28a832168fb32150be4a1a979184c5a22a6cb89ecb8c21002e88ad38a7b003309db32af5aeba6d785b0a8542d32a25363fd6dbb4
6
+ metadata.gz: da0c65aee9a1c0021e884f6600d5a9518cb415285ce6ed581ce747572b6bc1e09b52e9b138118ffa33fcb5a98e83ddf409dc59c2538201f268586a004b48df0e
7
+ data.tar.gz: aae2bf4bec11d2b0cc86b743820164c5db16073fc07b72e9f39403564c43ebf2459b10d3fec2ae5d81cef6e8b2725091d6e62db933bb02168bfbccc729e87b8a
@@ -194,9 +194,14 @@
194
194
  var field_name = getFieldValue(groupConditions);
195
195
  var operator = getOperator(groupConditions);
196
196
  var value = getValue(groupConditions);
197
+ var showValue = getValueElement(groupConditions).is(':visible');
197
198
 
198
- if (!is_blank(field_name) && !is_blank(operator) && !is_blank(value)) {
199
+ console.log(field_name, operator, value, showValue);
200
+
201
+ if (!is_blank(field_name) && !is_blank(operator) && showValue && !is_blank(value)) {
199
202
  data.push([field_name, operator, value]);
203
+ } else if (!is_blank(field_name) && !is_blank(operator) && !showValue) { //FIELD AND OPERATOR
204
+ data.push([field_name, operator]);
200
205
  } else if (!is_blank(field_name) && operator == '' && is_blank(value)) { //FIELD ONLY
201
206
  data.push(field_name);
202
207
  }
@@ -367,17 +372,22 @@
367
372
  var $listUl = $('<ul class="list-unstyled"></ul>');
368
373
  $.each(plugin.parameters.values, function (i, data) {
369
374
  var fieldObj, operatorObj;
370
- if (typeof data == 'object') { //ONLY FIELD
375
+ if (typeof data == 'string') { //FIELD ONLY
376
+ fieldObj = getFieldByName(data);
377
+ } else {
371
378
  fieldObj = getFieldByName(data[0]);
372
379
  operatorObj = getOperatorFromField(data[1], fieldObj.operators);
373
- } else {
374
- fieldObj = getFieldByName(data);
380
+ console.log(data, operatorObj)
375
381
  }
382
+
383
+ //RENDER
376
384
  var $listItem = $('<li></li>');
377
385
  $listItem.append('<span class="pr-2">' + getLabel(fieldObj) + '</span>');
378
386
  if (!is_blank(operatorObj)) {
379
387
  $listItem.append('<span class="pr-2">' + getLabel(operatorObj) + '</span>');
380
- $listItem.append('<span class="">' + data[2] + '</span>');
388
+ if (typeof data[2] != 'undefined') {
389
+ $listItem.append('<span class="">' + data[2] + '</span>');
390
+ }
381
391
  }
382
392
  $listItem.appendTo($listUl);
383
393
  });
@@ -390,7 +400,7 @@
390
400
  if (!is_blank(plugin.parameters.values) && plugin.parameters.values.length > 0) {
391
401
  $.each(plugin.parameters.values, function (i, data) {
392
402
  var field, operator;
393
- if (typeof data == 'object') { //ONLY FIELD
403
+ if (typeof data == 'object') { //FIELD ONLY
394
404
  field = data[0];
395
405
  operator = data[1];
396
406
  } else {
@@ -1,3 +1,3 @@
1
1
  module VisualConditionBuilder
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visual_condition_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Porto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails