##// END OF EJS Templates
Replace .html with .text everywhere possible
Jonathan Frederic -
Show More
@@ -59,7 +59,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
59 if (description.length === 0) {
59 if (description.length === 0) {
60 this.$label.hide();
60 this.$label.hide();
61 } else {
61 } else {
62 this.$label.html(description);
62 this.$label.text(description);
63 this.$label.show();
63 this.$label.show();
64 }
64 }
65 }
65 }
@@ -103,9 +103,9 define(["notebook/js/widgets/widget"], function(WidgetManager){
103
103
104 var description = this.model.get('description');
104 var description = this.model.get('description');
105 if (description.length === 0) {
105 if (description.length === 0) {
106 this.$el.html(' '); // Preserve button height
106 this.$el.text(' '); // Preserve button height
107 } else {
107 } else {
108 this.$el.html(description);
108 this.$el.text(description);
109 }
109 }
110 }
110 }
111 return ToggleButtonView.__super__.update.apply(this);
111 return ToggleButtonView.__super__.update.apply(this);
@@ -31,12 +31,10 define(["notebook/js/widgets/widget"], function(WidgetManager){
31 // Called when the model is changed. The model may have been
31 // Called when the model is changed. The model may have been
32 // changed by another view or by a state update from the back-end.
32 // changed by another view or by a state update from the back-end.
33 var description = this.model.get('description');
33 var description = this.model.get('description');
34 description = description.replace(/ /g, ' ', 'm');
35 description = description.replace(/\n/g, '<br>\n', 'm');
36 if (description.length === 0) {
34 if (description.length === 0) {
37 this.$el.html('&nbsp;'); // Preserve button height
35 this.$el.text(' '); // Preserve button height
38 } else {
36 } else {
39 this.$el.html(description);
37 this.$el.text(description);
40 }
38 }
41
39
42 if (this.model.get('disabled')) {
40 if (this.model.get('disabled')) {
@@ -71,7 +71,6 define(["notebook/js/widgets/widget"], function(WidgetManager) {
71 }, this);
71 }, this);
72
72
73 this.$el
73 this.$el
74 .html('')
75 .on("remove", function(){
74 .on("remove", function(){
76 that.$window.remove();
75 that.$window.remove();
77 });
76 });
@@ -135,7 +134,7 define(["notebook/js/widgets/widget"], function(WidgetManager) {
135 });
134 });
136 this.$title = $('<div />')
135 this.$title = $('<div />')
137 .addClass('widget-modal-title')
136 .addClass('widget-modal-title')
138 .html('&nbsp;')
137 .text(' ')
139 .appendTo(this.$title_bar);
138 .appendTo(this.$title_bar);
140 this.$body = $('<div />')
139 this.$body = $('<div />')
141 .addClass('modal-body')
140 .addClass('modal-body')
@@ -144,7 +143,7 define(["notebook/js/widgets/widget"], function(WidgetManager) {
144 .appendTo(this.$window);
143 .appendTo(this.$window);
145
144
146 this.$show_button = $('<button />')
145 this.$show_button = $('<button />')
147 .html('&nbsp;')
146 .text(' ')
148 .addClass('btn btn-info widget-modal-show')
147 .addClass('btn btn-info widget-modal-show')
149 .appendTo(this.$el)
148 .appendTo(this.$el)
150 .click(function(){
149 .click(function(){
@@ -227,21 +226,17 define(["notebook/js/widgets/widget"], function(WidgetManager) {
227 // Called when the model is changed. The model may have been
226 // Called when the model is changed. The model may have been
228 // changed by another view or by a state update from the back-end.
227 // changed by another view or by a state update from the back-end.
229 var description = this.model.get('description');
228 var description = this.model.get('description');
230 description = description.replace(/ /g, '&nbsp;', 'm');
231 description = description.replace(/\n/g, '<br>\n', 'm');
232 if (description.length === 0) {
229 if (description.length === 0) {
233 this.$title.html('&nbsp;'); // Preserve title height
230 this.$title.text(' '); // Preserve title height
234 } else {
231 } else {
235 this.$title.html(description);
232 this.$title.text(description);
236 }
233 }
237
234
238 var button_text = this.model.get('button_text');
235 var button_text = this.model.get('button_text');
239 button_text = button_text.replace(/ /g, '&nbsp;', 'm');
240 button_text = button_text.replace(/\n/g, '<br>\n', 'm');
241 if (button_text.length === 0) {
236 if (button_text.length === 0) {
242 this.$show_button.html('&nbsp;'); // Preserve button height
237 this.$show_button.text(' '); // Preserve button height
243 } else {
238 } else {
244 this.$show_button.html(button_text);
239 this.$show_button.text(button_text);
245 }
240 }
246
241
247 if (!this._shown_once) {
242 if (!this._shown_once) {
@@ -100,7 +100,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
100 if (description.length === 0) {
100 if (description.length === 0) {
101 this.$label.hide();
101 this.$label.hide();
102 } else {
102 } else {
103 this.$label.html(description);
103 this.$label.text(description);
104 this.$label.show();
104 this.$label.show();
105 }
105 }
106 }
106 }
@@ -162,7 +162,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
162 if (description.length === 0) {
162 if (description.length === 0) {
163 this.$label.hide();
163 this.$label.hide();
164 } else {
164 } else {
165 this.$label.html(description);
165 this.$label.text(description);
166 this.$label.show();
166 this.$label.show();
167 }
167 }
168 }
168 }
@@ -257,7 +257,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
257 if (description.length === 0) {
257 if (description.length === 0) {
258 this.$label.hide();
258 this.$label.hide();
259 } else {
259 } else {
260 this.$label.html(description);
260 this.$label.text(description);
261 this.$label.show();
261 this.$label.show();
262 }
262 }
263 return ProgressView.__super__.update.apply(this);
263 return ProgressView.__super__.update.apply(this);
@@ -99,7 +99,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
99 if (description.length === 0) {
99 if (description.length === 0) {
100 this.$label.hide();
100 this.$label.hide();
101 } else {
101 } else {
102 this.$label.html(description);
102 this.$label.text(description);
103 this.$label.show();
103 this.$label.show();
104 }
104 }
105 }
105 }
@@ -161,7 +161,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
161 if (description.length === 0) {
161 if (description.length === 0) {
162 this.$label.hide();
162 this.$label.hide();
163 } else {
163 } else {
164 this.$label.html(description);
164 this.$label.text(description);
165 this.$label.show();
165 this.$label.show();
166 }
166 }
167 }
167 }
@@ -20,8 +20,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
20 render : function(){
20 render : function(){
21 // Called when view is rendered.
21 // Called when view is rendered.
22 this.$el
22 this.$el
23 .addClass('widget-hbox-single')
23 .addClass('widget-hbox-single');
24 .html('');
25 this.$label = $('<div />')
24 this.$label = $('<div />')
26 .appendTo(this.$el)
25 .appendTo(this.$el)
27 .addClass('widget-hlabel')
26 .addClass('widget-hlabel')
@@ -34,14 +33,14 define(["notebook/js/widgets/widget"], function(WidgetManager){
34 this.$droplabel = $('<button />')
33 this.$droplabel = $('<button />')
35 .addClass('btn')
34 .addClass('btn')
36 .addClass('widget-combo-btn')
35 .addClass('widget-combo-btn')
37 .html('&nbsp;')
36 .text(' ')
38 .appendTo(this.$buttongroup);
37 .appendTo(this.$buttongroup);
39 this.$dropbutton = $('<button />')
38 this.$dropbutton = $('<button />')
40 .addClass('btn')
39 .addClass('btn')
41 .addClass('dropdown-toggle')
40 .addClass('dropdown-toggle')
42 .addClass('widget-combo-carrot-btn')
41 .addClass('widget-combo-carrot-btn')
43 .attr('data-toggle', 'dropdown')
42 .attr('data-toggle', 'dropdown')
44 .html('<span class="caret"></span>')
43 .append($('<span />').addClass("caret"))
45 .appendTo(this.$buttongroup);
44 .appendTo(this.$buttongroup);
46 this.$droplist = $('<ul />')
45 this.$droplist = $('<ul />')
47 .addClass('dropdown-menu')
46 .addClass('dropdown-menu')
@@ -59,12 +58,10 define(["notebook/js/widgets/widget"], function(WidgetManager){
59
58
60 if (options === undefined || options.updated_view != this) {
59 if (options === undefined || options.updated_view != this) {
61 var selected_item_text = this.model.get('value');
60 var selected_item_text = this.model.get('value');
62 selected_item_text = selected_item_text.replace(/ /g, '&nbsp;');
63 selected_item_text = selected_item_text.replace(/\n/g, '<br>\n');
64 if (selected_item_text.length === 0) {
61 if (selected_item_text.length === 0) {
65 this.$droplabel.html('&nbsp;');
62 this.$droplabel.text(' ');
66 } else {
63 } else {
67 this.$droplabel.html(selected_item_text);
64 this.$droplabel.text(selected_item_text);
68 }
65 }
69
66
70 var items = this.model.get('values');
67 var items = this.model.get('values');
@@ -73,7 +70,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
73 for (var index in items) {
70 for (var index in items) {
74 var that = this;
71 var that = this;
75 var item_button = $('<a href="#"/>')
72 var item_button = $('<a href="#"/>')
76 .html(items[index])
73 .text(items[index])
77 .on('click', $.proxy(this.handle_click, this));
74 .on('click', $.proxy(this.handle_click, this));
78 $replace_droplist.append($('<li />').append(item_button));
75 $replace_droplist.append($('<li />').append(item_button));
79 }
76 }
@@ -97,7 +94,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
97 if (description.length === 0) {
94 if (description.length === 0) {
98 this.$label.hide();
95 this.$label.hide();
99 } else {
96 } else {
100 this.$label.html(description);
97 this.$label.text(description);
101 this.$label.show();
98 this.$label.show();
102 }
99 }
103 }
100 }
@@ -109,7 +106,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
109
106
110 // Calling model.set will trigger all of the other views of the
107 // Calling model.set will trigger all of the other views of the
111 // model to update.
108 // model to update.
112 this.model.set('value', $(e.target).html(), {updated_view: this});
109 this.model.set('value', $(e.target).text(), {updated_view: this});
113 this.touch();
110 this.touch();
114 },
111 },
115
112
@@ -148,7 +145,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
148 if (this.$el.find(item_query).length === 0) {
145 if (this.$el.find(item_query).length === 0) {
149 var $label = $('<label />')
146 var $label = $('<label />')
150 .addClass('radio')
147 .addClass('radio')
151 .html(items[index])
148 .text(items[index])
152 .appendTo(this.$container);
149 .appendTo(this.$container);
153
150
154 $('<input />')
151 $('<input />')
@@ -188,7 +185,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
188 if (description.length === 0) {
185 if (description.length === 0) {
189 this.$label.hide();
186 this.$label.hide();
190 } else {
187 } else {
191 this.$label.html(description);
188 this.$label.text(description);
192 this.$label.show();
189 this.$label.show();
193 }
190 }
194 }
191 }
@@ -239,7 +236,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
239 $('<button />')
236 $('<button />')
240 .attr('type', 'button')
237 .attr('type', 'button')
241 .addClass('btn')
238 .addClass('btn')
242 .html(items[index])
239 .text(items[index])
243 .appendTo(this.$buttongroup)
240 .appendTo(this.$buttongroup)
244 .on('click', $.proxy(this.handle_click, this));
241 .on('click', $.proxy(this.handle_click, this));
245 }
242 }
@@ -255,7 +252,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
255
252
256 // Remove items that no longer exist.
253 // Remove items that no longer exist.
257 this.$buttongroup.find('button').each(function(i, obj) {
254 this.$buttongroup.find('button').each(function(i, obj) {
258 var value = $(obj).html();
255 var value = $(obj).text();
259 var found = false;
256 var found = false;
260 for (var index in items) {
257 for (var index in items) {
261 if (items[index] == value) {
258 if (items[index] == value) {
@@ -273,7 +270,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
273 if (description.length === 0) {
270 if (description.length === 0) {
274 this.$label.hide();
271 this.$label.hide();
275 } else {
272 } else {
276 this.$label.html(description);
273 this.$label.text(description);
277 this.$label.show();
274 this.$label.show();
278 }
275 }
279 }
276 }
@@ -285,7 +282,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
285
282
286 // Calling model.set will trigger all of the other views of the
283 // Calling model.set will trigger all of the other views of the
287 // model to update.
284 // model to update.
288 this.model.set('value', $(e.target).html(), {updated_view: this});
285 this.model.set('value', $(e.target).text(), {updated_view: this});
289 this.touch();
286 this.touch();
290 },
287 },
291 });
288 });
@@ -321,7 +318,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
321 var item_query = ' :contains("' + items[index] + '")';
318 var item_query = ' :contains("' + items[index] + '")';
322 if (this.$listbox.find(item_query).length === 0) {
319 if (this.$listbox.find(item_query).length === 0) {
323 $('<option />')
320 $('<option />')
324 .html(items[index])
321 .text(items[index])
325 .attr('value', items[index])
322 .attr('value', items[index])
326 .appendTo(this.$listbox)
323 .appendTo(this.$listbox)
327 .on('click', $.proxy(this.handle_click, this));
324 .on('click', $.proxy(this.handle_click, this));
@@ -337,7 +334,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
337
334
338 // Remove items that no longer exist.
335 // Remove items that no longer exist.
339 this.$listbox.find('option').each(function(i, obj) {
336 this.$listbox.find('option').each(function(i, obj) {
340 var value = $(obj).html();
337 var value = $(obj).text();
341 var found = false;
338 var found = false;
342 for (var index in items) {
339 for (var index in items) {
343 if (items[index] == value) {
340 if (items[index] == value) {
@@ -355,7 +352,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
355 if (description.length === 0) {
352 if (description.length === 0) {
356 this.$label.hide();
353 this.$label.hide();
357 } else {
354 } else {
358 this.$label.html(description);
355 this.$label.text(description);
359 this.$label.show();
356 this.$label.show();
360 }
357 }
361 }
358 }
@@ -367,7 +364,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
367
364
368 // Calling model.set will trigger all of the other views of the
365 // Calling model.set will trigger all of the other views of the
369 // model to update.
366 // model to update.
370 this.model.set('value', $(e.target).html(), {updated_view: this});
367 this.model.set('value', $(e.target).text(), {updated_view: this});
371 this.touch();
368 this.touch();
372 },
369 },
373 });
370 });
@@ -46,7 +46,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
46 accordian
46 accordian
47 .find('.accordion-heading')
47 .find('.accordion-heading')
48 .find('.accordion-toggle')
48 .find('.accordion-toggle')
49 .html(titles[page_index]);
49 .text(titles[page_index]);
50 }
50 }
51 }
51 }
52
52
@@ -107,7 +107,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
107 that.model.set("selected_index", index, {updated_view: this});
107 that.model.set("selected_index", index, {updated_view: this});
108 that.touch();
108 that.touch();
109 })
109 })
110 .html('Page ' + index)
110 .text('Page ' + index)
111 .appendTo(accordion_heading);
111 .appendTo(accordion_heading);
112 var accordion_body = $('<div />', {id: uuid})
112 var accordion_body = $('<div />', {id: uuid})
113 .addClass('accordion-body collapse')
113 .addClass('accordion-body collapse')
@@ -190,7 +190,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
190 var tab_text = $('<a />')
190 var tab_text = $('<a />')
191 .attr('href', '#' + uuid)
191 .attr('href', '#' + uuid)
192 .attr('data-toggle', 'tab')
192 .attr('data-toggle', 'tab')
193 .html('Page ' + index)
193 .text('Page ' + index)
194 .appendTo(tab)
194 .appendTo(tab)
195 .click(function (e) {
195 .click(function (e) {
196
196
@@ -221,7 +221,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
221 for (var page_index in titles) {
221 for (var page_index in titles) {
222 var tab_text = this.containers[page_index];
222 var tab_text = this.containers[page_index];
223 if (tab_text !== undefined) {
223 if (tab_text !== undefined) {
224 tab_text.html(titles[page_index]);
224 tab_text.text(titles[page_index]);
225 }
225 }
226 }
226 }
227
227
@@ -27,7 +27,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
27 //
27 //
28 // Called when the model is changed. The model may have been
28 // Called when the model is changed. The model may have been
29 // changed by another view or by a state update from the back-end.
29 // changed by another view or by a state update from the back-end.
30 this.$el.html(this.model.get('value'));
30 this.$el.html(this.model.get('value')); // CAUTION! .html(...) CALL MANDITORY!!!
31 return HTMLView.__super__.update.apply(this);
31 return HTMLView.__super__.update.apply(this);
32 },
32 },
33 });
33 });
@@ -45,7 +45,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
45 //
45 //
46 // Called when the model is changed. The model may have been
46 // Called when the model is changed. The model may have been
47 // changed by another view or by a state update from the back-end.
47 // changed by another view or by a state update from the back-end.
48 this.$el.html(this.model.get('value'));
48 this.$el.text(this.model.get('value'));
49 MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$el.get(0)]);
49 MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$el.get(0)]);
50
50
51 return LatexView.__super__.update.apply(this);
51 return LatexView.__super__.update.apply(this);
@@ -58,8 +58,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
58 render: function(){
58 render: function(){
59 // Called when view is rendered.
59 // Called when view is rendered.
60 this.$el
60 this.$el
61 .addClass('widget-hbox')
61 .addClass('widget-hbox');
62 .html('');
63 this.$label = $('<div />')
62 this.$label = $('<div />')
64 .appendTo(this.$el)
63 .appendTo(this.$el)
65 .addClass('widget-hlabel')
64 .addClass('widget-hlabel')
@@ -101,7 +100,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
101 if (description.length === 0) {
100 if (description.length === 0) {
102 this.$label.hide();
101 this.$label.hide();
103 } else {
102 } else {
104 this.$label.html(description);
103 this.$label.text(description);
105 this.$label.show();
104 this.$label.show();
106 }
105 }
107 }
106 }
@@ -131,8 +130,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
131 render: function(){
130 render: function(){
132 // Called when view is rendered.
131 // Called when view is rendered.
133 this.$el
132 this.$el
134 .addClass('widget-hbox-single')
133 .addClass('widget-hbox-single');
135 .html('');
136 this.$label = $('<div />')
134 this.$label = $('<div />')
137 .addClass('widget-hlabel')
135 .addClass('widget-hlabel')
138 .appendTo(this.$el)
136 .appendTo(this.$el)
@@ -162,7 +160,7 define(["notebook/js/widgets/widget"], function(WidgetManager){
162 if (description.length === 0) {
160 if (description.length === 0) {
163 this.$label.hide();
161 this.$label.hide();
164 } else {
162 } else {
165 this.$label.html(description);
163 this.$label.text(description);
166 this.$label.show();
164 this.$label.show();
167 }
165 }
168 }
166 }
General Comments 0
You need to be logged in to leave comments. Login now