mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-19 21:46:50 -04:00
moved mixins to require.js
This commit is contained in:
+16
-13
@@ -1,23 +1,26 @@
|
||||
//try to add ajax data as query string to DELETE calls.
|
||||
"use strict";
|
||||
define(['jquery'], function () {
|
||||
define(function () {
|
||||
|
||||
var original = Backbone.ajax;
|
||||
return function () {
|
||||
|
||||
Backbone.ajax = function () {
|
||||
var original = this.ajax;
|
||||
this.ajax = function () {
|
||||
|
||||
var xhr = arguments[0];
|
||||
var xhr = arguments[0];
|
||||
|
||||
//check if ajax call was made with data option
|
||||
if (xhr && xhr.data && xhr.type === 'DELETE') {
|
||||
if (xhr.url.indexOf('?') === -1) {
|
||||
xhr.url = xhr.url + '?' + $.param(xhr.data);
|
||||
//check if ajax call was made with data option
|
||||
if (xhr && xhr.data && xhr.type === 'DELETE') {
|
||||
if (xhr.url.indexOf('?') === -1) {
|
||||
xhr.url = xhr.url + '?' + $.param(xhr.data);
|
||||
}
|
||||
else {
|
||||
xhr.url = xhr.url + '&' + $.param(xhr.data);
|
||||
}
|
||||
}
|
||||
else {
|
||||
xhr.url = xhr.url + '&' + $.param(xhr.data);
|
||||
}
|
||||
}
|
||||
|
||||
return original.apply(this, arguments);
|
||||
return original.apply(this, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
define(['templates'], function (Templates) {
|
||||
return function () {
|
||||
this.get = function (templateId) {
|
||||
|
||||
var templateKey = templateId.toLowerCase();
|
||||
|
||||
var templateFunction = Templates[templateKey];
|
||||
|
||||
if (!templateFunction) {
|
||||
throw 'couldn\'t find pre-compiled template ' + templateKey;
|
||||
}
|
||||
|
||||
return function (data) {
|
||||
|
||||
try {
|
||||
return templateFunction(data);
|
||||
}
|
||||
catch (error) {
|
||||
console.error('template render failed for ' + templateKey + ' ' + error);
|
||||
console.error(data);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user