Class: Scarpe::Webview::Radio

Inherits:
Drawable show all
Defined in:
lib/scarpe/wv/radio.rb

Constant Summary

Constants included from Shoes::Log

Shoes::Log::DEFAULT_COMPONENT, Shoes::Log::DEFAULT_DEBUG_LOG_CONFIG, Shoes::Log::DEFAULT_LOG_CONFIG

Instance Attribute Summary collapse

Attributes inherited from Drawable

#children, #parent, #shoes_linkable_id

Attributes inherited from Shoes::Linkable

#linkable_id

Instance Method Summary collapse

Methods inherited from Drawable

#add_child, #bind, #destroy_self, display_class_for, #full_window_redraw!, #handler_js_code, #html_element, #html_id, #inspect, #needs_update!, #promise_update, #remove_child, #set_parent, #shoes_styles, #to_html

Methods included from Shoes::Log

configure_logger, #log_init, logger

Methods inherited from Shoes::Linkable

#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_all_shoes_events, #unsub_shoes_event

Constructor Details

#initialize(properties) ⇒ Radio

Returns a new instance of Radio.



8
9
10
11
12
13
14
# File 'lib/scarpe/wv/radio.rb', line 8

def initialize(properties)
  super

  bind("click") do
    send_self_event(event_name: "click", target: shoes_linkable_id)
  end
end

Instance Attribute Details

#textObject (readonly)

TODO: is this needed?



6
7
8
# File 'lib/scarpe/wv/radio.rb', line 6

def text
  @text
end

Instance Method Details

#elementObject



23
24
25
26
27
28
29
30
31
# File 'lib/scarpe/wv/radio.rb', line 23

def element
  props = shoes_styles

  # If a group isn't set, default to the linkable ID of the parent slot
  unless @group
    props["group"] = @parent ? @parent.shoes_linkable_id : "no_group"
  end
  render("radio", props)
end

#properties_changed(changes) ⇒ Object



16
17
18
19
20
21
# File 'lib/scarpe/wv/radio.rb', line 16

def properties_changed(changes)
  items = changes.delete("checked")
  html_element.toggle_input_button(items)

  super
end