Sha256: bb63ad207f9763e14430d68abf94499320b98bc5e975a8ee907db4b59dd0e37e

Contents?: true

Size: 782 Bytes

Versions: 3

Compression:

Stored size: 782 Bytes

Contents

class RadioTest < Wee::Component
  def render(r)
    grp1 = r.new_radio_group
    grp2 = r.new_radio_group

    r.paragraph
    r.text "Group1"
    r.text " (your choice: #{@g1})" if @g1
    r.break

    r.text "R1: "
    r.radio_button.group(grp1).checked(@g1.nil? || @g1 == 'R1').callback { @g1 = 'R1' }
    r.break

    r.text "R2: "
    r.radio_button.group(grp1).checked(@g1 == 'R2').callback { @g1 = 'R2' }

    r.paragraph
    r.text "Group2"
    r.text " (your choice: #{@g2})" if @g2
    r.break

    r.text "R1: "
    r.radio_button.group(grp2).checked(@g2.nil? || @g2 == 'R1').callback { @g2 = 'R1' }
    r.break

    r.text "R2: "
    r.radio_button.group(grp2).checked(@g2 == 'R2').callback { @g2 = 'R2' }

    r.paragraph
    r.submit_button.value('Submit')
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
mullen-wee-2.2.0 examples/demo/radio.rb
wee-2.1.0 examples/demo/radio.rb
wee-2.0.0 examples/demo/radio.rb