You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
926 B
33 lines
926 B
var $ = require('jquery');
|
|
var DeepModel = require('backbone.deepmodel');
|
|
var Messenger = require('../Shared/Messenger');
|
|
|
|
module.exports = DeepModel.extend({
|
|
test : function() {
|
|
var self = this;
|
|
|
|
this.trigger('validation:sync');
|
|
|
|
var params = {};
|
|
|
|
params.url = this.collection.url + '/test';
|
|
params.contentType = 'application/json';
|
|
params.data = JSON.stringify(this.toJSON());
|
|
params.type = 'POST';
|
|
params.isValidatedCall = true;
|
|
|
|
var promise = $.ajax(params);
|
|
|
|
Messenger.monitor({
|
|
promise : promise,
|
|
successMessage : 'Testing \'{0}\' completed'.format(this.get('name')),
|
|
errorMessage : 'Testing \'{0}\' failed'.format(this.get('name'))
|
|
});
|
|
|
|
promise.fail(function(response) {
|
|
self.trigger('validation:failed', response);
|
|
});
|
|
|
|
return promise;
|
|
}
|
|
}); |