visual_condition_builder 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/visual_condition_builder/condition_builder.js +2 -2
- data/app/helpers/visual_condition_builder/application_helper.rb +1 -21
- data/app/views/visual_condition_builder/_builder_conditions.html.erb +6 -0
- data/lib/visual_condition_builder/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 258bcbf53cb35fa5811d80ab924d2a5a08e4196b
|
4
|
+
data.tar.gz: 09385020d82b9437dbb18a3e010242d87eb2b681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 983e3adc63c7e4ecb00b2f55191d7b6cb980287f26141765f964bf9f43ff2afd582f3d87f3c08225a5fdb1404c89e4b85034893f8ace6b0dbf228cdb7ea847fd
|
7
|
+
data.tar.gz: d4abea958cd6b65a1414b30754b3dafe33fa670240782cd71e60bba8b6a7e07cd6e074f61015547b47a725e82b8a0dd5c8a8cc4464c193516a51703b8652faed
|
@@ -148,11 +148,11 @@
|
|
148
148
|
}; //END fill_condition
|
149
149
|
|
150
150
|
plugin.load_values = function (values) {
|
151
|
-
if (typeof values == 'string') {
|
151
|
+
if (typeof values == 'string' && !is_blank(values)) {
|
152
152
|
plugin.parameters.values = getJson(values);
|
153
153
|
} else if (is_blank(values) && !is_blank(plugin.parameters.input)) {
|
154
154
|
$elInput = $(plugin.parameters.input);
|
155
|
-
if ($elInput.length > 0) {
|
155
|
+
if ($elInput.length > 0 && !is_blank($elInput.val())) {
|
156
156
|
plugin.parameters.values = JSON.parse($elInput.val());
|
157
157
|
}
|
158
158
|
} else {
|
@@ -13,15 +13,7 @@ module VisualConditionBuilder
|
|
13
13
|
dictionary: dictionary_klass.dictionary(get_dictionary_context(dictionary), self.request)
|
14
14
|
}.deep_merge(hArgs)
|
15
15
|
|
16
|
-
|
17
|
-
concat(content_tag(:div, nil, id: container_name))
|
18
|
-
concat(javascript_tag(<<txtjs
|
19
|
-
$(document).ready(function () {
|
20
|
-
$('##{container_name}').conditionBuilder(#{builder_options.to_json});
|
21
|
-
});
|
22
|
-
txtjs
|
23
|
-
))
|
24
|
-
end
|
16
|
+
render partial: 'visual_condition_builder/builder_conditions', locals: {container_name: container_name, builder_options: builder_options.to_json.html_safe}
|
25
17
|
end
|
26
18
|
|
27
19
|
def conditions_fields(dictionary)
|
@@ -33,18 +25,6 @@ txtjs
|
|
33
25
|
end
|
34
26
|
|
35
27
|
private
|
36
|
-
def create_conditions_fields_item(fields)
|
37
|
-
fields.each do |field, attrs|
|
38
|
-
if field.is_a?(Hash) #GROUP
|
39
|
-
group_label = field.values.first
|
40
|
-
concat(content_tag(:li, group_label, class: 'dropdown-header'))
|
41
|
-
create_conditions_fields_item(attrs)
|
42
|
-
else
|
43
|
-
concat(content_tag(:li, link_to(attrs[:label], '#', class: 'add-condition-field', data: {field: field})))
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
28
|
def get_dictionary_context(dictionary)
|
49
29
|
dictionary.is_a?(Hash) ? dictionary.values.first : :default
|
50
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visual_condition_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Porto
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- app/controllers/application_dictionary.rb
|
101
101
|
- app/controllers/visual_condition_builder/application_controller.rb
|
102
102
|
- app/helpers/visual_condition_builder/application_helper.rb
|
103
|
+
- app/views/visual_condition_builder/_builder_conditions.html.erb
|
103
104
|
- app/views/visual_condition_builder/_conditions_fields.html.erb
|
104
105
|
- app/views/visual_condition_builder/_conditions_fields_item.html.erb
|
105
106
|
- config/initializers/assets.rb
|