class IRuby::Input::Button

extend the label class for the to_label helper

Constants

COLORS

Public Instance Methods

widget_css() click to toggle source
# File lib/iruby/input/button.rb, line 24
def widget_css
  ".#{@js_class} { margin-left: 5px; }"
end
widget_html() click to toggle source
# 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
widget_js() click to toggle source
# 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