Show More
@@ -90,11 +90,11 b' define([' | |||||
90 | return modal.modal(options); |
|
90 | return modal.modal(options); | |
91 | }; |
|
91 | }; | |
92 |
|
92 | |||
93 | var edit_metadata = function (md, callback, name, keyboard_manager, notebook) { |
|
93 | var edit_metadata = function (options) { | |
94 | name = name || "Cell"; |
|
94 | options.name = options.name || "Cell"; | |
95 | var error_div = $('<div/>').css('color', 'red'); |
|
95 | var error_div = $('<div/>').css('color', 'red'); | |
96 | var message = |
|
96 | var message = | |
97 | "Manually edit the JSON below to manipulate the metadata for this " + name + "." + |
|
97 | "Manually edit the JSON below to manipulate the metadata for this " + options.name + "." + | |
98 | " We recommend putting custom metadata attributes in an appropriately named sub-structure," + |
|
98 | " We recommend putting custom metadata attributes in an appropriately named sub-structure," + | |
99 | " so they don't conflict with those of others."; |
|
99 | " so they don't conflict with those of others."; | |
100 |
|
100 | |||
@@ -102,7 +102,7 b' define([' | |||||
102 | .attr('rows', '13') |
|
102 | .attr('rows', '13') | |
103 | .attr('cols', '80') |
|
103 | .attr('cols', '80') | |
104 | .attr('name', 'metadata') |
|
104 | .attr('name', 'metadata') | |
105 | .text(JSON.stringify(md || {}, null, 2)); |
|
105 | .text(JSON.stringify(options.md || {}, null, 2)); | |
106 |
|
106 | |||
107 | var dialogform = $('<div/>').attr('title', 'Edit the metadata') |
|
107 | var dialogform = $('<div/>').attr('title', 'Edit the metadata') | |
108 | .append( |
|
108 | .append( | |
@@ -125,7 +125,7 b' define([' | |||||
125 | mode: 'application/json', |
|
125 | mode: 'application/json', | |
126 | }); |
|
126 | }); | |
127 | var modal = modal({ |
|
127 | var modal = modal({ | |
128 | title: "Edit " + name + " Metadata", |
|
128 | title: "Edit " + options.name + " Metadata", | |
129 | body: dialogform, |
|
129 | body: dialogform, | |
130 | buttons: { |
|
130 | buttons: { | |
131 | OK: { class : "btn-primary", |
|
131 | OK: { class : "btn-primary", | |
@@ -139,12 +139,14 b' define([' | |||||
139 | error_div.text('WARNING: Could not save invalid JSON.'); |
|
139 | error_div.text('WARNING: Could not save invalid JSON.'); | |
140 | return false; |
|
140 | return false; | |
141 | } |
|
141 | } | |
142 | callback(new_md); |
|
142 | options.callback(new_md); | |
143 | } |
|
143 | } | |
144 | }, |
|
144 | }, | |
145 | Cancel: {} |
|
145 | Cancel: {} | |
146 | } |
|
146 | }, | |
147 | }, keyboard_manager, notebook); |
|
147 | notebook: options.notebook, | |
|
148 | keyboard_manager: options.keyboard_manager, | |||
|
149 | }); | |||
148 |
|
150 | |||
149 | modal.on('shown.bs.modal', function(){ editor.refresh(); }); |
|
151 | modal.on('shown.bs.modal', function(){ editor.refresh(); }); | |
150 | }; |
|
152 | }; | |
@@ -155,7 +157,7 b' define([' | |||||
155 | }; |
|
157 | }; | |
156 |
|
158 | |||
157 | // Backwards compatability. |
|
159 | // Backwards compatability. | |
158 |
IPython. |
|
160 | IPython.dialog = dialog; | |
159 |
|
161 | |||
160 | return dialog; |
|
162 | return dialog; | |
161 | }); |
|
163 | }); |
@@ -242,7 +242,7 b' define([' | |||||
242 | return !( data === undefined || data.handler === undefined ); |
|
242 | return !( data === undefined || data.handler === undefined ); | |
243 | }; |
|
243 | }; | |
244 |
|
244 | |||
245 | return { |
|
245 | var keyboard = { | |
246 | keycodes : keycodes, |
|
246 | keycodes : keycodes, | |
247 | inv_keycodes : inv_keycodes, |
|
247 | inv_keycodes : inv_keycodes, | |
248 | ShortcutManager : ShortcutManager, |
|
248 | ShortcutManager : ShortcutManager, | |
@@ -251,4 +251,9 b' define([' | |||||
251 | shortcut_to_event : shortcut_to_event, |
|
251 | shortcut_to_event : shortcut_to_event, | |
252 | event_to_shortcut : event_to_shortcut |
|
252 | event_to_shortcut : event_to_shortcut | |
253 | }; |
|
253 | }; | |
|
254 | ||||
|
255 | // For backwards compatability. | |||
|
256 | IPython.keyboard = keyboard; | |||
|
257 | ||||
|
258 | return keyboard; | |||
254 | }); |
|
259 | }); |
@@ -4,9 +4,6 b'' | |||||
4 | define([ |
|
4 | define([ | |
5 | 'base/js/namespace', |
|
5 | 'base/js/namespace', | |
6 | 'jquery', |
|
6 | 'jquery', | |
7 | 'components/jquery-ui/ui/minified/jquery-ui.min', |
|
|||
8 | 'components/bootstrap/js/bootstrap.min', |
|
|||
9 | 'auth/js/loginwidget' |
|
|||
10 | ], function(IPython, $){ |
|
7 | ], function(IPython, $){ | |
11 | "use strict"; |
|
8 | "use strict"; | |
12 |
|
9 |
@@ -1,10 +1,7 b'' | |||||
1 | // Copyright (c) IPython Development Team. |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Distributed under the terms of the Modified BSD License. |
|
2 | // Distributed under the terms of the Modified BSD License. | |
3 |
|
3 | |||
4 | var ipython = ipython || {}; |
|
|||
5 | require(['base/js/page'], function(page) { |
|
4 | require(['base/js/page'], function(page) { | |
6 | var page_instance = new page.Page(); |
|
5 | var page_instance = new page.Page(); | |
7 | page_instance.show(); |
|
6 | page_instance.show(); | |
8 |
|
||||
9 | ipython.page = page_instance; |
|
|||
10 | }); |
|
7 | }); |
@@ -551,7 +551,7 b' define([' | |||||
551 | }; |
|
551 | }; | |
552 |
|
552 | |||
553 | // Backwards compatability. |
|
553 | // Backwards compatability. | |
554 |
IPython. |
|
554 | IPython.utils = utils; | |
555 |
|
555 | |||
556 | return utils; |
|
556 | return utils; | |
557 | }); |
|
557 | }); |
@@ -11,122 +11,115 b'' | |||||
11 | * The date defaults to the current date/time. |
|
11 | * The date defaults to the current date/time. | |
12 | * The mask defaults to dateFormat.masks.default. |
|
12 | * The mask defaults to dateFormat.masks.default. | |
13 | */ |
|
13 | */ | |
14 | // Copyright (c) IPython Development Team. |
|
|||
15 | // Distributed under the terms of the Modified BSD License. |
|
|||
16 |
|
14 | |||
17 | // Require.js define call added by IPython team. |
|
15 | var dateFormat = function () { | |
18 | define([], function() { |
|
16 | var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, | |
19 | var dateFormat = function () { |
|
17 | timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, | |
20 | var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, |
|
18 | timezoneClip = /[^-+\dA-Z]/g, | |
21 | timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, |
|
19 | pad = function (val, len) { | |
22 | timezoneClip = /[^-+\dA-Z]/g, |
|
20 | val = String(val); | |
23 | pad = function (val, len) { |
|
21 | len = len || 2; | |
24 | val = String(val); |
|
22 | while (val.length < len) val = "0" + val; | |
25 |
|
|
23 | return val; | |
26 | while (val.length < len) val = "0" + val; |
|
24 | }; | |
27 | return val; |
|
|||
28 | }; |
|
|||
29 |
|
||||
30 | // Regexes and supporting functions are cached through closure |
|
|||
31 | return function (date, mask, utc) { |
|
|||
32 | var dF = dateFormat; |
|
|||
33 |
|
25 | |||
34 | // You can't provide utc if you skip other args (use the "UTC:" mask prefix) |
|
26 | // Regexes and supporting functions are cached through closure | |
35 | if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) { |
|
27 | return function (date, mask, utc) { | |
36 |
|
|
28 | var dF = dateFormat; | |
37 | date = undefined; |
|
|||
38 | } |
|
|||
39 |
|
29 | |||
40 | // Passing date through Date applies Date.parse, if necessary |
|
30 | // You can't provide utc if you skip other args (use the "UTC:" mask prefix) | |
41 | date = date ? new Date(date) : new Date; |
|
31 | if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) { | |
42 | if (isNaN(date)) throw SyntaxError("invalid date"); |
|
32 | mask = date; | |
|
33 | date = undefined; | |||
|
34 | } | |||
43 |
|
35 | |||
44 | mask = String(dF.masks[mask] || mask || dF.masks["default"]); |
|
36 | // Passing date through Date applies Date.parse, if necessary | |
|
37 | date = date ? new Date(date) : new Date; | |||
|
38 | if (isNaN(date)) throw SyntaxError("invalid date"); | |||
45 |
|
39 | |||
46 | // Allow setting the utc argument via the mask |
|
40 | mask = String(dF.masks[mask] || mask || dF.masks["default"]); | |
47 | if (mask.slice(0, 4) == "UTC:") { |
|
|||
48 | mask = mask.slice(4); |
|
|||
49 | utc = true; |
|
|||
50 | } |
|
|||
51 |
|
41 | |||
52 | var _ = utc ? "getUTC" : "get", |
|
42 | // Allow setting the utc argument via the mask | |
53 | d = date[_ + "Date"](), |
|
43 | if (mask.slice(0, 4) == "UTC:") { | |
54 | D = date[_ + "Day"](), |
|
44 | mask = mask.slice(4); | |
55 | m = date[_ + "Month"](), |
|
45 | utc = true; | |
56 | y = date[_ + "FullYear"](), |
|
46 | } | |
57 | H = date[_ + "Hours"](), |
|
|||
58 | M = date[_ + "Minutes"](), |
|
|||
59 | s = date[_ + "Seconds"](), |
|
|||
60 | L = date[_ + "Milliseconds"](), |
|
|||
61 | o = utc ? 0 : date.getTimezoneOffset(), |
|
|||
62 | flags = { |
|
|||
63 | d: d, |
|
|||
64 | dd: pad(d), |
|
|||
65 | ddd: dF.i18n.dayNames[D], |
|
|||
66 | dddd: dF.i18n.dayNames[D + 7], |
|
|||
67 | m: m + 1, |
|
|||
68 | mm: pad(m + 1), |
|
|||
69 | mmm: dF.i18n.monthNames[m], |
|
|||
70 | mmmm: dF.i18n.monthNames[m + 12], |
|
|||
71 | yy: String(y).slice(2), |
|
|||
72 | yyyy: y, |
|
|||
73 | h: H % 12 || 12, |
|
|||
74 | hh: pad(H % 12 || 12), |
|
|||
75 | H: H, |
|
|||
76 | HH: pad(H), |
|
|||
77 | M: M, |
|
|||
78 | MM: pad(M), |
|
|||
79 | s: s, |
|
|||
80 | ss: pad(s), |
|
|||
81 | l: pad(L, 3), |
|
|||
82 | L: pad(L > 99 ? Math.round(L / 10) : L), |
|
|||
83 | t: H < 12 ? "a" : "p", |
|
|||
84 | tt: H < 12 ? "am" : "pm", |
|
|||
85 | T: H < 12 ? "A" : "P", |
|
|||
86 | TT: H < 12 ? "AM" : "PM", |
|
|||
87 | Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), |
|
|||
88 | o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), |
|
|||
89 | S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10] |
|
|||
90 | }; |
|
|||
91 |
|
47 | |||
92 | return mask.replace(token, function ($0) { |
|
48 | var _ = utc ? "getUTC" : "get", | |
93 | return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1); |
|
49 | d = date[_ + "Date"](), | |
94 | }); |
|
50 | D = date[_ + "Day"](), | |
95 | }; |
|
51 | m = date[_ + "Month"](), | |
96 | }(); |
|
52 | y = date[_ + "FullYear"](), | |
|
53 | H = date[_ + "Hours"](), | |||
|
54 | M = date[_ + "Minutes"](), | |||
|
55 | s = date[_ + "Seconds"](), | |||
|
56 | L = date[_ + "Milliseconds"](), | |||
|
57 | o = utc ? 0 : date.getTimezoneOffset(), | |||
|
58 | flags = { | |||
|
59 | d: d, | |||
|
60 | dd: pad(d), | |||
|
61 | ddd: dF.i18n.dayNames[D], | |||
|
62 | dddd: dF.i18n.dayNames[D + 7], | |||
|
63 | m: m + 1, | |||
|
64 | mm: pad(m + 1), | |||
|
65 | mmm: dF.i18n.monthNames[m], | |||
|
66 | mmmm: dF.i18n.monthNames[m + 12], | |||
|
67 | yy: String(y).slice(2), | |||
|
68 | yyyy: y, | |||
|
69 | h: H % 12 || 12, | |||
|
70 | hh: pad(H % 12 || 12), | |||
|
71 | H: H, | |||
|
72 | HH: pad(H), | |||
|
73 | M: M, | |||
|
74 | MM: pad(M), | |||
|
75 | s: s, | |||
|
76 | ss: pad(s), | |||
|
77 | l: pad(L, 3), | |||
|
78 | L: pad(L > 99 ? Math.round(L / 10) : L), | |||
|
79 | t: H < 12 ? "a" : "p", | |||
|
80 | tt: H < 12 ? "am" : "pm", | |||
|
81 | T: H < 12 ? "A" : "P", | |||
|
82 | TT: H < 12 ? "AM" : "PM", | |||
|
83 | Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), | |||
|
84 | o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), | |||
|
85 | S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10] | |||
|
86 | }; | |||
97 |
|
87 | |||
98 | // Some common format strings |
|
88 | return mask.replace(token, function ($0) { | |
99 | dateFormat.masks = { |
|
89 | return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1); | |
100 | "default": "ddd mmm dd yyyy HH:MM:ss", |
|
90 | }); | |
101 | shortDate: "m/d/yy", |
|
|||
102 | mediumDate: "mmm d, yyyy", |
|
|||
103 | longDate: "mmmm d, yyyy", |
|
|||
104 | fullDate: "dddd, mmmm d, yyyy", |
|
|||
105 | shortTime: "h:MM TT", |
|
|||
106 | mediumTime: "h:MM:ss TT", |
|
|||
107 | longTime: "h:MM:ss TT Z", |
|
|||
108 | isoDate: "yyyy-mm-dd", |
|
|||
109 | isoTime: "HH:MM:ss", |
|
|||
110 | isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", |
|
|||
111 | isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" |
|
|||
112 | }; |
|
91 | }; | |
|
92 | }(); | |||
113 |
|
93 | |||
114 | // Internationalization strings |
|
94 | // Some common format strings | |
115 |
|
|
95 | dateFormat.masks = { | |
116 | dayNames: [ |
|
96 | "default": "ddd mmm dd yyyy HH:MM:ss", | |
117 | "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", |
|
97 | shortDate: "m/d/yy", | |
118 | "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" |
|
98 | mediumDate: "mmm d, yyyy", | |
119 | ], |
|
99 | longDate: "mmmm d, yyyy", | |
120 | monthNames: [ |
|
100 | fullDate: "dddd, mmmm d, yyyy", | |
121 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", |
|
101 | shortTime: "h:MM TT", | |
122 | "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" |
|
102 | mediumTime: "h:MM:ss TT", | |
123 | ] |
|
103 | longTime: "h:MM:ss TT Z", | |
124 | }; |
|
104 | isoDate: "yyyy-mm-dd", | |
|
105 | isoTime: "HH:MM:ss", | |||
|
106 | isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", | |||
|
107 | isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" | |||
|
108 | }; | |||
125 |
|
109 | |||
126 | // For convenience... |
|
110 | // Internationalization strings | |
127 | Date.prototype.format = function (mask, utc) { |
|
111 | dateFormat.i18n = { | |
128 | return dateFormat(this, mask, utc); |
|
112 | dayNames: [ | |
129 | }; |
|
113 | "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", | |
|
114 | "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" | |||
|
115 | ], | |||
|
116 | monthNames: [ | |||
|
117 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", | |||
|
118 | "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" | |||
|
119 | ] | |||
|
120 | }; | |||
130 |
|
121 | |||
131 | return {'dateFormat': dateFormat}; |
|
122 | // For convenience... | |
132 | }); No newline at end of file |
|
123 | Date.prototype.format = function (mask, utc) { | |
|
124 | return dateFormat(this, mask, utc); | |||
|
125 | }; No newline at end of file |
@@ -8,16 +8,19 b' define([' | |||||
8 | ], function(IPython, $, textcell) { |
|
8 | ], function(IPython, $, textcell) { | |
9 | "use strict"; |
|
9 | "use strict"; | |
10 |
|
10 | |||
11 | /** |
|
11 | var CellToolbar = function (options) { | |
12 |
|
|
12 | // Constructor | |
13 | * @class CellToolbar |
|
13 | // | |
14 | * @param {The cell to attach the metadata UI to} cell |
|
14 | // Parameters: | |
15 | */ |
|
15 | // options: dictionary | |
16 | var CellToolbar = function (cell, events, notebook) { |
|
16 | // Dictionary of keyword arguments. | |
|
17 | // events: $(Events) instance | |||
|
18 | // cell: Cell instance | |||
|
19 | // notebook: Notebook instance | |||
17 | CellToolbar._instances.push(this); |
|
20 | CellToolbar._instances.push(this); | |
18 | this.notebook = notebook; |
|
21 | this.notebook = options.notebook; | |
19 | this.events = events; |
|
22 | this.events = options.events; | |
20 | this.cell = cell; |
|
23 | this.cell = options.cell; | |
21 | this.create_element(); |
|
24 | this.create_element(); | |
22 | this.rebuild(); |
|
25 | this.rebuild(); | |
23 | return this; |
|
26 | return this; |
@@ -129,7 +129,10 b' define([' | |||||
129 | var input = $('<div></div>').addClass('input'); |
|
129 | var input = $('<div></div>').addClass('input'); | |
130 | var prompt = $('<div/>').addClass('prompt input_prompt'); |
|
130 | var prompt = $('<div/>').addClass('prompt input_prompt'); | |
131 | var inner_cell = $('<div/>').addClass('inner_cell'); |
|
131 | var inner_cell = $('<div/>').addClass('inner_cell'); | |
132 |
this.celltoolbar = new celltoolbar.CellToolbar( |
|
132 | this.celltoolbar = new celltoolbar.CellToolbar({ | |
|
133 | cell: this, | |||
|
134 | events: this.events, | |||
|
135 | notebook: this.notebook}); | |||
133 | inner_cell.append(this.celltoolbar.element); |
|
136 | inner_cell.append(this.celltoolbar.element); | |
134 | var input_area = $('<div/>').addClass('input_area'); |
|
137 | var input_area = $('<div/>').addClass('input_area'); | |
135 | this.code_mirror = CodeMirror(input_area.get(0), this.cm_config); |
|
138 | this.code_mirror = CodeMirror(input_area.get(0), this.cm_config); | |
@@ -159,7 +162,11 b' define([' | |||||
159 | var output = $('<div></div>'); |
|
162 | var output = $('<div></div>'); | |
160 | cell.append(input).append(widget_area).append(output); |
|
163 | cell.append(input).append(widget_area).append(output); | |
161 | this.element = cell; |
|
164 | this.element = cell; | |
162 |
this.output_area = new outputarea.OutputArea( |
|
165 | this.output_area = new outputarea.OutputArea({ | |
|
166 | selector: output, | |||
|
167 | prompt_area: true, | |||
|
168 | events: this.events, | |||
|
169 | keyboard_manager: this.keyboard_manager}); | |||
163 | this.completer = new completer.Completer(this, this.events); |
|
170 | this.completer = new completer.Completer(this, this.events); | |
164 | }; |
|
171 | }; | |
165 |
|
172 |
@@ -6,7 +6,6 b' require([' | |||||
6 | 'jquery', |
|
6 | 'jquery', | |
7 | 'notebook/js/notebook', |
|
7 | 'notebook/js/notebook', | |
8 | 'base/js/utils', |
|
8 | 'base/js/utils', | |
9 | 'base/js/keyboard', |
|
|||
10 | 'base/js/page', |
|
9 | 'base/js/page', | |
11 | 'notebook/js/layoutmanager', |
|
10 | 'notebook/js/layoutmanager', | |
12 | 'base/js/events', |
|
11 | 'base/js/events', | |
@@ -24,7 +23,6 b' require([' | |||||
24 | $, |
|
23 | $, | |
25 | notebook, |
|
24 | notebook, | |
26 | utils, |
|
25 | utils, | |
27 | keyboard, |
|
|||
28 | page, |
|
26 | page, | |
29 | layoutmanager, |
|
27 | layoutmanager, | |
30 | events, |
|
28 | events, | |
@@ -134,5 +132,4 b' require([' | |||||
134 | IPython.keyboard_manager = keyboard_manager; |
|
132 | IPython.keyboard_manager = keyboard_manager; | |
135 | IPython.save_widget = save_widget; |
|
133 | IPython.save_widget = save_widget; | |
136 | IPython.config = user_config; |
|
134 | IPython.config = user_config; | |
137 | IPython.keyboard = keyboard; |
|
|||
138 | }); |
|
135 | }); |
@@ -192,7 +192,9 b' define([' | |||||
192 | that.notebook.move_cell_down(); |
|
192 | that.notebook.move_cell_down(); | |
193 | }); |
|
193 | }); | |
194 | this.element.find('#edit_nb_metadata').click(function () { |
|
194 | this.element.find('#edit_nb_metadata').click(function () { | |
195 |
that.notebook.edit_metadata( |
|
195 | that.notebook.edit_metadata({ | |
|
196 | notebook: that.notebook, | |||
|
197 | keyboard_manager: that.notebook.keyboard_manager}); | |||
196 | }); |
|
198 | }); | |
197 |
|
199 | |||
198 | // View |
|
200 | // View |
@@ -13,8 +13,6 b' define([' | |||||
13 | 'components/marked/lib/marked', |
|
13 | 'components/marked/lib/marked', | |
14 | 'notebook/js/mathjaxutils', |
|
14 | 'notebook/js/mathjaxutils', | |
15 | 'base/js/keyboard', |
|
15 | 'base/js/keyboard', | |
16 | 'components/jquery-ui/ui/minified/jquery-ui.min', |
|
|||
17 | 'components/bootstrap/js/bootstrap.min', |
|
|||
18 | ], function ( |
|
16 | ], function ( | |
19 | IPython, |
|
17 | IPython, | |
20 | $, |
|
18 | $, | |
@@ -80,11 +78,6 b' define([' | |||||
80 | }); |
|
78 | }); | |
81 | } |
|
79 | } | |
82 |
|
80 | |||
83 | // Backwards compatability. |
|
|||
84 | IPython.keyboard_manager = this.keyboard_manager; |
|
|||
85 | IPython.save_widget = this.save_widget; |
|
|||
86 | IPython.keyboard = this.keyboard; |
|
|||
87 |
|
||||
88 | this.element = $(selector); |
|
81 | this.element = $(selector); | |
89 | this.element.scroll(); |
|
82 | this.element.scroll(); | |
90 | this.element.data("notebook", this); |
|
83 | this.element.data("notebook", this); | |
@@ -314,9 +307,14 b' define([' | |||||
314 |
|
307 | |||
315 | Notebook.prototype.edit_metadata = function () { |
|
308 | Notebook.prototype.edit_metadata = function () { | |
316 | var that = this; |
|
309 | var that = this; | |
317 |
dialog.edit_metadata( |
|
310 | dialog.edit_metadata({ | |
318 |
|
|
311 | md: this.metadata, | |
319 | }, 'Notebook'); |
|
312 | callback: function (md) { | |
|
313 | that.metadata = md; | |||
|
314 | }, | |||
|
315 | name: 'Notebook', | |||
|
316 | notebook: this, | |||
|
317 | keyboard_manager: this.keyboard_manager}); | |||
320 | }; |
|
318 | }; | |
321 |
|
319 | |||
322 | // Cell indexing, retrieval, etc. |
|
320 | // Cell indexing, retrieval, etc. |
@@ -35,12 +35,12 b' define([' | |||||
35 | // if timeout <= 0 |
|
35 | // if timeout <= 0 | |
36 | // click_callback : function called if user click on notification |
|
36 | // click_callback : function called if user click on notification | |
37 | // could return false to prevent the notification to be dismissed |
|
37 | // could return false to prevent the notification to be dismissed | |
38 | NotificationWidget.prototype.set_message = function (msg, timeout, click_callback, opts) { |
|
38 | NotificationWidget.prototype.set_message = function (msg, timeout, click_callback, options) { | |
39 | opts = opts || {}; |
|
39 | options = options || {}; | |
40 | var callback = click_callback || function() {return false;}; |
|
40 | var callback = click_callback || function() {return false;}; | |
41 | var that = this; |
|
41 | var that = this; | |
42 | this.inner.attr('class', opts.icon); |
|
42 | this.inner.attr('class', options.icon); | |
43 | this.inner.attr('title', opts.title); |
|
43 | this.inner.attr('title', options.title); | |
44 | this.inner.text(msg); |
|
44 | this.inner.text(msg); | |
45 | this.element.fadeIn(100); |
|
45 | this.element.fadeIn(100); | |
46 | if (this.timeout !== null) { |
|
46 | if (this.timeout !== null) { |
@@ -17,20 +17,20 b' define([' | |||||
17 | * @constructor |
|
17 | * @constructor | |
18 | */ |
|
18 | */ | |
19 |
|
19 | |||
20 |
var OutputArea = function ( |
|
20 | var OutputArea = function (options) { | |
21 | this.selector = selector; |
|
21 | this.selector = options.selector; | |
22 | this.events = events; |
|
22 | this.events = options.events; | |
23 | this.keyboard_manager = keyboard_manager; |
|
23 | this.keyboard_manager = options.keyboard_manager; | |
24 | this.wrapper = $(selector); |
|
24 | this.wrapper = $(options.selector); | |
25 | this.outputs = []; |
|
25 | this.outputs = []; | |
26 | this.collapsed = false; |
|
26 | this.collapsed = false; | |
27 | this.scrolled = false; |
|
27 | this.scrolled = false; | |
28 | this.trusted = true; |
|
28 | this.trusted = true; | |
29 | this.clear_queued = null; |
|
29 | this.clear_queued = null; | |
30 | if (prompt_area === undefined) { |
|
30 | if (options.prompt_area === undefined) { | |
31 | this.prompt_area = true; |
|
31 | this.prompt_area = true; | |
32 | } else { |
|
32 | } else { | |
33 | this.prompt_area = prompt_area; |
|
33 | this.prompt_area = options.prompt_area; | |
34 | } |
|
34 | } | |
35 | this.create_elements(); |
|
35 | this.create_elements(); | |
36 | this.style(); |
|
36 | this.style(); |
@@ -7,7 +7,7 b' define([' | |||||
7 | 'base/js/utils', |
|
7 | 'base/js/utils', | |
8 | 'base/js/dialog', |
|
8 | 'base/js/dialog', | |
9 | 'base/js/keyboard', |
|
9 | 'base/js/keyboard', | |
10 |
'dateformat |
|
10 | 'dateformat', | |
11 | ], function(IPython, $, utils, dialog, keyboard) { |
|
11 | ], function(IPython, $, utils, dialog, keyboard) { | |
12 | "use strict"; |
|
12 | "use strict"; | |
13 |
|
13 |
@@ -76,7 +76,10 b' define([' | |||||
76 | var prompt = $('<div/>').addClass('prompt input_prompt'); |
|
76 | var prompt = $('<div/>').addClass('prompt input_prompt'); | |
77 | cell.append(prompt); |
|
77 | cell.append(prompt); | |
78 | var inner_cell = $('<div/>').addClass('inner_cell'); |
|
78 | var inner_cell = $('<div/>').addClass('inner_cell'); | |
79 |
this.celltoolbar = new celltoolbar.CellToolbar( |
|
79 | this.celltoolbar = new celltoolbar.CellToolbar({ | |
|
80 | cell: this, | |||
|
81 | events: this.events, | |||
|
82 | notebook: this.notebook}); | |||
80 | inner_cell.append(this.celltoolbar.element); |
|
83 | inner_cell.append(this.celltoolbar.element); | |
81 | var input_area = $('<div/>').addClass('input_area'); |
|
84 | var input_area = $('<div/>').addClass('input_area'); | |
82 | this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config); |
|
85 | this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config); | |
@@ -451,11 +454,11 b' define([' | |||||
451 | IPython.RawCell = RawCell; |
|
454 | IPython.RawCell = RawCell; | |
452 | IPython.HeadingCell = HeadingCell; |
|
455 | IPython.HeadingCell = HeadingCell; | |
453 |
|
456 | |||
454 |
var |
|
457 | var textcell = { | |
455 | 'TextCell': TextCell, |
|
458 | 'TextCell': TextCell, | |
456 | 'MarkdownCell': MarkdownCell, |
|
459 | 'MarkdownCell': MarkdownCell, | |
457 | 'RawCell': RawCell, |
|
460 | 'RawCell': RawCell, | |
458 | 'HeadingCell': HeadingCell, |
|
461 | 'HeadingCell': HeadingCell, | |
459 | }; |
|
462 | }; | |
460 |
return |
|
463 | return textcell; | |
461 | }); |
|
464 | }); |
@@ -24,6 +24,7 b'' | |||||
24 | backbone : 'components/backbone/backbone-min', |
|
24 | backbone : 'components/backbone/backbone-min', | |
25 | jquery: 'components/jquery/jquery.min', |
|
25 | jquery: 'components/jquery/jquery.min', | |
26 | bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min', |
|
26 | bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min', | |
|
27 | dateformat: 'dateformat/date.format', | |||
27 | }, |
|
28 | }, | |
28 | shim: { |
|
29 | shim: { | |
29 | underscore: { |
|
30 | underscore: { | |
@@ -35,6 +36,9 b'' | |||||
35 | }, |
|
36 | }, | |
36 | bootstraptour: { |
|
37 | bootstraptour: { | |
37 | exports: "Tour" |
|
38 | exports: "Tour" | |
|
39 | }, | |||
|
40 | dateformat: { | |||
|
41 | exports: "dateFormat" | |||
38 | } |
|
42 | } | |
39 | } |
|
43 | } | |
40 | }); |
|
44 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now