Show More
@@ -9,11 +9,13 define([ | |||
|
9 | 9 |
|
|
10 | 10 |
|
|
11 | 11 |
|
|
12 |
|
|
|
12 | var WidgetManager = function (comm_manager, keyboard_manager, notebook) { | |
|
13 | 13 |
|
|
14 | 14 |
|
|
15 | 15 | |
|
16 | 16 |
|
|
17 | this.keyboard_manager = keyboard_manager; | |
|
18 | this.notebook = notebook; | |
|
17 | 19 |
|
|
18 | 20 |
|
|
19 | 21 | |
@@ -76,11 +78,13 define([ | |||
|
76 | 78 |
|
|
77 | 79 |
|
|
78 | 80 |
|
|
79 | IPython.keyboard_manager.register_events(view.$el); | |
|
81 | if (this.keyboard_manager) { | |
|
82 | this.keyboard_manager.register_events(view.$el); | |
|
80 | 83 |
|
|
81 | 84 |
|
|
82 | 85 |
|
|
83 |
|
|
|
86 | this.keyboard_manager.register_events(view.additional_elements[i]); | |
|
87 | } | |
|
84 | 88 |
|
|
85 | 89 |
|
|
86 | 90 |
|
@@ -111,8 +115,8 define([ | |||
|
111 | 115 |
|
|
112 | 116 |
|
|
113 | 117 |
|
|
114 |
|
|
|
115 |
|
|
|
118 | if (this.notebook) { | |
|
119 | cell = this.notebook.get_msg_cell(msg_id); | |
|
116 | 120 |
|
|
117 | 121 |
|
|
118 | 122 |
|
@@ -189,8 +193,5 define([ | |||
|
189 | 193 |
|
|
190 | 194 |
|
|
191 | 195 | |
|
192 | // For backwards compatability. | |
|
193 | IPython.WidgetManager = WidgetManager; | |
|
194 | ||
|
195 | 196 | return WidgetManager; |
|
196 | 197 |
|
@@ -208,20 +208,20 function(WidgetManager, _, Backbone){ | |||
|
208 | 208 | |
|
209 | 209 | _pack_models: function(value) { |
|
210 | 210 | // Replace models with model ids recursively. |
|
211 | var that = this; | |
|
212 | var packed; | |
|
211 | 213 | if (value instanceof Backbone.Model) { |
|
212 | 214 | return value.id; |
|
213 | 215 | |
|
214 | 216 | } else if ($.isArray(value)) { |
|
215 |
|
|
|
216 | var that = this; | |
|
217 | packed = []; | |
|
217 | 218 | _.each(value, function(sub_value, key) { |
|
218 | 219 | packed.push(that._pack_models(sub_value)); |
|
219 | 220 | }); |
|
220 | 221 | return packed; |
|
221 | 222 | |
|
222 | 223 | } else if (value instanceof Object) { |
|
223 |
|
|
|
224 | var that = this; | |
|
224 | packed = {}; | |
|
225 | 225 | _.each(value, function(sub_value, key) { |
|
226 | 226 | packed[key] = that._pack_models(sub_value); |
|
227 | 227 | }); |
@@ -3,7 +3,8 | |||
|
3 | 3 | |
|
4 | 4 | define([ |
|
5 | 5 | "widgets/js/widget", |
|
6 | ], function(widget){ | |
|
6 | "base/js/utils", | |
|
7 | ], function(widget, utils){ | |
|
7 | 8 | |
|
8 | 9 | var DropdownView = widget.DOMWidgetView.extend({ |
|
9 | 10 | render : function(){ |
@@ -226,7 +227,7 define([ | |||
|
226 | 227 | if (item.trim().length == 0) { |
|
227 | 228 | item_html = " "; |
|
228 | 229 | } else { |
|
229 |
item_html = |
|
|
230 | item_html = utils.escape_html(item); | |
|
230 | 231 | } |
|
231 | 232 | var item_query = '[data-value="' + item + '"]'; |
|
232 | 233 | var $item_element = that.$buttongroup.find(item_query); |
@@ -3,12 +3,13 | |||
|
3 | 3 | |
|
4 | 4 | define([ |
|
5 | 5 | "widgets/js/widget", |
|
6 | ], function(widget){ | |
|
6 | "base/js/utils", | |
|
7 | ], function(widget, utils){ | |
|
7 | 8 | |
|
8 | 9 | var AccordionView = widget.DOMWidgetView.extend({ |
|
9 | 10 | render: function(){ |
|
10 | 11 | // Called when view is rendered. |
|
11 |
var guid = 'panel-group' + |
|
|
12 | var guid = 'panel-group' + utils.uuid(); | |
|
12 | 13 | this.$el |
|
13 | 14 | .attr('id', guid) |
|
14 | 15 | .addClass('panel-group'); |
@@ -88,7 +89,7 define([ | |||
|
88 | 89 | // Called when a child is added to children list. |
|
89 | 90 | var view = this.create_child_view(model); |
|
90 | 91 | var index = this.containers.length; |
|
91 |
var uuid = |
|
|
92 | var uuid = utils.uuid(); | |
|
92 | 93 | var accordion_group = $('<div />') |
|
93 | 94 | .addClass('panel panel-default') |
|
94 | 95 | .appendTo(this.$el); |
@@ -141,7 +142,7 define([ | |||
|
141 | 142 | |
|
142 | 143 | render: function(){ |
|
143 | 144 | // Called when view is rendered. |
|
144 |
var uuid = 'tabs'+ |
|
|
145 | var uuid = 'tabs'+utils.uuid(); | |
|
145 | 146 | var that = this; |
|
146 | 147 | this.$tabs = $('<div />', {id: uuid}) |
|
147 | 148 | .addClass('nav') |
@@ -189,7 +190,7 define([ | |||
|
189 | 190 | // Called when a child is added to children list. |
|
190 | 191 | var view = this.create_child_view(model); |
|
191 | 192 | var index = this.containers.length; |
|
192 |
var uuid = |
|
|
193 | var uuid = utils.uuid(); | |
|
193 | 194 | |
|
194 | 195 | var that = this; |
|
195 | 196 | var tab = $('<li />') |
General Comments 0
You need to be logged in to leave comments.
Login now