Convert all Ajax calls to use Discourse.ajax()

This commit is contained in:
Robin Ward
2013-04-01 16:28:26 -04:00
parent 5344ab2893
commit 61b5c0340e
42 changed files with 243 additions and 247 deletions

View File

@ -4,21 +4,18 @@ Discourse.AdminApi = Discourse.Model.extend({
keyExists: function(){
var key = this.get('key') || '';
return key && key.length === this.VALID_KEY_LENGTH;
}.property('key'),
}.property('key'),
generateKey: function(){
var _this = this;
$.ajax(Discourse.getURL('/admin/api/generate_key'),{
type: 'POST'
}).success(function(result){
_this.set('key', result.key);
});
var adminApi = this;
Discourse.ajax(Discourse.getURL('/admin/api/generate_key'),{type: 'POST'}).then(function (result) {
adminApi.set('key', result.key);
});
}
});
Discourse.AdminApi.reopenClass({
find: function(){
return this.getAjax('/admin/api');
find: function() {
return this.getModelAjax('/admin/api');
}
});