Show More
@@ -59,10 +59,9 b' define([' | |||||
59 | this.$checkbox.prop('checked', this.model.get('value')); |
|
59 | this.$checkbox.prop('checked', this.model.get('value')); | |
60 |
|
60 | |||
61 | if (options === undefined || options.updated_view != this) { |
|
61 | if (options === undefined || options.updated_view != this) { | |
62 |
|
|
62 | this.$checkbox.prop("disabled", this.model.get("disabled")); | |
63 | this.$checkbox.prop('disabled', disabled); |
|
|||
64 |
|
63 | |||
65 |
var description = this.model.get( |
|
64 | var description = this.model.get("description"); | |
66 | if (description.trim().length === 0) { |
|
65 | if (description.trim().length === 0) { | |
67 | this.$label.hide(); |
|
66 | this.$label.hide(); | |
68 | } else { |
|
67 | } else { | |
@@ -113,7 +112,7 b' define([' | |||||
113 | /** |
|
112 | /** | |
114 | * Update the contents of this view |
|
113 | * Update the contents of this view | |
115 | * |
|
114 | * | |
116 |
* Called when the model is changed. |
|
115 | * Called when the model is changed. The model may have been | |
117 | * changed by another view or by a state update from the back-end. |
|
116 | * changed by another view or by a state update from the back-end. | |
118 | */ |
|
117 | */ | |
119 | if (this.model.get('value')) { |
|
118 | if (this.model.get('value')) { | |
@@ -123,17 +122,16 b' define([' | |||||
123 | } |
|
122 | } | |
124 |
|
123 | |||
125 | if (options === undefined || options.updated_view != this) { |
|
124 | if (options === undefined || options.updated_view != this) { | |
126 |
|
125 | this.$el.prop("disabled", this.model.get("disabled")); | ||
127 | var disabled = this.model.get('disabled'); |
|
|||
128 | this.$el.prop('disabled', disabled); |
|
|||
129 |
|
||||
130 | var description = this.model.get('description'); |
|
|||
131 | this.$el.attr("title", this.model.get("tooltip")); |
|
126 | this.$el.attr("title", this.model.get("tooltip")); | |
132 | this.$el.text(description); |
|
127 | ||
|
128 | var description = this.model.get("description"); | |||
133 | var icon = this.model.get("icon"); |
|
129 | var icon = this.model.get("icon"); | |
134 | $('<i class="fa"></i>').prependTo(this.$el).addClass(icon); |
|
|||
135 | if (description.trim().length === 0 && icon.trim().length ===0) { |
|
130 | if (description.trim().length === 0 && icon.trim().length ===0) { | |
136 | this.$el.html(" "); // Preserve button height |
|
131 | this.$el.html(" "); // Preserve button height | |
|
132 | } else { | |||
|
133 | this.$el.text(description); | |||
|
134 | $('<i class="fa"></i>').prependTo(this.$el).addClass(icon); | |||
137 | } |
|
135 | } | |
138 | } |
|
136 | } | |
139 | return ToggleButtonView.__super__.update.apply(this); |
|
137 | return ToggleButtonView.__super__.update.apply(this); |
@@ -27,21 +27,19 b' define([' | |||||
27 | /** |
|
27 | /** | |
28 | * Update the contents of this view |
|
28 | * Update the contents of this view | |
29 | * |
|
29 | * | |
30 |
* Called when the model is changed. |
|
30 | * Called when the model is changed. The model may have been | |
31 | * changed by another view or by a state update from the back-end. |
|
31 | * changed by another view or by a state update from the back-end. | |
32 | */ |
|
32 | */ | |
33 | var description = this.model.get('description'); |
|
33 | this.$el.prop("disabled", this.model.get("disabled")); | |
34 | this.$el.attr("title", this.model.get("tooltip")); |
|
34 | this.$el.attr("title", this.model.get("tooltip")); | |
35 | this.$el.text(description); |
|
35 | ||
|
36 | var description = this.model.get("description"); | |||
36 | var icon = this.model.get("icon"); |
|
37 | var icon = this.model.get("icon"); | |
37 | $('<i class="fa"></i>').prependTo(this.$el).addClass(icon); |
|
|||
38 | if (description.trim().length === 0 && icon.trim().length ===0) { |
|
38 | if (description.trim().length === 0 && icon.trim().length ===0) { | |
39 | this.$el.html(" "); // Preserve button height |
|
39 | this.$el.html(" "); // Preserve button height | |
40 | } |
|
|||
41 | if (this.model.get('disabled')) { |
|
|||
42 | this.$el.attr('disabled','disabled'); |
|
|||
43 | } else { |
|
40 | } else { | |
44 |
this.$el. |
|
41 | this.$el.text(description); | |
|
42 | $('<i class="fa"></i>').prependTo(this.$el).addClass(icon); | |||
45 | } |
|
43 | } | |
46 |
|
44 | |||
47 | return ButtonView.__super__.update.apply(this); |
|
45 | return ButtonView.__super__.update.apply(this); |
General Comments 0
You need to be logged in to leave comments.
Login now