##// END OF EJS Templates
sanitize only of text and not explicitely asked not to....
Bussonnier Matthias -
Show More
@@ -8,6 +8,35 b' define(function(require) {'
8 var IPython = require('base/js/namespace');
8 var IPython = require('base/js/namespace');
9 var $ = require('jquery');
9 var $ = require('jquery');
10
10
11 /**
12 * A wrapper around bootstrap modal for easier use
13 * Pass it an option dictionary with the following properties:
14 *
15 * - body : <string> or <DOM node>, main content of the dialog
16 * if pass a <string> it will be wrapped in a p tag and
17 * html element escaped, unless you specify sanitize=false
18 * option.
19 * - title : Dialog title, default to empty string.
20 * - buttons : dict of btn_options who keys are button label.
21 * see btn_options below for description
22 * - open : callback to trigger on dialog open.
23 * - destroy:
24 * - notebook : notebook instance
25 * - keyboard_manager: keyboard manager instance.
26 *
27 * Unlike bootstrap modals, the backdrop options is set by default
28 * to 'static'.
29 *
30 * The rest of the options are passed as is to bootstrap modals.
31 *
32 * btn_options: dict with the following property:
33 *
34 * - click : callback to trigger on click
35 * - class : css classes to add to button.
36 *
37 *
38 *
39 **/
11 var modal = function (options) {
40 var modal = function (options) {
12
41
13 var modal = $("<div/>")
42 var modal = $("<div/>")
@@ -20,7 +49,7 b' define(function(require) {'
20 var dialog_content = $("<div/>")
49 var dialog_content = $("<div/>")
21 .addClass("modal-content")
50 .addClass("modal-content")
22 .appendTo(dialog);
51 .appendTo(dialog);
23 if(typeof(options.body) === 'string'){
52 if(typeof(options.body) === 'string' && options.sanitize !== false){
24 options.body = $("<p/>").text(options.body)
53 options.body = $("<p/>").text(options.body)
25 }
54 }
26 dialog_content.append(
55 dialog_content.append(
@@ -35,7 +64,7 b' define(function(require) {'
35 ).append(
64 ).append(
36 $("<h4/>")
65 $("<h4/>")
37 .addClass('modal-title')
66 .addClass('modal-title')
38 .text(options.title || "No Title")
67 .text(options.title || "")
39 )
68 )
40 ).append(
69 ).append(
41 $("<div/>").addClass("modal-body").append(
70 $("<div/>").addClass("modal-body").append(
General Comments 0
You need to be logged in to leave comments. Login now