mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Moving styling to else statement
This commit is contained in:
parent
a70b65b5b4
commit
03b884a615
@ -59,10 +59,9 @@ define([
|
|||||||
this.$checkbox.prop('checked', this.model.get('value'));
|
this.$checkbox.prop('checked', this.model.get('value'));
|
||||||
|
|
||||||
if (options === undefined || options.updated_view != this) {
|
if (options === undefined || options.updated_view != this) {
|
||||||
var disabled = this.model.get('disabled');
|
this.$checkbox.prop("disabled", this.model.get("disabled"));
|
||||||
this.$checkbox.prop('disabled', disabled);
|
|
||||||
|
|
||||||
var description = this.model.get('description');
|
var description = this.model.get("description");
|
||||||
if (description.trim().length === 0) {
|
if (description.trim().length === 0) {
|
||||||
this.$label.hide();
|
this.$label.hide();
|
||||||
} else {
|
} else {
|
||||||
@ -123,17 +122,16 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options === undefined || options.updated_view != this) {
|
if (options === undefined || options.updated_view != this) {
|
||||||
|
this.$el.prop("disabled", this.model.get("disabled"));
|
||||||
var disabled = this.model.get('disabled');
|
|
||||||
this.$el.prop('disabled', disabled);
|
|
||||||
|
|
||||||
var description = this.model.get('description');
|
|
||||||
this.$el.attr("title", this.model.get("tooltip"));
|
this.$el.attr("title", this.model.get("tooltip"));
|
||||||
this.$el.text(description);
|
|
||||||
|
var description = this.model.get("description");
|
||||||
var icon = this.model.get("icon");
|
var icon = this.model.get("icon");
|
||||||
$('<i class="fa"></i>').prependTo(this.$el).addClass(icon);
|
|
||||||
if (description.trim().length === 0 && icon.trim().length ===0) {
|
if (description.trim().length === 0 && icon.trim().length ===0) {
|
||||||
this.$el.html(" "); // Preserve button height
|
this.$el.html(" "); // Preserve button height
|
||||||
|
} else {
|
||||||
|
this.$el.text(description);
|
||||||
|
$('<i class="fa"></i>').prependTo(this.$el).addClass(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ToggleButtonView.__super__.update.apply(this);
|
return ToggleButtonView.__super__.update.apply(this);
|
||||||
|
@ -30,18 +30,16 @@ define([
|
|||||||
* Called when the model is changed. The model may have been
|
* Called when the model is changed. The model may have been
|
||||||
* changed by another view or by a state update from the back-end.
|
* changed by another view or by a state update from the back-end.
|
||||||
*/
|
*/
|
||||||
var description = this.model.get('description');
|
this.$el.prop("disabled", this.model.get("disabled"));
|
||||||
this.$el.attr("title", this.model.get("tooltip"));
|
this.$el.attr("title", this.model.get("tooltip"));
|
||||||
this.$el.text(description);
|
|
||||||
|
var description = this.model.get("description");
|
||||||
var icon = this.model.get("icon");
|
var icon = this.model.get("icon");
|
||||||
$('<i class="fa"></i>').prependTo(this.$el).addClass(icon);
|
|
||||||
if (description.trim().length === 0 && icon.trim().length ===0) {
|
if (description.trim().length === 0 && icon.trim().length ===0) {
|
||||||
this.$el.html(" "); // Preserve button height
|
this.$el.html(" "); // Preserve button height
|
||||||
}
|
|
||||||
if (this.model.get('disabled')) {
|
|
||||||
this.$el.attr('disabled','disabled');
|
|
||||||
} else {
|
} else {
|
||||||
this.$el.removeAttr('disabled');
|
this.$el.text(description);
|
||||||
|
$('<i class="fa"></i>').prependTo(this.$el).addClass(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ButtonView.__super__.update.apply(this);
|
return ButtonView.__super__.update.apply(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user