basic api support

This commit is contained in:
Sam
2013-03-25 18:04:28 -07:00
parent a177264114
commit c57ec611e1
16 changed files with 144 additions and 1 deletions

View File

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