Module: DependentSelect
- Defined in:
- lib/dependent_select/dependent_select.rb
Defined Under Namespace
Modules: FormHelpers, IncludesHelper
Class Method Summary collapse
-
.collapse_spaces=(value) ⇒ Object
By default, spaces are collapsed on browsers when printing the select option texts For example: <select> <option>This option should have lots of spaces on its text</option> </select> When you browse that, some browsers collapse the spaces, so you get an option that says “This option should have lots of spaces on its text” Setting collapse_blanks to false will replace the blanks with the character, using javascript option_text.replace(/ /g, “240”); // “240” is the octal representation of charcode 160 (nbsp).
- .collapse_spaces? ⇒ Boolean
-
.default_options ⇒ Object
Returns the default_options hash.
-
.use_jquery=(value) ⇒ Object
By default, dependent_select will use Prototype.
- .use_jquery? ⇒ Boolean
Class Method Details
.collapse_spaces=(value) ⇒ Object
By default, spaces are collapsed on browsers when printing the select option texts For example:
<select>
<option>This option should have lots of spaces on its text</option>
</select>
When you browse that, some browsers collapse the spaces, so you get an option that says
"This option should have lots of spaces on its text"
Setting collapse_blanks to false will replace the blanks with the character, using javascript
option_text.replace(/ /g, "\240"); // "\240" is the octal representation of charcode 160 (nbsp)
24 25 26 |
# File 'lib/dependent_select/dependent_select.rb', line 24 def self.collapse_spaces=(value) [:collapse_spaces] = value end |
.collapse_spaces? ⇒ Boolean
28 29 30 |
# File 'lib/dependent_select/dependent_select.rb', line 28 def self.collapse_spaces? [:collapse_spaces] end |
.default_options ⇒ Object
Returns the default_options hash. These options are by default provided to every calendar_date_select control, unless otherwise overrided.
Example:
# At the bottom of config/environment.rb:
DependentSelect..update(
:collapse_spaces => false
)
10 11 12 |
# File 'lib/dependent_select/dependent_select.rb', line 10 def self. ||= { :collapse_spaces => true, :use_jquery => false } end |
.use_jquery=(value) ⇒ Object
By default, dependent_select will use Prototype. If you need to use jquery, you can do so by doing
DependentSelect.use_jquery = true
34 35 36 |
# File 'lib/dependent_select/dependent_select.rb', line 34 def self.use_jquery=(value) [:use_jquery] = value end |
.use_jquery? ⇒ Boolean
38 39 40 |
# File 'lib/dependent_select/dependent_select.rb', line 38 def self.use_jquery? [:use_jquery] end |