Class: HRadioButtonTag

Inherits:
HGroupTag show all
Defined in:
lib/hwidgets/hradiobuttontag.rb

Instance Attribute Summary collapse

Attributes inherited from HGroupTag

#items, #values

Attributes inherited from HWidget

#tag

Instance Method Summary collapse

Methods inherited from HGroupTag

#setCarriageReturn, #setItems, #setItemsAndValues, #setSelected, #setValues

Methods inherited from HWidget

#_addJsSlot, #_set, #_setStyle, #addJsFunction, #appendChild, #appendChilds, #buildSignature, #closeTag, #connect, #copyConstructor, #get, #getChilds, #getElementBy, #getSystemProperty, #hotLog, #openTag, #replacePlaceholder, #reset, #set, #setChilds, #setCloseTag, #setClosedTag, #setEnablePlaceholder, #setInnerHTML, #setParent, #setPlaceholder, #setPlaceholders, #setProperties, #setSlots, #setStyle, #setStyles, #setSystemProperties, #setSystemProperty, #setTag, #storeSlots, #storeStyle, #strProperties, test, #unset, widgetSpace

Constructor Details

#initialize(name = nil, modelName = nil, placeholder = nil) ⇒ HRadioButtonTag

Returns a new instance of HRadioButtonTag.



9
10
11
12
# File 'lib/hwidgets/hradiobuttontag.rb', line 9

def initialize(name = nil, modelName = nil, placeholder = nil)
  super(name, modelName, placeholder)
  @radioButton = nil
end

Instance Attribute Details

#radioButtonObject

Returns the value of attribute radioButton.



7
8
9
# File 'lib/hwidgets/hradiobuttontag.rb', line 7

def radioButton
  @radioButton
end

Instance Method Details

#htmlObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/hwidgets/hradiobuttontag.rb', line 14

def html()
  for i in (0..@items.count - 1) do
    item = @items[i]
    value = @values[i]
    id = "#{@modelName}_#{@name}_#{item.downcase.gsub(' ', '_')}"
    radioButton = HInputTag.new(@name, @modelName, item, nil, type = "radio") if (@radioButton == nil)
    radioButton.set("checked", "") if (value.to_s == @selectedItem.to_s)
    radioButton.set(value: value, id: id)
    radioButton.setReverse()
    self << radioButton
  end

  return super()

end