fixed more require issues

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

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

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

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

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

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

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

Loading…
Cancel
Save