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