mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
rjs -> webpack
This commit is contained in:
@@ -1,38 +1,26 @@
|
||||
'use strict';
|
||||
var $ = require('jquery');
|
||||
var DeepModel = require('backbone.deepmodel');
|
||||
var Messenger = require('../Shared/Messenger');
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'backbone.deepmodel',
|
||||
'Shared/Messenger'
|
||||
], function ($, DeepModel, Messenger) {
|
||||
return DeepModel.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;
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = DeepModel.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;
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user