visual_condition_builder 0.1.6 → 2.0.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f82b832c1d6f0be7ab2ad7a6c4d025ba89b27a2c
|
4
|
+
data.tar.gz: a14f601b2bf2d7fef39b8e2382c0ec25f28ec738
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c88f8576de543bcd9a27caabaf5f70e472045d11711bae5d7cd56e0cc17631b9b4a1b1bfce8acef2af470bf1acf53ab51697bf489a267e796838754649b72d74
|
7
|
+
data.tar.gz: 8433a51f5b221621c0b8f0adadf85966010d04d67a16e0885ed214eac8dd79176a3205cec6b65440b7d1d4792adee5dfc803d2365d8384c487e29d2a38d4a4b0
|
data/README.md
CHANGED
@@ -52,11 +52,11 @@
|
|
52
52
|
field_label = Object.values(fieldObj.group)[0] + ' : ' + field_label;
|
53
53
|
}
|
54
54
|
block.append('<input id="field_'+new_id+'" data-group-id="'+new_id+'" type="hidden" class="field form-control" value="' + fieldObj.field + '" data-type="' + fieldObj.type + '" />');
|
55
|
-
block.append('<span id="field_name_'+new_id+'" data-group-id="'+new_id+'" class="field_name
|
56
|
-
block.append('<select id="operators_'+new_id+'" data-group-id="'+new_id+'" class="operators
|
57
|
-
block.append('<span id="fixed_operator_'+new_id+'" data-group-id="'+new_id+'" class="fixed_operator
|
58
|
-
block.append('<select id="values_'+new_id+'" data-group-id="'+new_id+'" class="values
|
59
|
-
block.append('<input id="fixed_value_'+new_id+'" data-group-id="'+new_id+'" class="fixed_value
|
55
|
+
block.append('<span id="field_name_'+new_id+'" data-group-id="'+new_id+'" class="field_name tag tag-info">' + field_label + ' <a href="" id="remove_condition_'+new_id+'" data-group-id="'+new_id+'" class="remove-condition">✖</a></span>');
|
56
|
+
block.append('<select id="operators_'+new_id+'" data-group-id="'+new_id+'" class="operators form-control" style="display: none"></select>');
|
57
|
+
block.append('<span id="fixed_operator_'+new_id+'" data-group-id="'+new_id+'" class="fixed_operator form-control" style="display: none"></span>');
|
58
|
+
block.append('<select id="values_'+new_id+'" data-group-id="'+new_id+'" class="values form-control" style="display: none"></select>');
|
59
|
+
block.append('<input id="fixed_value_'+new_id+'" data-group-id="'+new_id+'" class="fixed_value form-control" style="display: none" />');
|
60
60
|
if (plugin.parameters.debug == true) {
|
61
61
|
block.append('<p class="expression help-block"></p>');
|
62
62
|
}
|
@@ -96,10 +96,10 @@
|
|
96
96
|
var operators = field.operators;
|
97
97
|
|
98
98
|
remove_plugins_elements(groupConditionId);
|
99
|
-
$operators.html('').
|
100
|
-
$fixedOperator.val('').
|
101
|
-
$values.html('').
|
102
|
-
$fixedValue.val('').
|
99
|
+
$operators.html('').hide();
|
100
|
+
$fixedOperator.val('').hide();
|
101
|
+
$values.html('').hide();
|
102
|
+
$fixedValue.val('').hide();
|
103
103
|
|
104
104
|
operators = normalize_operators(operators);
|
105
105
|
$.each(operators, function (op_i, op_el) {
|
@@ -107,9 +107,9 @@
|
|
107
107
|
$operators.append(op_option);
|
108
108
|
});
|
109
109
|
if (operators != undefined && operators.length == 1) {
|
110
|
-
$fixedOperator.html(getLabel(operators[0])).
|
110
|
+
$fixedOperator.html(getLabel(operators[0])).show();
|
111
111
|
} else {
|
112
|
-
$operators.
|
112
|
+
$operators.show();
|
113
113
|
}
|
114
114
|
$operators.trigger('change');
|
115
115
|
};
|
@@ -243,7 +243,7 @@
|
|
243
243
|
|
244
244
|
var getValueElement = function (groupConditions) {
|
245
245
|
var element = $(groupConditions).find('.values');
|
246
|
-
if (element.
|
246
|
+
if (element.is(":hidden")) {
|
247
247
|
element = $(groupConditions).find('.fixed_value');
|
248
248
|
}
|
249
249
|
return element;
|
@@ -321,8 +321,10 @@
|
|
321
321
|
$.each(plugin.parameters.values, function (i, data) {
|
322
322
|
var field = data[0];
|
323
323
|
var groupConditions = plugin.add_condition(field);
|
324
|
-
|
325
|
-
|
324
|
+
if (!is_blank(groupConditions)) {
|
325
|
+
var groupConditionId = groupConditions.attr('data-id');
|
326
|
+
plugin.fill_condition(groupConditionId, data);
|
327
|
+
}
|
326
328
|
});
|
327
329
|
}
|
328
330
|
};
|
@@ -334,8 +336,8 @@
|
|
334
336
|
var $fixedValue = $groupConditions.find('.fixed_value');
|
335
337
|
var multiple = op_el.attr('data-multiple');
|
336
338
|
multiple = (multiple == 'true' ? 'true' : 'false');
|
337
|
-
$values.html('').removeAttr('data-ajax-values').
|
338
|
-
$fixedValue.removeAttr('data-ajax-values').
|
339
|
+
$values.html('').removeAttr('data-ajax-values').hide();
|
340
|
+
$fixedValue.removeAttr('data-ajax-values').hide();
|
339
341
|
|
340
342
|
if (typeof values === 'string') {
|
341
343
|
$values.attr('data-ajax-values', values);
|
@@ -360,14 +362,14 @@
|
|
360
362
|
}
|
361
363
|
$values.append('<option data-index="' + val_i + '" value="' + _id + '">' + _label + '</option>');
|
362
364
|
});
|
363
|
-
$values.
|
365
|
+
$values.show();
|
364
366
|
$values.trigger('change');
|
365
367
|
} else {
|
366
368
|
if (multiple == 'true') {
|
367
|
-
$values.
|
369
|
+
$values.show();
|
368
370
|
$values.trigger('change');
|
369
371
|
} else {
|
370
|
-
$fixedValue.
|
372
|
+
$fixedValue.show();
|
371
373
|
$fixedValue.trigger('change');
|
372
374
|
}
|
373
375
|
}
|
@@ -391,7 +393,7 @@
|
|
391
393
|
if (!isNaN(multiple)) {
|
392
394
|
for (var i = 1; i < parseInt(multiple); i++) {
|
393
395
|
var $valueElClone = $valueEl.clone();
|
394
|
-
$valueElClone.addClass('clone').
|
396
|
+
$valueElClone.addClass('clone').show();
|
395
397
|
$valueElClone.insertAfter($valueEl);
|
396
398
|
}
|
397
399
|
} else {
|
@@ -467,7 +469,7 @@
|
|
467
469
|
console.log(field_name, uTypeField);
|
468
470
|
$el.parent().append('<i class="type_field" style="font-size: 10px; color: #ccc;"><br>' + uTypeField + '</i>');
|
469
471
|
}
|
470
|
-
if (($el.hasClass('values') &&
|
472
|
+
if (($el.hasClass('values') && $el.is(":visible"))) {
|
471
473
|
// build_select2_element($el, (!list_with_item && multiple == 'true'));
|
472
474
|
build_select2_element($el);
|
473
475
|
}
|
@@ -34,7 +34,7 @@ txtjs
|
|
34
34
|
concat(I18n.t(:dropdown, default: ['Fields'], scope: [:condition_builder]))
|
35
35
|
concat(content_tag(:span, nil, class:'caret'))
|
36
36
|
end)
|
37
|
-
concat(content_tag(:
|
37
|
+
concat(content_tag(:div, class: 'dropdown-menu add-condition-menu') do
|
38
38
|
create_conditions_fields_item(dictionary_klass.fields(get_dictionary_context(dictionary)))
|
39
39
|
end)
|
40
40
|
end
|
@@ -46,10 +46,10 @@ txtjs
|
|
46
46
|
fields.each do |field, attrs|
|
47
47
|
if field.is_a?(Hash) #GROUP
|
48
48
|
group_label = field.values.first
|
49
|
-
concat(content_tag(:
|
49
|
+
concat(content_tag(:h6, group_label, class: 'dropdown-header'))
|
50
50
|
create_conditions_fields_item(attrs)
|
51
51
|
else
|
52
|
-
concat(
|
52
|
+
concat(link_to(attrs[:label], 'javascript:void(0)', class: 'dropdown-item add-condition-field', data: {field: field}))
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|