Class: IRuby::Input::Select
Instance Method Summary
collapse
Methods inherited from Label
#widget_label
Methods inherited from Widget
builder, #content, #widget_display, #widget_join
Instance Method Details
14
15
16
|
# File 'lib/iruby/input/select.rb', line 14
def widget_css
'.iruby-select { margin-left: 0 !important }'
end
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/iruby/input/select.rb', line 28
def widget_html
widget_label do
div class: 'form-control' do
params = {
class: 'iruby-select',
:'data-iruby-key' => @key,
:'data-iruby-value' => @options.first
}
select **params do
@options.each {|o| option o }
end
end
end
end
|
18
19
20
21
22
23
24
25
26
|
# File 'lib/iruby/input/select.rb', line 18
def widget_js
<<-JS
$('.iruby-select').change(function(){
$(this).data('iruby-value',
$(this).find('option:selected').text()
);
});
JS
end
|