fixed more require issues

pull/3113/head
kay.one 12 years ago
parent d1c279d3cd
commit 0ae1865dd8

@ -76,7 +76,7 @@ module.exports = function (grunt) {
handlebars: { handlebars: {
options: { options: {
namespace : "Templates", namespace : "T",
partialRegex: /Partial.html/, partialRegex: /Partial.html/,
wrapped : true, wrapped : true,
amd : true, amd : true,

@ -1,26 +1,30 @@
"use strict"; "use strict";
define(['app', 'marionette', 'handlebars', 'templates'], function (App, Marionette, HandleBars, Templates) { define(['templates'], function (Templates) {
Marionette.TemplateCache.get = function (templateId) { return function () {
this.get = function (templateId) {
var templateKey = templateId.toLowerCase(); var templateKey = templateId.toLowerCase();
var templateFunction = Templates[templateKey]; var templateFunction = Templates[templateKey];
if (!templateFunction) { if (!templateFunction) {
throw 'couldn\'t find pre-compiled template ' + templateKey; throw 'couldn\'t find pre-compiled template ' + templateKey;
} }
return function (data) { return function (data) {
try { try {
return templateFunction(data); return templateFunction(data);
} }
catch (error) { catch (error) {
console.error('template render failed for ' + templateKey + ' ' + error); console.error('template render failed for ' + templateKey + ' ' + error);
console.error(data); console.error(data);
throw error; throw error;
} }
};
}; };
}; };
}); });

@ -98,12 +98,15 @@
return finalObj; return finalObj;
}; };
_.mixin({ require(['underscore'], function (_) {
deepClone: deepClone,
isBasicObject: isBasicObject, _.mixin({
basicObjects: basicObjects, deepClone : deepClone,
arrays: arrays, isBasicObject: isBasicObject,
deepExtend: deepExtend basicObjects : basicObjects,
arrays : arrays,
deepExtend : deepExtend
});
}); });
}).call(this); }).call(this);

@ -1,6 +1,6 @@
"use strict"; "use strict";
define(['app'], function () { define(['app','backgrid'], function () {
NzbDrone.Release.DownloadReportCell = Backgrid.Cell.extend({ NzbDrone.Release.DownloadReportCell = Backgrid.Cell.extend({
className: "download-report-cell", className: "download-report-cell",

@ -1,6 +1,6 @@
"use strict"; "use strict";
define(['marionette'], function () { define(['marionette', 'bootstrap'], function (Marionette) {
return Backbone.Marionette.Region.extend({ return Marionette.Region.extend({
el: "#modal-region", el: "#modal-region",
constructor: function () { constructor: function () {

@ -39,38 +39,33 @@ require.config({
}, },
'underscore': { 'underscore': {
dep : ['$'], deps : ['$'],
exports: '_', exports: '_'
init : function () {
require(['mixins/underscore.mixin.deepExtend']);
}
}, },
backbone: { backbone: {
deps : ['underscore', '$'], deps : ['underscore', '$'],
exports: 'Backbone', exports: 'Backbone'
init : function () { },
require(['libs/backbone.mutators']);
} 'backbone.deepmodel': {
deps: ['mixins/underscore.mixin.deepExtend']
}, },
marionette: { marionette: {
deps : ['backbone'], deps : ['backbone', 'mixins/backbone.marionette.templates'],
exports: 'Marionette', exports: 'Marionette',
init : function () { init : function (Backbone, TemplateMixin) {
require(['mixins/backbone.marionette.templates']); TemplateMixin.call(Marionette.TemplateCache);
} }
}, },
signalR: { signalR: {
dep: ['$'] deps: ['$']
}, },
'backbone.pageable': { 'backbone.pageable': {
dep : ['backbone'], deps: ['backbone']
init: function () {
console.log(this);
}
}, },
backgrid : { backgrid : {
@ -101,6 +96,9 @@ define([
'Instrumentation/ErrorHandler' 'Instrumentation/ErrorHandler'
], function (Marionette, ModalRegion) { ], function (Marionette, ModalRegion) {
require(['libs/backbone.mutators']);
window.NzbDrone = new Marionette.Application(); window.NzbDrone = new Marionette.Application();
window.NzbDrone.Config = {}; window.NzbDrone.Config = {};
window.NzbDrone.Form = {}; window.NzbDrone.Form = {};

Loading…
Cancel
Save