Class: IRuby::Input::Field

Inherits:
Label
  • Object
show all
Defined in:
lib/iruby/input/field.rb

Direct Known Subclasses

Date, Textarea

Instance Method Summary collapse

Methods inherited from Label

#widget_label

Methods inherited from Widget

builder, #content, #widget_css, #widget_display, #widget_join

Instance Method Details

#widget_htmlObject



19
20
21
22
23
24
25
26
27
# File 'lib/iruby/input/field.rb', line 19

def widget_html
  widget_label do 
    input(
      type: @type, 
      :'data-iruby-key' => @key,
      class: "form-control #{@js_class}"
    )
  end
end

#widget_jsObject



11
12
13
14
15
16
17
# File 'lib/iruby/input/field.rb', line 11

def widget_js
  <<-JS
    $('.iruby-field').keyup(function() {
      $(this).data('iruby-value', $(this).val());
    });
  JS
end