splendeo-dependent_select 0.6.0 → 0.6.1
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.
- data/lib/dependent_select/form_helpers.rb +8 -4
- metadata +3 -2
@@ -1,8 +1,6 @@
|
|
1
1
|
# Various helpers available for use in your view
|
2
2
|
module DependentSelect::FormHelpers
|
3
3
|
|
4
|
-
@used_array_names = {}
|
5
|
-
|
6
4
|
# Similar to collection_select form helper, but adds a "filter_method" parameter
|
7
5
|
# the generated code includes a javascript observer that modifies the select
|
8
6
|
# using the value of a form method.
|
@@ -346,6 +344,11 @@ module DependentSelect::FormHelpers
|
|
346
344
|
end
|
347
345
|
|
348
346
|
private
|
347
|
+
#holds the names of the arrays already generated, so repetitions can be avoided.
|
348
|
+
def dependend_select_array_names
|
349
|
+
@dependend_select_array_names ||= {}
|
350
|
+
end
|
351
|
+
|
349
352
|
# extracts any options passed into calendar date select, appropriating them to either the Javascript call or the html tag.
|
350
353
|
def dependent_select_process_options(options)
|
351
354
|
options, extra_options = DependentSelect.default_options.merge(options), {}
|
@@ -372,8 +375,9 @@ module DependentSelect::FormHelpers
|
|
372
375
|
|
373
376
|
js_array_code = ""
|
374
377
|
|
375
|
-
if(
|
376
|
-
|
378
|
+
if(dependend_select_array_names[js_array_name].nil?)
|
379
|
+
dependend_select_array_names[js_array_name] = true;
|
380
|
+
js_array_code += "#{js_array_name} = #{choices_with_filter.to_json};\n"
|
377
381
|
end
|
378
382
|
|
379
383
|
dependent_id = dependent_select_calculate_id(object_name, method)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splendeo-dependent_select
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrique Garcia Cota (egarcia)
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- README.rdoc
|
32
32
|
has_rdoc: true
|
33
33
|
homepage: http://github.com/splendeo/dependent_select
|
34
|
+
licenses:
|
34
35
|
post_install_message:
|
35
36
|
rdoc_options:
|
36
37
|
- --charset=UTF-8
|
@@ -51,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
52
|
requirements: []
|
52
53
|
|
53
54
|
rubyforge_project:
|
54
|
-
rubygems_version: 1.
|
55
|
+
rubygems_version: 1.3.5
|
55
56
|
signing_key:
|
56
57
|
specification_version: 2
|
57
58
|
summary: generates a select with some js code that updates if if another field is modified.
|