cleaned up all the cells. there is a cell for pretty much everything.

pull/4/head
kay.one 12 years ago
parent ac3582d5c4
commit 70cfa5e685

@ -40,7 +40,6 @@ namespace NzbDrone.Api.Test.MappingTests
[TestCase(typeof(DownloadDecision), typeof(ReleaseResource))]
[TestCase(typeof(Core.History.History), typeof(HistoryResource))]
[TestCase(typeof(UpdatePackage), typeof(UpdateResource))]
[TestCase(typeof(QualityProfile), typeof(QualityProfileResource))]
[TestCase(typeof(Quality), typeof(QualityResource))]
[TestCase(typeof(Log), typeof(LogResource))]
public void matching_fields(Type modelType, Type resourceType)

@ -2,11 +2,13 @@
using System.Collections.Generic;
using NzbDrone.Api.REST;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Indexers
{
public class ReleaseResource : RestResource
{
public QualityModel Quality { get; set; }
public Int32 Age { get; set; }
public Int64 Size { get; set; }
public String Indexer { get; set; }

@ -3,7 +3,6 @@ using System.Linq;
using System.Reflection;
using NzbDrone.Api.REST;
using NzbDrone.Common.Reflection;
using NzbDrone.Core.Datastore;
namespace NzbDrone.Api.Mapping
{
@ -11,7 +10,7 @@ namespace NzbDrone.Api.Mapping
{
public static void ValidateMapping(Type modelType, Type resourceType)
{
var errors = modelType.GetSimpleProperties().Select(p => GetError(resourceType, p)).Where(c => c != null).ToList();
var errors = modelType.GetSimpleProperties().Where(c=>!c.GetGetMethod().IsStatic).Select(p => GetError(resourceType, p)).Where(c => c != null).ToList();
if (errors.Any())
{
@ -48,9 +47,9 @@ namespace NzbDrone.Api.Mapping
return string.Format("public {0} {1} {{ get; set; }}", modelProperty.PropertyType.Name, modelProperty.Name);
}
if (resourceProperty.PropertyType != modelProperty.PropertyType)
if (resourceProperty.PropertyType != modelProperty.PropertyType && !typeof(RestResource).IsAssignableFrom(resourceProperty.PropertyType))
{
return string.Format("Excpected {0}.{1} to have type of {2} but found {3}", resourceType.Name, resourceProperty.Name, modelProperty.PropertyType, resourceProperty.PropertyType);
return string.Format("Expected {0}.{1} to have type of {2} but found {3}", resourceType.Name, resourceProperty.Name, modelProperty.PropertyType, resourceProperty.PropertyType);
}
return null;

@ -33,7 +33,8 @@ namespace NzbDrone.Common.Reflection
|| type == typeof(string)
|| type == typeof(DateTime)
|| type == typeof(Version)
|| type == typeof(Decimal);
|| type == typeof(Decimal)
|| type.GetInterface("IEmbeddedDocument") != null;
}
public static bool IsReadable(this PropertyInfo propertyInfo)

@ -1,6 +1,6 @@
<SolutionConfiguration>
<FileVersion>1</FileVersion>
<AutoEnableOnStartup>True</AutoEnableOnStartup>
<AutoEnableOnStartup>False</AutoEnableOnStartup>
<AllowParallelTestExecution>true</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>true</AllowTestsToRunInParallelWithThemselves>
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>

@ -8,6 +8,7 @@
<w>rootfolder</w>
<w>rootfolders</w>
<w>signalr</w>
<w>templated</w>
<w>thetvdb</w>
<w>trakt</w>
<w>tvdb</w>

@ -0,0 +1,15 @@
"use strict";
define(['app', 'Shared/FormatHelpers'], function () {
NzbDrone.Cells.AirDateCell = Backgrid.Cell.extend({
className: "air-date-cell",
render: function () {
this.$el.empty();
var airDate = this.model.get(this.column.get("name"));
this.$el.html(NzbDrone.Shared.FormatHelpers.DateHelper(airDate));
return this;
}
});
});

@ -0,0 +1,34 @@
"use strict";
define(['app', 'Cells/NzbDroneCell'], function () {
NzbDrone.Cells.EpisodeNumberCell = NzbDrone.Cells.NzbDroneCell.extend({
className: "episode-number-cell",
render: function () {
var airDate = this.cellValue.get('airDate') || this.get(this.column.get("airDate"));
var seasonNumber = this.cellValue.get('seasonNumber') || this.model.get(this.column.get("seasonNumber"));
var episodes = this.cellValue.get('episodeNumber') || this.model.get(this.column.get("episodes"));
var result = 'Unknown';
if (airDate) {
result = new Date(airDate).toLocaleDateString();
}
else {
var paddedEpisodes = _.map(episodes, function (episodeNumber) {
return episodeNumber.pad(2);
});
result = 'S{0}-E{1}'.format(seasonNumber, paddedEpisodes.join());
}
this.$el.html(result);
this.delegateEvents();
return this;
}
});
});

@ -1,7 +1,7 @@
"use strict";
define(['app', 'Episode/Layout'], function () {
NzbDrone.Series.Details.EpisodeStatusCell = Backgrid.Cell.extend({
define(['app' ], function () {
NzbDrone.Cells.EpisodeStatusCell = Backgrid.Cell.extend({
className: 'episode-status-cell',

@ -1,7 +1,7 @@
"use strict";
define(['app', 'Episode/Layout'], function () {
NzbDrone.Series.Details.EpisodeTitleCell = Backgrid.StringCell.extend({
define(['app', 'Cells/NzbDroneCell'], function () {
NzbDrone.Cells.EpisodeTitleCell = NzbDrone.Cells.NzbDroneCell.extend({
className: 'episode-title-cell',
@ -10,8 +10,13 @@ define(['app', 'Episode/Layout'], function () {
},
showDetails: function () {
var view = new NzbDrone.Episode.Layout({ model: this.model });
var view = new NzbDrone.Episode.Layout({ model: this.cellValue });
NzbDrone.modalRegion.show(view);
},
render: function () {
this.$el.html(this.cellValue.get('title'));
return this;
}
});
});

@ -0,0 +1,15 @@
"use strict";
define(['app', 'Shared/FormatHelpers'], function () {
NzbDrone.Cells.FileSizeCell = Backgrid.Cell.extend({
className: "file-size-cell",
render: function () {
var size = this.model.get(this.column.get("name"));
this.$el.html(NzbDrone.Shared.FormatHelpers.FileSizeHelper(size));
this.delegateEvents();
return this;
}
});
});

@ -0,0 +1,13 @@
"use strict";
define(['app'], function () {
NzbDrone.Cells.IndexerCell = Backgrid.Cell.extend({
class : 'indexer-cell',
render: function () {
var indexer = this.model.get(this.column.get('name'));
this.$el.html(indexer);
return this;
}
});
});

@ -0,0 +1,40 @@
"use strict";
define(['app'], function () {
NzbDrone.Cells.NzbDroneCell = Backgrid.Cell.extend({
_originalInit: Backgrid.Cell.prototype.initialize,
initialize: function () {
this._originalInit.apply(this, arguments);
this.cellValue = this._getValue();
this.model.on('change', this._refresh, this);
},
_refresh: function () {
this.cellValue = this._getValue();
this.render();
},
_getValue: function () {
var name = this.column.get('name');
if(name === 'this'){
return this.model;
}
var value = this.model.get(name);
//if not a model
if (!value.get) {
return value = new Backbone.Model(value);
}
return value;
}
});
});

@ -0,0 +1,9 @@
"use strict";
define(['app', 'Cells/TemplatedCell'], function () {
NzbDrone.Cells.QualityCell = NzbDrone.Cells.TemplatedCell.extend({
className: 'quality-cell',
template : 'Cells/QualityTemplate'
});
});

@ -0,0 +1,13 @@
"use strict";
define(['app'], function () {
NzbDrone.Cells.RelativeDateCell = Backgrid.Cell.extend({
render: function () {
var date = this.model.get(this.column.get('name'));
this.$el.html(Date.create(date).relative());
return this;
}
});
});

@ -0,0 +1,9 @@
"use strict";
define(['app', 'Cells/TemplatedCell'], function () {
NzbDrone.Cells.SeriesTitleCell = NzbDrone.Cells.TemplatedCell.extend({
className: 'series-title',
template : 'Cells/SeriesTitleTemplate'
});
});

@ -0,0 +1,2 @@
<a href="{{route}}">{{title}}</a>
{{debug}}

@ -0,0 +1,19 @@
"use strict";
define(['app','Cells/NzbDroneCell'], function () {
NzbDrone.Cells.TemplatedCell = NzbDrone.Cells.NzbDroneCell.extend({
render: function () {
var templateName = this.column.get('template') || this.template;
this.templateFunction = Marionette.TemplateCache.get(templateName);
var data = this.cellValue.toJSON();
var html = this.templateFunction(data);
this.$el.html(html);
return this;
}
});
});

@ -1,7 +1,7 @@
"use strict";
define(['app', 'Episode/Layout'], function () {
NzbDrone.Shared.Cells.ToggleCell = Backgrid.Cell.extend({
NzbDrone.Cells.ToggleCell = Backgrid.Cell.extend({
className: 'toggle-cell clickable',

@ -0,0 +1,7 @@
@import "../content/Bootstrap/mixins";
@import "../content/Bootstrap/variables";
@import "../content/Bootstrap/buttons";
.episode-title-cell {
.btn-link;
}

@ -1,5 +1,5 @@
"use strict";
define(['app', 'Shared/Cells/FileSizeCell', 'Shared/Cells/ApprovalStatusCell'], function () {
define(['app', 'Cells/FileSizeCell', 'Release/ApprovalStatusCell', 'Release/DownloadReportCell' ], function () {
NzbDrone.Episode.Search.Layout = Backbone.Marionette.Layout.extend({
template: 'Episode/Search/LayoutTemplate',
@ -19,7 +19,7 @@ define(['app', 'Shared/Cells/FileSizeCell', 'Shared/Cells/ApprovalStatusCell'],
name : 'size',
label : 'Size',
sortable: true,
cell : NzbDrone.Shared.Cells.FileSizeCell
cell : NzbDrone.Cells.FileSizeCell
},
{
name : 'title',
@ -30,7 +30,12 @@ define(['app', 'Shared/Cells/FileSizeCell', 'Shared/Cells/ApprovalStatusCell'],
{
name : 'rejections',
label: 'decision',
cell : NzbDrone.Shared.Cells.ApprovalStatusCell
cell : NzbDrone.Release.ApprovalStatusCell
},
{
name : 'download',
label: '',
cell : NzbDrone.Release.DownloadReportCell
}
],

@ -1 +0,0 @@
{{episode.title}}

@ -2,7 +2,13 @@
define([
'app',
'History/Collection',
'Series/Index/Table/AirDateCell',
'Cells/RelativeDateCell',
'Cells/IndexerCell',
'Cells/TemplatedCell',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/QualityCell',
'Shared/Toolbar/ToolbarLayout',
'Shared/LoadingView'
],
@ -19,41 +25,35 @@ define([
columns: [
{
name : 'indexer',
label : '',
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/IndexerTemplate' })
label: '',
cell : NzbDrone.Cells.IndexerCell
},
{
name : 'Series.Title',
label : 'Series Title',
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/SeriesTitleTemplate' })
name : 'series',
label : 'Series',
cell : NzbDrone.Cells.SeriesTitleCell
},
{
name : 'episode',
label : 'Episode',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/EpisodeColumnTemplate' })
sortable: false,
cell : NzbDrone.Cells.EpisodeNumberCell
},
{
name : 'Episode.Title',
name : 'episode',
label : 'Episode Title',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/EpisodeTitleTemplate' })
sortable: false,
cell : NzbDrone.Cells.EpisodeTitleCell
},
{
name : 'quality',
label : 'Quality',
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/QualityTemplate' })
label: 'Quality',
cell : NzbDrone.Cells.QualityCell
},
{
name : 'date',
label : 'Grabbed',
cell : 'airDate'
},
{
name : 'edit',
label : '',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/ControlsColumnTemplate' })
label: 'Date',
cell : NzbDrone.Cells.RelativeDateCell
}
],
@ -68,7 +68,7 @@ define([
}));
this.pager.show(new Backgrid.NzbDronePaginator({
columns: this.columns,
columns : this.columns,
collection: this.historyCollection
}));
},

@ -1,5 +1,5 @@
"use strict";
define(['app'], function (app) {
define(['app','Series/SeriesModel', 'Series/EpisodeModel'], function () {
NzbDrone.History.Model = Backbone.Model.extend({
mutators: {
seasonNumber: function () {
@ -9,6 +9,14 @@ define(['app'], function (app) {
paddedEpisodeNumber: function () {
return this.get('episode').episodeNumber.pad(2);
}
},
parse: function (model) {
model.series = new NzbDrone.Series.SeriesModel(model.series);
model.episode = new NzbDrone.Series.EpisodeModel(model.episode);
return model;
}
});
});

@ -9,6 +9,7 @@
<link href="/Content/Messenger/messenger.css" rel='stylesheet' type='text/css'/>
<link href="/Content/Messenger/messenger.future.css" rel='stylesheet' type='text/css'/>
<link href="/content/theme.css" rel='stylesheet' type='text/css'>
<link href="/Cells/cells.css" rel='stylesheet' type='text/css'>
<link href="/content/fullcalendar.css" rel='stylesheet' type='text/css'>
<link href="/content/backbone.css" rel='stylesheet' type='text/css'/>
<link href="/content/backbone.backgrid.filter.css" rel='stylesheet' type='text/css'/>
@ -84,7 +85,6 @@
<script src="/JsLibraries/underscore.js"></script>
<script src="/JsLibraries/handlebars.runtime.js"></script>
<script src="/JsLibraries/backbone.js"></script>
<script src="/JsLibraries/backbone.associations.js"></script>
<script src="/JsLibraries/backbone.modelbinder.js"></script>
<script src="/JsLibraries/backbone.deep.model.js"></script>
<script src="/JsLibraries/backbone.mutators.js"></script>

@ -1,2 +0,0 @@

{{seasonNumber}}x{{paddedEpisodeNumber}}

@ -2,9 +2,14 @@
define([
'app',
'Missing/Collection',
'Series/Index/Table/AirDateCell',
'Missing/Row',
'Cells/AirDateCell',
'Series/Index/Table/SeriesStatusCell',
'Shared/Toolbar/ToolbarLayout',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/AirDateCell',
'Shared/LoadingView'
],
function () {
@ -19,33 +24,27 @@ define([
columns: [
{
name : 'series.Title',
name : 'series',
label : 'Series Title',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/SeriesTitleTemplate' })
sortable: false,
cell : NzbDrone.Cells.SeriesTitleCell
},
{
name : 'episode',
name : 'this',
label : 'Episode',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/EpisodeColumnTemplate' })
sortable: false,
cell : NzbDrone.Cells.EpisodeNumberCell
},
{
name : 'title',
name : 'this',
label : 'Episode Title',
sortable : false,
cell : 'string'
sortable: false,
cell : NzbDrone.Cells.EpisodeTitleCell
},
{
name : 'airDate',
label : 'Air Date',
cell : 'airDate'
},
{
name : 'edit',
label : '',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/ControlsColumnTemplate' })
label: 'Air Date',
cell : NzbDrone.Cells.AirDateCell
}
],
@ -59,7 +58,7 @@ define([
}));
this.pager.show(new Backgrid.NzbDronePaginator({
columns: this.columns,
columns : this.columns,
collection: this.missingCollection
}));
},

@ -1,2 +0,0 @@
{{! TODO: Should use route instead of hard coding link }}
<a href="/series/details/{{series.titleSlug}}">{{series.title}}</a>

@ -11,19 +11,6 @@ Backgrid.Column.prototype.defaults = {
headerCell: 'nzbDrone'
};
Backgrid.TemplateBackedCell = Backgrid.Cell.extend({
className: '',
template : 'Series/Index/Table/ControlsColumnTemplate',
render: function () {
var data = this.model.toJSON();
var templateFunction = Marionette.TemplateCache.get(this.template);
var html = templateFunction(data);
this.$el.html(html);
return this;
}
});
Backgrid.NzbDroneHeaderCell = Backgrid.HeaderCell.extend({
events: {

@ -1,5 +1,5 @@
"use strict";
NzbDrone.Shared.Cells.ApprovalStatusCell = Backgrid.Cell.extend({
NzbDrone.Release.ApprovalStatusCell = Backgrid.Cell.extend({
className: "approval-status-cell",

@ -0,0 +1,27 @@
"use strict";
NzbDrone.Release.DownloadReportCell = Backgrid.Cell.extend({
className: "download-report-cell",
events: {
'click': '_onClick'
},
_onClick: function () {
var self = this;
this.$el.html('<i class ="icon-spinner icon-spin" />');
this.model.save()
.always(function () {
self.$el.html('<i class ="icon-download-alt" />');
});
},
render: function () {
this.$el.html('<i class ="icon-download-alt" />');
return this;
}
});

@ -2,11 +2,12 @@
define([
'app',
'Release/Collection',
'Release/ApprovalStatusCell',
'Shared/SpinnerView',
'Shared/Toolbar/ToolbarLayout',
'Shared/Cells/EpisodeNumberCell',
'Shared/Cells/FileSizeCell',
'Shared/Cells/ApprovalStatusCell'
'Cells/EpisodeNumberCell',
'Cells/FileSizeCell',
'Cells/IndexerCell'
],
function () {
NzbDrone.Release.Layout = Backbone.Marionette.Layout.extend({
@ -22,13 +23,13 @@ define([
name : 'indexer',
label : 'Indexer',
sortable: true,
cell : Backgrid.StringCell
cell : NzbDrone.Cells.IndexerCell
},
{
name : 'size',
label : 'Size',
sortable: true,
cell : NzbDrone.Shared.Cells.FileSizeCell
cell : NzbDrone.Cells.FileSizeCell
},
{
name : 'title',
@ -38,16 +39,14 @@ define([
},
{
name : 'episodeNumbers',
season : 'seasonNumber',
airDate : 'airDate',
episodes: 'episodeNumbers',
label : 'season',
cell : NzbDrone.Shared.Cells.EpisodeNumberCell
cell : NzbDrone.Cells.EpisodeNumberCell
},
{
name : 'rejections',
label: 'decision',
cell : NzbDrone.Shared.Cells.ApprovalStatusCell
cell : NzbDrone.Release.ApprovalStatusCell
}
],

@ -1,5 +1,11 @@
'use strict';
define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleCell','Shared/Cells/ToggleCell'], function () {
define([
'app',
'Cells/EpisodeStatusCell',
'Cells/EpisodeTitleCell',
'Cells/AirDateCell',
'Cells/ToggleCell'],
function () {
NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({
template: 'Series/Details/SeasonLayoutTemplate',
@ -11,10 +17,10 @@ define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleC
{
name : 'ignored',
label: '',
cell : NzbDrone.Shared.Cells.ToggleCell,
label : '',
cell : NzbDrone.Cells.ToggleCell,
trueClass : 'icon-bookmark-empty',
falseClass :'icon-bookmark'
falseClass: 'icon-bookmark'
},
{
name : 'episodeNumber',
@ -25,21 +31,19 @@ define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleC
},
{
name : 'title',
name : 'this',
label: 'Title',
cell : NzbDrone.Series.Details.EpisodeTitleCell
cell : NzbDrone.Cells.EpisodeTitleCell
},
{
name : 'airDate',
label: 'Air Date',
cell : Backgrid.DateCell.extend({
className: 'episode-air-date-cell'
})
cell : NzbDrone.Cells.AirDateCell
} ,
{
name : 'status',
label: 'Status',
cell : NzbDrone.Series.Details.EpisodeStatusCell
cell : NzbDrone.Cells.EpisodeStatusCell
}
],
@ -61,4 +65,4 @@ define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleC
}));
}
});
});
});

@ -1,5 +1,5 @@
'use strict';
define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function () {
define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function (app, seriesModel, deleteSeriesView, qualityProfiles) {
NzbDrone.Series.Edit.EditSeriesView = Backbone.Marionette.ItemView.extend({
template : 'Series/Edit/EditSeriesTemplate',
@ -16,6 +16,13 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/
},
initialize : function(){
this.model.set('qualityProfiles',qualityProfiles);
},
saveSeries: function () {
//Todo: Get qualityProfile + backlog setting from UI
var qualityProfile = this.ui.qualityProfile.val();

@ -1,5 +1,5 @@
"use strict";
define(['app'], function () {
define(['app','Series/SeriesModel'], function () {
NzbDrone.Series.EpisodeModel = Backbone.Model.extend({
mutators: {
@ -55,6 +55,13 @@ define(['app'], function () {
}
},
parse: function (model) {
model.series = new NzbDrone.Series.SeriesModel(model.series);
return model;
},
defaults: {
seasonNumber: 0,
status : 0

@ -4,7 +4,9 @@ define([
'Series/Index/List/CollectionView',
'Series/Index/Posters/CollectionView',
'Series/Index/EmptyView',
'Series/Index/Table/AirDateCell',
'Cells/AirDateCell',
'Cells/SeriesTitleCell',
'Cells/TemplatedCell',
'Series/Index/Table/SeriesStatusCell',
'Shared/Toolbar/ToolbarLayout',
'Config',
@ -22,45 +24,47 @@ define([
columns: [
{
name : 'status',
label : '',
label: '',
cell : 'seriesStatus'
},
{
name : 'title',
label : 'Title',
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/SeriesTitleTemplate' })
name : 'this',
label: 'Title',
cell : NzbDrone.Cells.SeriesTitleCell
},
{
name : 'seasonCount',
label : 'Seasons',
label: 'Seasons',
cell : 'integer'
},
{
name : 'quality',
label : 'Quality',
label: 'Quality',
cell : 'integer'
},
{
name : 'network',
label : 'Network',
label: 'Network',
cell : 'string'
},
{
name : 'nextAiring',
label : 'Next Airing',
cell : 'airDate'
label: 'Next Airing',
cell : NzbDrone.Cells.AirDateCell
},
{
name : 'episodes',
name : 'this',
label : 'Episodes',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' })
sortable: false,
template: 'Series/EpisodeProgressTemplate',
cell : NzbDrone.Cells.TemplatedCell
},
{
name : 'edit',
name : 'this',
label : '',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' })
sortable: false,
template: 'Series/Index/Table/ControlsColumnTemplate',
cell : NzbDrone.Cells.TemplatedCell
}
],

@ -1,13 +0,0 @@
"use strict";
Backgrid.AirDateCell = Backgrid.Cell.extend({
className: "air-date-cell",
render: function () {
this.$el.empty();
var airDate = this.model.get(this.column.get("name"));
this.$el.html(NzbDrone.Shared.FormatHelpers.DateHelper(airDate));
return this;
}
});

@ -1,5 +1,4 @@
<ul>
{{debug}}
{{#each handles}}
<li {{#if className}}class="{{className}}"{{/if}}>
{{#if pageNumber}}

@ -1,30 +0,0 @@
"use strict";
NzbDrone.Shared.Cells.EpisodeNumberCell = Backgrid.Cell.extend({
className: "episode-number-cell",
render: function () {
var airDate = this.model.get(this.column.get("airDate"));
var result = 'Unknown';
if (airDate) {
result = new Date(airDate).toLocaleDateString();
}
else {
var season = this.model.get(this.column.get("season")).pad(2);
var episodes = _.map(this.model.get(this.column.get("episodes")), function (episodeNumber) {
return episodeNumber.pad(2);
});
result = 'S{0}-E{1}'.format(season, episodes.join());
}
this.$el.html(result);
this.delegateEvents();
return this;
}
});

@ -1,12 +0,0 @@
"use strict";
NzbDrone.Shared.Cells.FileSizeCell = Backgrid.Cell.extend({
className: "file-size-cell",
render: function () {
var size = this.model.get(this.column.get("name"));
this.$el.html(NzbDrone.Shared.FormatHelpers.FileSizeHelper(size));
this.delegateEvents();
return this;
}
});

@ -63,11 +63,13 @@ define('app', ['shared/modal/region'], function (ModalRegion) {
window.NzbDrone.Shared = {
Toolbar : {},
Messenger: {},
Cells: {},
Messenger : {},
FormatHelpers: {}
};
window.NzbDrone.Cells = {};
window.NzbDrone.Calendar = {};
window.NzbDrone.Settings = {

Loading…
Cancel
Save