class Matestack::Ui::VueJs::Components::Form::Select
Public Instance Methods
component_id()
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 28 def component_id "select-component-for-#{key}" end
disabled_options()
click to toggle source
attributes
# File lib/matestack/ui/vue_js/components/form/select.rb, line 79 def disabled_options @disabled_options ||= options.delete(:disabled_options) end
item_disabled?(item)
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 69 def item_disabled?(item) disabled_options && disabled_options.to_a.include?(item) end
item_id(item)
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 65 def item_id(item) "#{key}_#{item_value(item)}" end
item_label(item)
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 61 def item_label(item) item.is_a?(Array) ? item.first : item end
item_value(item)
click to toggle source
calculated attributes
# File lib/matestack/ui/vue_js/components/form/select.rb, line 57 def item_value(item) item.is_a?(Array) ? item.last : item end
render_options()
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 19 def render_options if placeholder option value: nil, disabled: true, selected: init_value.nil?, text: placeholder end select_options.to_a.each do |item| option item_label(item), value: item_value(item), disabled: item_disabled?(item) end end
response()
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 9 def response div class: 'matestack-ui-core-form-select' do label input_label, ":for": id if input_label select select_attributes do render_options end render_errors end end
select_attributes()
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 39 def select_attributes attributes.merge({ multiple: multiple, ":id": id, ref: "select#{'.multiple' if multiple}.#{key}", 'value-type': value_type(select_options.first), 'init-value': init_value, }) end
select_options()
click to toggle source
select options
# File lib/matestack/ui/vue_js/components/form/select.rb, line 51 def select_options @select_options ||= options.delete(:options) end
v_model_type()
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 73 def v_model_type item_value(select_options.first).is_a?(Numeric) ? 'v-model.number' : 'v-model' end
vue_props()
click to toggle source
# File lib/matestack/ui/vue_js/components/form/select.rb, line 32 def vue_props { init_value: init_value, key: key, } end