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" /> <None Include="_backboneApp\JsLibraries\jquery-1.8.2.intellisense.js" />
<Content Include="_backboneApp\JsLibraries\backbone.collectionbinder.js" /> <Content Include="_backboneApp\JsLibraries\backbone.collectionbinder.js" />
<Content Include="_backboneApp\JsLibraries\backbone.debug.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.js" />
<Content Include="_backboneApp\JsLibraries\jquery-ui-1.9.0.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\sugar.js" />
<Content Include="_backboneApp\JsLibraries\underscore.js" /> <Content Include="_backboneApp\JsLibraries\underscore.js" />
<Content Include="Views\System\Index.cshtml" /> <Content Include="Views\System\Index.cshtml" />

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,9 @@
/// <reference path="../app.js" /> /// <reference path="../app.js" />
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({ 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/underscore.js" />
/// <reference path="JsLibraries/sugar.js" /> /// <reference path="JsLibraries/sugar.js" />
/// <reference path="JsLibraries/backbone.js" /> /// <reference path="JsLibraries/backbone.js" />
/// <reference path="JsLibraries/handlebars.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" /> /// <reference path="JsLibraries/backbone.modelbinder.js" />
/// <reference path="JsLibraries/backbone.mutators.js" /> /// <reference path="JsLibraries/backbone.mutators.js" />
/// <reference path="JsLibraries/backbone.shortcuts.js" /> /// <reference path="JsLibraries/backbone.shortcuts.js" />
@ -18,6 +19,10 @@ if (typeof console == "undefined") {
NzbDrone = new Backbone.Marionette.Application(); NzbDrone = new Backbone.Marionette.Application();
NzbDrone.AddSeries = NzbDrone.module("AddSeries"); NzbDrone.AddSeries = NzbDrone.module("AddSeries");
_.templateSettings = {
interpolate: /\{\{([\s\S]+?)\}\}/g
};
NzbDrone.ModelBinder = new Backbone.ModelBinder(); NzbDrone.ModelBinder = new Backbone.ModelBinder();
@ -36,18 +41,18 @@ NzbDrone.Routes = {
}, },
}; };
http://localhost:65079/_backboneApp/Content
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
NzbDrone.Controller = Backbone.Marionette.Controller.extend({ addSeries: function () {
NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout());
addSeries: function () { },
NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout());
},
notFound: function () { notFound: function () {
alert('route not found'); alert('route not found');
}, },
}); });
NzbDrone.Router = Backbone.Marionette.AppRouter.extend({ NzbDrone.Router = Backbone.Marionette.AppRouter.extend({