##// END OF EJS Templates
Added support for multiple lines in button-like widgets
Jonathan Frederic -
Show More
@@ -38,11 +38,12 b' define(["notebook/js/widget"], function(){'
38 // Frontent -> Frontend Sync
38 // Frontent -> Frontend Sync
39 update : function(){
39 update : function(){
40 var description = this.model.get('description');
40 var description = this.model.get('description');
41 description.replace(' ', ' ')
41 description = description.replace(' ', ' ');
42 description = description.replace('\n', '<br>\n');
42 if (description.length == 0) {
43 if (description.length == 0) {
43 this.$el.html('&nbsp;'); // Preserve button height
44 this.$el.html('&nbsp;'); // Preserve button height
44 } else {
45 } else {
45 this.$el.html(this.model.get('description'));
46 this.$el.html(description);
46 }
47 }
47
48
48 return IPython.WidgetView.prototype.update.call(this);
49 return IPython.WidgetView.prototype.update.call(this);
@@ -60,11 +60,12 b' define(["notebook/js/widget"], function(){'
60 update : function(){
60 update : function(){
61
61
62 var selected_item_text = this.model.get('value');
62 var selected_item_text = this.model.get('value');
63 selected_item_text.replace(' ', '&nbsp;');
63 selected_item_text = selected_item_text.replace(' ', '&nbsp;');
64 selected_item_text = selected_item_text.replace('\n', '<br>\n');
64 if (selected_item_text.length == 0) {
65 if (selected_item_text.length == 0) {
65 this.$droplabel.html('&nbsp;');
66 this.$droplabel.html('&nbsp;');
66 } else {
67 } else {
67 this.$droplabel.html(this.model.get('value'));
68 this.$droplabel.html(selected_item_text);
68 }
69 }
69
70
70 var items = this.model.get('values');
71 var items = this.model.get('values');
General Comments 0
You need to be logged in to leave comments. Login now