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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29c7b9f0c2676e707c087a1f800b69bb51d2db65
4
- data.tar.gz: 5a6f334ce10f479ed1b6a5666eab2d9a0d46b991
3
+ metadata.gz: 258bcbf53cb35fa5811d80ab924d2a5a08e4196b
4
+ data.tar.gz: 09385020d82b9437dbb18a3e010242d87eb2b681
5
5
  SHA512:
6
- metadata.gz: c65a6b40f4fb6ed9e7a5afb218c0c5df3e4f45814c8fe798b1c5b19be56d2bfd38b18eb1dfb6fe1389291ad46db6522b01c6e551182631a2fb8d372dc7cba491
7
- data.tar.gz: 4813cea48ec606be4c682b50e1b68b5358a3f6e7ec3c4efa1059465db216d90c391cb934fc33d6d812f3332ded2c0165bf9336e5c1107c9a17f7f08ec47753a3
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
- capture do
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
@@ -0,0 +1,6 @@
1
+ <div id="<%= container_name %>"></div>
2
+ <script>
3
+ $(document).ready(function () {
4
+ $("#<%= container_name %>").conditionBuilder(<%= builder_options %>);
5
+ });
6
+ </script>
@@ -1,3 +1,3 @@
1
1
  module VisualConditionBuilder
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  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.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