mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
added some custom cells for resources.
This commit is contained in:
parent
c93548c9f6
commit
bf499ed98a
5 changed files with 76 additions and 17 deletions
|
@ -3,7 +3,10 @@ define([
|
|||
'app',
|
||||
'Release/Collection',
|
||||
'Shared/SpinnerView',
|
||||
'Shared/Toolbar/ToolbarLayout'
|
||||
'Shared/Toolbar/ToolbarLayout',
|
||||
'Shared/Cells/EpisodeNumberCell',
|
||||
'Shared/Cells/FileSizeCell',
|
||||
'Shared/Cells/ApprovalStatusCell'
|
||||
],
|
||||
function () {
|
||||
NzbDrone.Release.Layout = Backbone.Marionette.Layout.extend({
|
||||
|
@ -25,7 +28,7 @@ define([
|
|||
name : 'size',
|
||||
label : 'Size',
|
||||
sortable: true,
|
||||
cell : Backgrid.IntegerCell
|
||||
cell : NzbDrone.Shared.Cells.FileSizeCell
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
|
@ -34,24 +37,22 @@ define([
|
|||
cell : Backgrid.StringCell
|
||||
},
|
||||
{
|
||||
name : 'seasonNumber',
|
||||
label: 'season',
|
||||
cell : Backgrid.IntegerCell
|
||||
name : 'episodeNumbers',
|
||||
season : 'seasonNumber',
|
||||
airDate : 'airDate',
|
||||
episodes: 'episodeNumbers',
|
||||
label : 'season',
|
||||
cell : NzbDrone.Shared.Cells.EpisodeNumberCell
|
||||
},
|
||||
{
|
||||
name : 'episodeNumber',
|
||||
label: 'episode',
|
||||
cell : Backgrid.StringCell
|
||||
},
|
||||
{
|
||||
name : 'approved',
|
||||
label: 'Approved',
|
||||
cell : Backgrid.BooleanCell
|
||||
name : 'rejections',
|
||||
label: 'decision',
|
||||
cell : NzbDrone.Shared.Cells.ApprovalStatusCell
|
||||
}
|
||||
],
|
||||
|
||||
showTable: function () {
|
||||
if (!this.isClosed) {
|
||||
if (!this.isClosed) {
|
||||
this.grid.show(new Backgrid.Grid(
|
||||
{
|
||||
row : Backgrid.Row,
|
||||
|
|
19
UI/Shared/Cells/ApprovalStatusCell.js
Normal file
19
UI/Shared/Cells/ApprovalStatusCell.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
NzbDrone.Shared.Cells.ApprovalStatusCell = Backgrid.Cell.extend({
|
||||
|
||||
className: "approval-status-cell",
|
||||
|
||||
render: function () {
|
||||
var rejections = this.model.get(this.column.get("name"));
|
||||
|
||||
var result = '';
|
||||
|
||||
_.each(rejections, function (reason) {
|
||||
result += reason + ' ';
|
||||
});
|
||||
|
||||
this.$el.html(result);
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
});
|
30
UI/Shared/Cells/EpisodeNumberCell.js
Normal file
30
UI/Shared/Cells/EpisodeNumberCell.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
"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;
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue