Class: IRuby::Input::Popup
- Inherits:
-
Widget
- Object
- Erector::Widget
- Widget
- IRuby::Input::Popup
show all
- Defined in:
- lib/iruby/input/popup.rb
Instance Method Summary
collapse
Methods inherited from Widget
builder, #content, #widget_display, #widget_html, #widget_join
Instance Method Details
6
7
8
9
|
# File 'lib/iruby/input/popup.rb', line 6
def widget_css
style = '.modal-body { overflow: auto; }'
widget_join :widget_css, style, @form, *@buttons
end
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/iruby/input/popup.rb', line 11
def widget_js
js = "require(['base/js/dialog'], function(dialog) {\nvar popup = dialog.modal({\ntitle: '\#{@title.gsub(\"'\"){\"\\\\'\"}}',\nbody: '\#{@form.to_html}',\ndestroy: true,\nsanitize: false,\nkeyboard_manager: Jupyter.notebook.keyboard_manager,\nopen: function() {\n\#{widget_join :widget_js, @form, *@buttons}\n\nvar popup = $(this);\n$('#iruby-form').submit(function() {\npopup.modal('hide');\n})\n}\n});\n\npopup.find('.modal-footer').each(function(e) {\n$(this).append('\#{@buttons.map(&:to_html).join}');\n});\n});\n"
end
|