mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 03:52:33 +02:00
cleaned up all the cells. there is a cell for pretty much everything.
This commit is contained in:
parent
ac3582d5c4
commit
70cfa5e685
@ -40,7 +40,6 @@ public class ResourceMappingFixture : TestBase
|
||||
[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.Reflection;
|
||||
using NzbDrone.Api.REST;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Core.Datastore;
|
||||
|
||||
namespace NzbDrone.Api.Mapping
|
||||
{
|
||||
@ -11,7 +10,7 @@ public static class MappingValidation
|
||||
{
|
||||
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 @@ private static string GetError(Type resourceType, PropertyInfo modelProperty)
|
||||
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 @@ public static bool IsSimpleType(this Type type)
|
||||
|| 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>
|
||||
|
15
UI/Cells/AirDateCell.js
Normal file
15
UI/Cells/AirDateCell.js
Normal file
@ -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;
|
||||
|
||||
}
|
||||
});
|
||||
});
|
34
UI/Cells/EpisodeNumberCell.js
Normal file
34
UI/Cells/EpisodeNumberCell.js
Normal file
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
15
UI/Cells/FileSizeCell.js
Normal file
15
UI/Cells/FileSizeCell.js
Normal file
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
13
UI/Cells/IndexerCell.js
Normal file
13
UI/Cells/IndexerCell.js
Normal file
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
40
UI/Cells/NzbDroneCell.js
Normal file
40
UI/Cells/NzbDroneCell.js
Normal file
@ -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;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
9
UI/Cells/QualityCell.js
Normal file
9
UI/Cells/QualityCell.js
Normal file
@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
define(['app', 'Cells/TemplatedCell'], function () {
|
||||
NzbDrone.Cells.QualityCell = NzbDrone.Cells.TemplatedCell.extend({
|
||||
|
||||
className: 'quality-cell',
|
||||
template : 'Cells/QualityTemplate'
|
||||
|
||||
});
|
||||
});
|
13
UI/Cells/RelativeDateCell.js
Normal file
13
UI/Cells/RelativeDateCell.js
Normal file
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
9
UI/Cells/SeriesTitleCell.js
Normal file
9
UI/Cells/SeriesTitleCell.js
Normal file
@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
define(['app', 'Cells/TemplatedCell'], function () {
|
||||
NzbDrone.Cells.SeriesTitleCell = NzbDrone.Cells.TemplatedCell.extend({
|
||||
|
||||
className: 'series-title',
|
||||
template : 'Cells/SeriesTitleTemplate'
|
||||
|
||||
});
|
||||
});
|
2
UI/Cells/SeriesTitleTemplate.html
Normal file
2
UI/Cells/SeriesTitleTemplate.html
Normal file
@ -0,0 +1,2 @@
|
||||
<a href="{{route}}">{{title}}</a>
|
||||
{{debug}}
|
19
UI/Cells/TemplatedCell.js
Normal file
19
UI/Cells/TemplatedCell.js
Normal file
@ -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',
|
||||
|
7
UI/Cells/cells.less
Normal file
7
UI/Cells/cells.less
Normal file
@ -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'
|
||||
],
|
||||
@ -18,42 +24,36 @@ define([
|
||||
|
||||
columns: [
|
||||
{
|
||||
name : 'indexer',
|
||||
label : '',
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/IndexerTemplate' })
|
||||
name : 'indexer',
|
||||
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' })
|
||||
name : 'episode',
|
||||
label : 'Episode',
|
||||
sortable: false,
|
||||
cell : NzbDrone.Cells.EpisodeNumberCell
|
||||
},
|
||||
{
|
||||
name : 'Episode.Title',
|
||||
label : 'Episode Title',
|
||||
sortable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/EpisodeTitleTemplate' })
|
||||
name : 'episode',
|
||||
label : 'Episode Title',
|
||||
sortable: false,
|
||||
cell : NzbDrone.Cells.EpisodeTitleCell
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label : 'Quality',
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/QualityTemplate' })
|
||||
name : 'quality',
|
||||
label: 'Quality',
|
||||
cell : NzbDrone.Cells.QualityCell
|
||||
},
|
||||
{
|
||||
name : 'date',
|
||||
label : 'Grabbed',
|
||||
cell : 'airDate'
|
||||
},
|
||||
{
|
||||
name : 'edit',
|
||||
label : '',
|
||||
sortable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/ControlsColumnTemplate' })
|
||||
name : 'date',
|
||||
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
|
||||
}));
|
||||
},
|
||||
@ -80,9 +80,9 @@ define([
|
||||
|
||||
this.historyCollection = new NzbDrone.History.Collection();
|
||||
this.historyCollection.fetch()
|
||||
.done(function () {
|
||||
self._showTable();
|
||||
});
|
||||
.done(function () {
|
||||
self._showTable();
|
||||
});
|
||||
|
||||
//this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
|
||||
}
|
||||
|
@ -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',
|
||||
label : 'Series Title',
|
||||
sortable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/SeriesTitleTemplate' })
|
||||
name : 'series',
|
||||
label : 'Series Title',
|
||||
sortable: false,
|
||||
cell : NzbDrone.Cells.SeriesTitleCell
|
||||
},
|
||||
{
|
||||
name : 'episode',
|
||||
label : 'Episode',
|
||||
sortable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/EpisodeColumnTemplate' })
|
||||
name : 'this',
|
||||
label : 'Episode',
|
||||
sortable: false,
|
||||
cell : NzbDrone.Cells.EpisodeNumberCell
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Episode Title',
|
||||
sortable : false,
|
||||
cell : 'string'
|
||||
name : 'this',
|
||||
label : 'Episode Title',
|
||||
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' })
|
||||
name : 'airDate',
|
||||
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
|
||||
}));
|
||||
},
|
||||
@ -71,9 +70,9 @@ define([
|
||||
|
||||
this.missingCollection = new NzbDrone.Missing.Collection();
|
||||
this.missingCollection.fetch()
|
||||
.done(function () {
|
||||
self._showTable();
|
||||
});
|
||||
.done(function () {
|
||||
self._showTable();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -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",
|
||||
|
27
UI/Release/DownloadReportCell.js
Normal file
27
UI/Release/DownloadReportCell.js
Normal file
@ -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,64 +1,68 @@
|
||||
'use strict';
|
||||
define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleCell','Shared/Cells/ToggleCell'], function () {
|
||||
NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Series/Details/SeasonLayoutTemplate',
|
||||
define([
|
||||
'app',
|
||||
'Cells/EpisodeStatusCell',
|
||||
'Cells/EpisodeTitleCell',
|
||||
'Cells/AirDateCell',
|
||||
'Cells/ToggleCell'],
|
||||
function () {
|
||||
NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Series/Details/SeasonLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
episodeGrid: '#x-episode-grid'
|
||||
},
|
||||
|
||||
columns: [
|
||||
|
||||
{
|
||||
name : 'ignored',
|
||||
label: '',
|
||||
cell : NzbDrone.Shared.Cells.ToggleCell,
|
||||
trueClass : 'icon-bookmark-empty',
|
||||
falseClass :'icon-bookmark'
|
||||
},
|
||||
{
|
||||
name : 'episodeNumber',
|
||||
label: '#',
|
||||
cell : Backgrid.IntegerCell.extend({
|
||||
className: 'episode-number-cell'
|
||||
})
|
||||
regions: {
|
||||
episodeGrid: '#x-episode-grid'
|
||||
},
|
||||
|
||||
{
|
||||
name : 'title',
|
||||
label: 'Title',
|
||||
cell : NzbDrone.Series.Details.EpisodeTitleCell
|
||||
},
|
||||
{
|
||||
name : 'airDate',
|
||||
label: 'Air Date',
|
||||
cell : Backgrid.DateCell.extend({
|
||||
className: 'episode-air-date-cell'
|
||||
})
|
||||
} ,
|
||||
{
|
||||
name : 'status',
|
||||
label: 'Status',
|
||||
cell : NzbDrone.Series.Details.EpisodeStatusCell
|
||||
}
|
||||
],
|
||||
columns: [
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
if (!options.episodeCollection) {
|
||||
throw 'episodeCollection is needed';
|
||||
}
|
||||
|
||||
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.episodeGrid.show(new Backgrid.Grid(
|
||||
{
|
||||
columns : this.columns,
|
||||
collection: this.episodeCollection,
|
||||
className : 'table table-hover season-grid'
|
||||
}));
|
||||
}
|
||||
name : 'ignored',
|
||||
label : '',
|
||||
cell : NzbDrone.Cells.ToggleCell,
|
||||
trueClass : 'icon-bookmark-empty',
|
||||
falseClass: 'icon-bookmark'
|
||||
},
|
||||
{
|
||||
name : 'episodeNumber',
|
||||
label: '#',
|
||||
cell : Backgrid.IntegerCell.extend({
|
||||
className: 'episode-number-cell'
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
name : 'this',
|
||||
label: 'Title',
|
||||
cell : NzbDrone.Cells.EpisodeTitleCell
|
||||
},
|
||||
{
|
||||
name : 'airDate',
|
||||
label: 'Air Date',
|
||||
cell : NzbDrone.Cells.AirDateCell
|
||||
} ,
|
||||
{
|
||||
name : 'status',
|
||||
label: 'Status',
|
||||
cell : NzbDrone.Cells.EpisodeStatusCell
|
||||
}
|
||||
],
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
if (!options.episodeCollection) {
|
||||
throw 'episodeCollection is needed';
|
||||
}
|
||||
|
||||
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.episodeGrid.show(new Backgrid.Grid(
|
||||
{
|
||||
columns : this.columns,
|
||||
collection: this.episodeCollection,
|
||||
className : 'table table-hover season-grid'
|
||||
}));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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();
|
||||
@ -35,4 +42,4 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -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',
|
||||
@ -21,46 +23,48 @@ define([
|
||||
|
||||
columns: [
|
||||
{
|
||||
name : 'status',
|
||||
label : '',
|
||||
cell : 'seriesStatus'
|
||||
name : 'status',
|
||||
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',
|
||||
cell : 'integer'
|
||||
name : 'seasonCount',
|
||||
label: 'Seasons',
|
||||
cell : 'integer'
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label : 'Quality',
|
||||
cell : 'integer'
|
||||
name : 'quality',
|
||||
label: 'Quality',
|
||||
cell : 'integer'
|
||||
},
|
||||
{
|
||||
name : 'network',
|
||||
label : 'Network',
|
||||
cell : 'string'
|
||||
name : 'network',
|
||||
label: 'Network',
|
||||
cell : 'string'
|
||||
},
|
||||
{
|
||||
name : 'nextAiring',
|
||||
label : 'Next Airing',
|
||||
cell : 'airDate'
|
||||
name : 'nextAiring',
|
||||
label: 'Next Airing',
|
||||
cell : NzbDrone.Cells.AirDateCell
|
||||
},
|
||||
{
|
||||
name : 'episodes',
|
||||
label : 'Episodes',
|
||||
sortable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' })
|
||||
name : 'this',
|
||||
label : 'Episodes',
|
||||
sortable: false,
|
||||
template: 'Series/EpisodeProgressTemplate',
|
||||
cell : NzbDrone.Cells.TemplatedCell
|
||||
},
|
||||
{
|
||||
name : 'edit',
|
||||
label : '',
|
||||
sortable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' })
|
||||
name : 'this',
|
||||
label : '',
|
||||
sortable: false,
|
||||
template: 'Series/Index/Table/ControlsColumnTemplate',
|
||||
cell : NzbDrone.Cells.TemplatedCell
|
||||
}
|
||||
],
|
||||
|
||||
@ -92,12 +96,12 @@ define([
|
||||
|
||||
_showTable: function () {
|
||||
var view = new Backgrid.Grid(
|
||||
{
|
||||
row : NzbDrone.Series.Index.Table.Row,
|
||||
columns : this.columns,
|
||||
collection: this.seriesCollection,
|
||||
className : 'table table-hover'
|
||||
});
|
||||
{
|
||||
row : NzbDrone.Series.Index.Table.Row,
|
||||
columns : this.columns,
|
||||
collection: this.seriesCollection,
|
||||
className : 'table table-hover'
|
||||
});
|
||||
|
||||
this._fetchCollection(view);
|
||||
},
|
||||
@ -149,10 +153,10 @@ define([
|
||||
//TODO: Move this outside of the function - 'this' is not available for the call back though (use string like events?)
|
||||
var viewButtons = {
|
||||
type : 'radio',
|
||||
storeState : true,
|
||||
menuKey : 'seriesViewMode',
|
||||
defaultAction: 'listView',
|
||||
items : [
|
||||
storeState : true,
|
||||
menuKey : 'seriesViewMode',
|
||||
defaultAction: 'listView',
|
||||
items : [
|
||||
{
|
||||
key : 'tableView',
|
||||
title : '',
|
||||
|
@ -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}}
|
||||
@ -9,4 +8,4 @@
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</ul>
|
||||
|
@ -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;
|
||||
}
|
||||
});
|
10
UI/app.js
10
UI/app.js
@ -62,12 +62,14 @@ define('app', ['shared/modal/region'], function (ModalRegion) {
|
||||
window.NzbDrone.Commands = {};
|
||||
|
||||
window.NzbDrone.Shared = {
|
||||
Toolbar : {},
|
||||
Messenger: {},
|
||||
Cells: {},
|
||||
Toolbar : {},
|
||||
Messenger : {},
|
||||
FormatHelpers: {}
|
||||
|
||||
};
|
||||
|
||||
window.NzbDrone.Cells = {};
|
||||
|
||||
window.NzbDrone.Calendar = {};
|
||||
|
||||
window.NzbDrone.Settings = {
|
||||
@ -79,7 +81,7 @@ define('app', ['shared/modal/region'], function (ModalRegion) {
|
||||
Indexers : {},
|
||||
DownloadClient: {},
|
||||
Notifications : {},
|
||||
General : {},
|
||||
General : {},
|
||||
Misc : {}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user