FIX: Javascript error when uploading backup
This commit is contained in:
parent
f0dda91364
commit
7069ee16e2
|
@ -9,13 +9,8 @@
|
||||||
error="errorAction"
|
error="errorAction"
|
||||||
uploadText="UPLOAD"
|
uploadText="UPLOAD"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
@class ResumableUploadComponent
|
|
||||||
@extends Ember.Component
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
**/
|
||||||
Discourse.ResumableUploadComponent = Ember.Component.extend({
|
Discourse.ResumableUploadComponent = Ember.Component.extend(Discourse.StringBuffer, {
|
||||||
tagName: "button",
|
tagName: "button",
|
||||||
classNames: ["btn", "ru"],
|
classNames: ["btn", "ru"],
|
||||||
classNameBindings: ["isUploading"],
|
classNameBindings: ["isUploading"],
|
||||||
|
@ -25,7 +20,7 @@ Discourse.ResumableUploadComponent = Ember.Component.extend({
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
|
|
||||||
shouldRerender: Discourse.View.renderIfChanged("isUploading", "progress"),
|
rerenderTriggers: ['isUploading', 'progress'],
|
||||||
|
|
||||||
text: function() {
|
text: function() {
|
||||||
if (this.get("isUploading")) {
|
if (this.get("isUploading")) {
|
||||||
|
@ -35,7 +30,7 @@ Discourse.ResumableUploadComponent = Ember.Component.extend({
|
||||||
}
|
}
|
||||||
}.property("isUploading", "progress"),
|
}.property("isUploading", "progress"),
|
||||||
|
|
||||||
render: function(buffer) {
|
renderString: function(buffer) {
|
||||||
var icon = this.get("isUploading") ? "times" : "upload";
|
var icon = this.get("isUploading") ? "times" : "upload";
|
||||||
buffer.push("<i class='fa fa-" + icon + "'></i>");
|
buffer.push("<i class='fa fa-" + icon + "'></i>");
|
||||||
buffer.push("<span class='ru-label'>" + this.get("text") + "</span>");
|
buffer.push("<span class='ru-label'>" + this.get("text") + "</span>");
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
export default Ember.Mixin.create({
|
||||||
|
|
||||||
|
_watchProps: function() {
|
||||||
|
var args = this.get('rerenderTriggers');
|
||||||
|
if (!Ember.isNone(args)) {
|
||||||
|
var self = this;
|
||||||
|
args.forEach(function(k) {
|
||||||
|
self.addObserver(k, self.rerenderString);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}.on('init'),
|
||||||
|
|
||||||
|
render: function(buffer) {
|
||||||
|
this.renderString(buffer);
|
||||||
|
},
|
||||||
|
|
||||||
|
_rerenderString: function() {
|
||||||
|
var buffer = [];
|
||||||
|
this.renderString(buffer);
|
||||||
|
this.$().html(buffer.join(''));
|
||||||
|
},
|
||||||
|
|
||||||
|
rerenderString: function() {
|
||||||
|
Ember.run.once(this, '_rerenderString');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue