splendeo-dependent_select 0.6.2 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,13 +5,13 @@ module DependentSelect
5
5
  # Example:
6
6
  # # At the bottom of config/environment.rb:
7
7
  # DependentSelect.default_options.update(
8
- # :collapse_blanks => false
8
+ # :collapse_spaces => false
9
9
  # )
10
10
  def self.default_options
11
- @default_options ||= { :collapse_blanks => true }
11
+ @default_options ||= { :collapse_spaces => true }
12
12
  end
13
13
 
14
- # By default, blank spaces are collapsed on browsers when printing the select option texts
14
+ # By default, spaces are collapsed on browsers when printing the select option texts
15
15
  # For example:
16
16
  # <select>
17
17
  # <option>This option should have lots of spaces on its text</option>
@@ -21,8 +21,8 @@ module DependentSelect
21
21
  # Setting collapse_blanks to false will replace the blanks with the &nbsp; character, using
22
22
  # javascript
23
23
  # option_text.replace(/ /g, "\240"); // "\240" is the octal representation of charcode 160 (nbsp)
24
- def self.collapse_blanks=(value)
25
- default_options[:collapse_blanks] = value
24
+ def self.collapse_spaces=(value)
25
+ default_options[:collapse_spaces] = value
26
26
  end
27
27
 
28
28
  end
@@ -39,7 +39,7 @@ module DependentSelect::FormHelpers
39
39
  # </select>
40
40
  # Most browsers will "collapse" the spaces, and present something like this instead:
41
41
  # "This option should have lots of spaces on its text"
42
- # Setting collapse_blanks to false will replace the blanks with the &nbsp; character.
42
+ # Setting collapse_spaces to false will replace the blanks with the &nbsp; character.
43
43
  # This is accomplised on the javascript function using code similar to the following
44
44
  #
45
45
  # option_text.replace(/ /g, "\240"); // "\240" is the octal representation of charcode 160 (nbsp)
@@ -267,11 +267,11 @@ module DependentSelect::FormHelpers
267
267
  def dependent_collection_select(object_name, method, collection, value_method,
268
268
  text_method, filter_method, options = {}, html_options = {}
269
269
  )
270
- object, options, extra_options = dependent_select_process_options(options)
270
+ object, options, extra_options = dependent_select_process_options(object_name, options)
271
271
 
272
272
  initial_collection = dependent_select_initial_collection(object,
273
273
  method, collection, value_method)
274
-
274
+
275
275
  tag = collection_select(object_name, method, initial_collection, value_method,
276
276
  text_method, options, html_options)
277
277
 
@@ -331,7 +331,7 @@ module DependentSelect::FormHelpers
331
331
  def dependent_select(object_name, method, choices_with_filter, filter_method,
332
332
  options = {}, html_options = {})
333
333
 
334
- object, options, extra_options = dependent_select_process_options(options)
334
+ object, options, extra_options = dependent_select_process_options(object_name, options)
335
335
 
336
336
  initial_choices = dependent_select_initial_choices(object, method, choices_with_filter)
337
337
 
@@ -350,14 +350,16 @@ module DependentSelect::FormHelpers
350
350
  end
351
351
 
352
352
  # extracts any options passed into calendar date select, appropriating them to either the Javascript call or the html tag.
353
- def dependent_select_process_options(options)
353
+ def dependent_select_process_options(object_name, options)
354
354
  options, extra_options = DependentSelect.default_options.merge(options), {}
355
355
  for key in [:collapse_spaces, :filter_field, :complete_filter_field, :array_name]
356
356
  extra_options[key] = options.delete(key) if options.has_key?(key)
357
357
  end
358
358
 
359
- object = options.delete(:object) || instance_variable_get("@#{object}")
360
-
359
+ object = options.delete(:object) || instance_variable_get("@#{object_name}")
360
+
361
+ options[:object]=object
362
+
361
363
  [object, options, extra_options]
362
364
  end
363
365
 
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.2
4
+ version: 0.6.4
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.2.0
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.