Class: Nemo::Components::ConfirmDialog

Inherits:
Wee::Component
  • Object
show all
Defined in:
lib/nemo/components/confirm.rb

Overview

Confirmation dialog box

Displays a message with OK(true) and Cancel(false) buttons.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ ConfirmDialog

Returns a new instance of ConfirmDialog.



9
10
11
12
# File 'lib/nemo/components/confirm.rb', line 9

def initialize(text)
  super()
  @text = text 
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



7
8
9
# File 'lib/nemo/components/confirm.rb', line 7

def text
  @text
end

Instance Method Details

#renderObject



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

def render
  r.html do
    r.head { r.title('Confirm') }
    r.body.style('text-align: center').with do
      r.break
      r.encode_text(@text)
      r.form do 
        r.submit_button.value('OK').callback{ answer true }
        r.space
        r.submit_button.value('Cancel').callback{ answer false }
      end
      r.break
    end
  end
end