handle space-only strings, not just zero-length

pull/37/head
MinRK 12 years ago
parent c50096334c
commit 0eff2bb651

@ -56,7 +56,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
this.$checkbox.prop('disabled', disabled);
var description = this.model.get('description');
if (description.length === 0) {
if (description.trim().length === 0) {
this.$label.hide();
} else {
this.$label.text(description);
@ -102,7 +102,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
this.$el.prop('disabled', disabled);
var description = this.model.get('description');
if (description.length === 0) {
if (description.trim().length === 0) {
this.$el.html(" "); // Preserve button height
} else {
this.$el.text(description);

@ -236,14 +236,14 @@ define(["notebook/js/widgets/widget"], function(WidgetManager) {
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
var description = this.model.get('description');
if (description.length === 0) {
if (description.trim().length === 0) {
this.$title.html(" "); // Preserve title height
} else {
this.$title.text(description);
}
var button_text = this.model.get('button_text');
if (button_text.length === 0) {
if (button_text.trim().length === 0) {
this.$show_button.html(" "); // Preserve button height
} else {
this.$show_button.text(button_text);

Loading…
Cancel
Save