Class: IRuby::Input::Button
Overview
extend the label class for the to_label helper
Constant Summary
collapse
- COLORS =
{
blue: 'primary',
gray: 'secondary',
green: 'success',
aqua: 'info',
orange: 'warning',
red: 'danger',
none: 'link'
}
Instance Method Summary
collapse
Methods inherited from Label
#widget_label
Methods inherited from Widget
builder, #content, #widget_display, #widget_join
Instance Method Details
24
25
26
|
# File 'lib/iruby/input/button.rb', line 24
def widget_css
".#{@js_class} { margin-left: 5px; }"
end
|
37
38
39
40
41
42
43
44
|
# File 'lib/iruby/input/button.rb', line 37
def widget_html
button(
@label || to_label(@key),
type: 'button',
:'data-iruby-key' => @key,
class: "btn btn-#{COLORS[@color]} pull-right #{@js_class}"
)
end
|
28
29
30
31
32
33
34
35
|
# File 'lib/iruby/input/button.rb', line 28
def widget_js
<<-JS
$('.iruby-button').click(function(){
$(this).data('iruby-value', true);
$('#iruby-form').submit();
});
JS
end
|