handlebars and templates are loaded with require.js

pull/6/head
Keivan Beigi 12 years ago
parent 2407e33ea2
commit 7c483e2db9

@ -79,6 +79,7 @@ module.exports = function (grunt) {
namespace : "Templates",
partialRegex: /Partial.html/,
wrapped : true,
amd : true,
processName: function (fileName) {
return fileName
.replace('UI/', '')

@ -1,6 +1,6 @@
'use strict';
define(['app', 'AddSeries/RootFolders/RootFolderCollection'], function (app, rootFolders) {
define(['app', 'AddSeries/RootFolders/RootFolderCollection','handlebars'], function (app, rootFolders, Handlebars) {
Handlebars.registerHelper('rootFolderSelection', function () {
//TODO: We should be able to pass in the context, either an object or a property

@ -1,15 +1,15 @@
'use strict';
define(['app'], function () {
Handlebars.registerHelper('formBuilder', function (){
define(['app', 'handlebars'], function (App,Handlebars) {
Handlebars.registerHelper('formBuilder', function () {
var ret = "";
_.each(this.fields, function(field){
_.each(this.fields, function (field) {
ret += NzbDrone.Form.FieldBuilder(field);
});
return new Handlebars.SafeString(ret);
});
NzbDrone.Form.FieldBuilder = function(field) {
NzbDrone.Form.FieldBuilder = function (field) {
if (!field.type) {
return Handlebars.helpers.partial.apply(field, ['Form/TextboxTemplate']);
}

@ -78,12 +78,8 @@
</body>
<script src="/JsLibraries/jquery.js"></script>
<script src="/JsLibraries/messenger.js"></script>
<script src="/JsLibraries/handlebars.runtime.js"></script>
<script src="/JsLibraries/lunr.js"></script>
<!--<script src="/JsLibraries/backbone.backgrid.js"></script>
<script src="/JsLibraries/backbone.backgrid.filter.js"></script>-->
<script src="/JsLibraries/sugar.js"></script>
<script src="/templates.js"></script>
<script data-main="/app" src="/JsLibraries/require.js"></script>
<script src="/Routing.js"></script>
</html>

@ -1,11 +1,11 @@
"use strict";
define(['app', 'marionette'], function (App, Marionette) {
define(['app', 'marionette', 'handlebars', 'templates'], function (App, Marionette, HandleBars, Templates) {
Marionette.TemplateCache.get = function (templateId) {
var templateKey = templateId.toLowerCase();
var templateFunction = window.Templates[templateKey];
var templateFunction = Templates[templateKey];
if (!templateFunction) {
throw 'couldn\'t find pre-compiled template ' + templateKey;

@ -1,6 +1,6 @@
'use strict';
define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfiles) {
define(['app', 'Quality/QualityProfileCollection','handlebars'], function (app, qualityProfiles,Handlebars) {
Handlebars.registerHelper('qualityProfileSelection', function () {

@ -1,6 +1,6 @@
"use strict";
define(['app'], function () {
define(['app','handlebars'], function (App,Handlebars) {
Handlebars.registerHelper('partial', function (templateName) {
//TODO: We should be able to pass in the context, either an object or a property

@ -3,6 +3,7 @@ require.config({
paths: {
'backbone' : 'JsLibraries/backbone',
'handlebars' : 'JsLibraries/handlebars.runtime',
'bootstrap' : 'JsLibraries/bootstrap',
'bootstrap.slider' : 'JsLibraries/bootstrap.slider',
'backbone.mutators' : 'JsLibraries/backbone.mutators',
@ -15,7 +16,6 @@ require.config({
'$' : 'JsLibraries/jquery',
'underscore' : 'JsLibraries/underscore',
'marionette' : 'JsLibraries/backbone.marionette',
'handlebars' : 'JsLibraries/handlebars',
'signalR' : 'JsLibraries/jquery.signalR',
'libs' : 'JsLibraries/'
},
@ -62,10 +62,6 @@ require.config({
}
},
handlebars: {
exports: 'Handlebars'
},
signalR: {
dep: ['$']
},

Loading…
Cancel
Save