Show More
@@ -155,8 +155,8 define([ | |||
|
155 | 155 | /** |
|
156 | 156 | * Called when view is rendered. |
|
157 | 157 | */ |
|
158 |
this.$el.addClass(" |
|
|
159 |
this.model.on("change |
|
|
158 | this.$el.addClass("widget-valid"); | |
|
159 | this.model.on("change", this.update, this); | |
|
160 | 160 | this.update(); |
|
161 | 161 | }, |
|
162 | 162 | update: function() { |
@@ -166,17 +166,21 define([ | |||
|
166 | 166 | * Called when the model is changed. The model may have been |
|
167 | 167 | * changed by another view or by a state update from the back-end. |
|
168 | 168 | */ |
|
169 | var icon, color, readout; | |
|
169 | 170 | if (this.model.get("value")) { |
|
170 | this.$el.removeClass("fa-close").addClass("fa-check"); | |
|
171 | this.after_displayed(function() { | |
|
172 | this.$el.css("color", "green"); | |
|
173 | }, this); | |
|
171 | icon = "fa-check"; | |
|
172 | color = "green"; | |
|
173 | readout = ""; | |
|
174 | 174 | } else { |
|
175 | this.$el.removeClass("fa-check").addClass("fa-close"); | |
|
176 | this.after_displayed(function() { | |
|
177 |
|
|
|
178 |
|
|
|
179 | } | |
|
175 | icon = "fa-close"; | |
|
176 | color = "red"; | |
|
177 | readout = this.model.get("readout"); | |
|
178 | } | |
|
179 | this.$el.text(readout); | |
|
180 | $('<i class="fa"></i>').prependTo(this.$el).addClass(icon); | |
|
181 | this.after_displayed(function() { | |
|
182 | this.$el.css("color", color); | |
|
183 | }, this); | |
|
180 | 184 | } |
|
181 | 185 | }); |
|
182 | 186 |
General Comments 0
You need to be logged in to leave comments.
Login now