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
[View source]
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
|
[View source]
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
36
37
38
|
# File 'lib/iruby/input/popup.rb', line 11
def widget_js
js = <<-JS
require(['base/js/dialog'], function(dialog) {
var popup = dialog.modal({
title: '#{@title.gsub("'"){"\\'"}}',
body: '#{@form.to_html}',
destroy: true,
sanitize: false,
keyboard_manager: Jupyter.notebook.keyboard_manager,
open: function() {
#{widget_join :widget_js, @form, *@buttons}
var popup = $(this);
$('#iruby-form').submit(function() {
popup.modal('hide');
});
Jupyter.notebook.keyboard_manager.disable();
}
});
popup.find('.modal-footer').each(function(e) {
$(this).append('#{@buttons.map(&:to_html).join}');
});
});
JS
end
|