Cache custom profiles
This commit is contained in:
parent
a77413e1eb
commit
f331773363
2 changed files with 12 additions and 3 deletions
|
|
@ -82,11 +82,15 @@ BR.Profile = L.Evented.extend({
|
||||||
$(button).button('uploading');
|
$(button).button('uploading');
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
|
var that = this;
|
||||||
this.fire('update', {
|
this.fire('update', {
|
||||||
profileText: profile,
|
profileText: profile,
|
||||||
callback: function() {
|
callback: function(err, profileId, profileText) {
|
||||||
$(button).button('reset');
|
$(button).button('reset');
|
||||||
$(button).blur();
|
$(button).blur();
|
||||||
|
if (!err) {
|
||||||
|
that.cache[profileId] = profileText;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -116,9 +120,14 @@ BR.Profile = L.Evented.extend({
|
||||||
|
|
||||||
_save: function(evt) {
|
_save: function(evt) {
|
||||||
var profileText = this._buildCustomProfile();
|
var profileText = this._buildCustomProfile();
|
||||||
|
var that = this;
|
||||||
this.fire('update', {
|
this.fire('update', {
|
||||||
profileText: profileText,
|
profileText: profileText,
|
||||||
callback: function() {}
|
callback: function(err, profileId, profileText) {
|
||||||
|
if (!err) {
|
||||||
|
that.cache[profileId] = profileText;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt.callback) {
|
if (evt.callback) {
|
||||||
evt.callback();
|
evt.callback(err, profileId, evt.profileText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue