updated _ templating pattern to be {{ }} instead of <%%>

This commit is contained in:
Keivan Beigi 2013-01-25 11:04:37 -08:00 committed by kay.one
parent 9969f66201
commit 2229f8f2fa
9 changed files with 2022 additions and 24 deletions

View File

@ -388,8 +388,10 @@
<None Include="_backboneApp\JsLibraries\jquery-1.8.2.intellisense.js" />
<Content Include="_backboneApp\JsLibraries\backbone.collectionbinder.js" />
<Content Include="_backboneApp\JsLibraries\backbone.debug.js" />
<Content Include="_backboneApp\JsLibraries\handlebars.js" />
<Content Include="_backboneApp\JsLibraries\jquery.js" />
<Content Include="_backboneApp\JsLibraries\jquery-ui-1.9.0.js" />
<Content Include="_backboneApp\JsLibraries\marionette.viewswapper.js" />
<Content Include="_backboneApp\JsLibraries\sugar.js" />
<Content Include="_backboneApp\JsLibraries\underscore.js" />
<Content Include="Views\System\Index.cshtml" />

View File

@ -3,6 +3,6 @@
<i class="add-on icon-search"></i>
<input type="text" class="span10" placeholder="Start typing the name of series you want to add ...">
</div>
<div id="search-result">
<div id="search-result" class="span10">
</div>
</div>

View File

@ -5,8 +5,7 @@
NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
template: "AddSeries/AddNewSeries/SearchResultTemplate",
className: 'row',
className: 'well',
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
}
@ -15,7 +14,6 @@ NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({
className: 'result',
itemView: NzbDrone.AddSeries.SearchItemView,
initialize: function () {

View File

@ -1,4 +1 @@
<div>
<div name="SeriesName"/>
<div name="FirstAired"/>
</div>
{{seriesName}} {{seriesYear}}

View File

@ -1,6 +1,6 @@
<td name="Path" class="span10" />
<td name="path" class="span10" />
<td class="span3">
<span name="FreeSpaceString"></span>
<span name="freeSpaceString"></span>
</td>
<td class="span1 nz-row-action">
<div id="remove-dir" class="btn btn-danger icon-minus">

View File

@ -1,14 +1,13 @@
/// <reference path="../../app.js" />
NzbDrone.AddSeries.RootDirModel = Backbone.Model.extend({
idAttribute: 'Id',
mutators: {
FreeSpaceString: function () {
return this.get('FreeSpace').bytes(2) + " Free";
freeSpaceString: function () {
return this.get('freeSpace').bytes(2) + " Free";
}
},
defaults: {
FreeSpace: 0,
freeSpace: 0,
}
});

View File

@ -1,4 +1,9 @@
/// <reference path="../app.js" />
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
mutators: {
seriesYear: function () {
var date = Date.utc.create(this.get('firstAired'));
return date.format('{yyyy}');
}
}
});

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
/// <reference path="JsLibraries/underscore.js" />
/// <reference path="JsLibraries/sugar.js" />
/// <reference path="JsLibraries/backbone.js" />
/// <reference path="JsLibraries/handlebars.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
/// <reference path="JsLibraries/backbone.mutators.js" />
/// <reference path="JsLibraries/backbone.shortcuts.js" />
@ -18,6 +19,10 @@ if (typeof console == "undefined") {
NzbDrone = new Backbone.Marionette.Application();
NzbDrone.AddSeries = NzbDrone.module("AddSeries");
_.templateSettings = {
interpolate: /\{\{([\s\S]+?)\}\}/g
};
NzbDrone.ModelBinder = new Backbone.ModelBinder();
@ -36,7 +41,7 @@ NzbDrone.Routes = {
},
};
http://localhost:65079/_backboneApp/Content
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
addSeries: function () {