parent
ac3582d5c4
commit
70cfa5e685
@ -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',
|
||||
|
@ -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,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 +0,0 @@
|
||||
{{episode.title}}
|
@ -1,2 +0,0 @@
|
||||
{{! TODO: Should use route instead of hard coding link }}
|
||||
<a href="/series/details/{{series.titleSlug}}">{{series.title}}</a>
|
@ -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;
|
||||
|
||||
}
|
||||
});
|
@ -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,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;
|
||||
}
|
||||
});
|
Loading…
Reference in new issue