Class: Playbook::PbSelect::Select
- Inherits:
-
Object
- Object
- Playbook::PbSelect::Select
show all
- Includes:
- ActionView::Context, ActionView::Helpers::FormTagHelper, Playbook::Props
- Defined in:
- app/pb_kits/playbook/pb_select/select.rb
Instance Method Summary
collapse
#dark_props, #generate_classname, #generate_classname_without_spacing, #initialize, #prop, #spacing_options, #spacing_props, #spacing_values
Instance Method Details
#classname ⇒ Object
25
26
27
|
# File 'app/pb_kits/playbook/pb_select/select.rb', line 25
def classname
generate_classname("pb_select")
end
|
#disabled_options ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'app/pb_kits/playbook/pb_select/select.rb', line 46
def disabled_options
disabled_options = options.map { |option| option[:value] if option[:disabled] == true }.compact
if disabled_options.empty?
nil
else
disabled_options
end
end
|
#options_to_array ⇒ Object
33
34
35
|
# File 'app/pb_kits/playbook/pb_select/select.rb', line 33
def options_to_array
options.map { |option| [option[:value_text] || option[:value], option[:value]] }
end
|
#select_wrapper_class ⇒ Object
29
30
31
|
# File 'app/pb_kits/playbook/pb_select/select.rb', line 29
def select_wrapper_class
"pb_select_kit_wrapper" + error_class
end
|
#selected ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'app/pb_kits/playbook/pb_select/select.rb', line 37
def selected
selections = options.map { |option| option[:value] if option[:selected] == true }.compact
if selections.empty?
nil
else
selections
end
end
|