Class: Wee::Brush::CheckboxTag

Inherits:
InputTag show all
Defined in:
lib/wee/html_brushes.rb

Constant Summary collapse

HTML_TYPE =
'checkbox'.freeze

Constants inherited from InputTag

InputTag::HTML_TAG

Constants inherited from GenericTagBrush

GenericTagBrush::EVENTS

Instance Attribute Summary

Attributes inherited from Wee::Brush

#canvas, #document

Instance Method Summary collapse

Methods included from CallbackMixin

#call, #callback, #callback_method

Methods inherited from GenericSingleTagBrush

nesting?

Methods inherited from GenericTagBrush

#callback_on, #get_oid, html_attr, #javascript_on, #oid, #onclick_callback, #onclick_javascript, #ondblclick_callback, #update_component_on, #update_on

Methods inherited from Wee::Brush

#close, nesting?, #setup

Constructor Details

#initializeCheckboxTag

Returns a new instance of CheckboxTag.



455
456
457
# File 'lib/wee/html_brushes.rb', line 455

def initialize
  super(HTML_TYPE)
end

Instance Method Details

#__callbackObject

do nothing



459
# File 'lib/wee/html_brushes.rb', line 459

def __callback; end

#withObject



461
462
463
464
465
466
467
468
469
470
471
# File 'lib/wee/html_brushes.rb', line 461

def with
  if @callback
    n = @canvas.register_callback(:input, proc {|input|
      @callback.call(input.send(input.kind_of?(Array) ? :include? : :==, '1'))
    })
    @document.single_tag('input', :type => 'hidden', :name => n, :value => '0')
    name(n)
    value('1')
  end
  super
end