mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
Finished Series Index Table formatting
This commit is contained in:
parent
d706a35ab7
commit
4cc4e8133e
@ -104,6 +104,7 @@
|
||||
<script src="/Mixins/tablesorter.extensions.js"></script>
|
||||
<script src="/Mixins/spoon.js"></script>
|
||||
<script src="/Mixins/backbone.modelbinder.mixin.js"></script>
|
||||
<script src="/Mixins/backbone.Backgrid.mixin.js"></script>
|
||||
|
||||
<script data-main="/app" src="/JsLibraries/require.js"></script>
|
||||
<script src="/Routing.js"></script>
|
||||
|
83
UI/Mixins/backbone.Backgrid.mixin.js
Normal file
83
UI/Mixins/backbone.Backgrid.mixin.js
Normal file
@ -0,0 +1,83 @@
|
||||
Backgrid.SeriesStatusCell = Backgrid.Cell.extend({
|
||||
className: "series-status-cell",
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
var monitored = this.model.get('monitored');
|
||||
var status = this.model.get('status');
|
||||
|
||||
if (!monitored) {
|
||||
this.$el.html('<i class="icon-pause grid-icon" title="Not Monitored"></i>');
|
||||
}
|
||||
else if (status === 0) {
|
||||
this.$el.html('<i class="icon-play grid-icon" title="Continuing"></i>');
|
||||
}
|
||||
|
||||
else {
|
||||
this.$el.html('<i class="icon-stop grid-icon" title="Ended"></i>');
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
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(bestDateString(airDate));
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
Backgrid.EpisodeProgressCell = Backgrid.Cell.extend({
|
||||
className: "episode-progress-cell",
|
||||
template: 'Series/EpisodeProgressTemplate',
|
||||
|
||||
render: function () {
|
||||
var data = this.model.toJSON();
|
||||
var html = Marionette.Renderer.render(this.template, data);
|
||||
this.$el.html(html);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
Backgrid.ControlsColumnCell = Backgrid.Cell.extend({
|
||||
className: "controls-cell",
|
||||
template: 'Series/Index/Table/ControlsColumnTemplate',
|
||||
|
||||
render: function () {
|
||||
var data = this.model.toJSON();
|
||||
var html = Marionette.Renderer.render(this.template, data);
|
||||
this.$el.html(html);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
Backgrid.SeriesIndexTableRow = Backgrid.Row.extend({
|
||||
events: {
|
||||
'click .x-edit' : 'editSeries',
|
||||
'click .x-remove': 'removeSeries'
|
||||
},
|
||||
|
||||
editSeries: function () {
|
||||
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
|
||||
|
||||
NzbDrone.vent.trigger(NzbDrone.Events.OpenModalDialog, {
|
||||
view: view
|
||||
});
|
||||
},
|
||||
|
||||
removeSeries: function () {
|
||||
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
|
||||
NzbDrone.vent.trigger(NzbDrone.Events.OpenModalDialog, {
|
||||
view: view
|
||||
});
|
||||
}
|
||||
});
|
5
UI/Series/EpisodeProgressTemplate.html
Normal file
5
UI/Series/EpisodeProgressTemplate.html
Normal file
@ -0,0 +1,5 @@
|
||||
<div class="progress">
|
||||
<span class="progressbar-back-text">{{episodeFileCount}} / {{episodeCount}}</span>
|
||||
|
||||
<div class="bar" style="width:{{percentOfEpisodes}}%"><span class="progressbar-front-text">{{episodeFileCount}} / {{episodeCount}}</span></div>
|
||||
</div>
|
@ -58,27 +58,27 @@ define([
|
||||
name: 'nextAiring',
|
||||
label: 'Next Airing',
|
||||
editable: false,
|
||||
cell: 'datetime',
|
||||
formatter: new Backgrid.AirDateFormatter()
|
||||
cell: 'airDate'
|
||||
},
|
||||
{
|
||||
name: 'episodes',
|
||||
label: 'Episodes',
|
||||
editable: false,
|
||||
sortable: false,
|
||||
cell: 'string'
|
||||
cell: 'episodeProgress'
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
label: '',
|
||||
editable: false,
|
||||
sortable: false,
|
||||
cell: 'string'
|
||||
cell: 'controlsColumn'
|
||||
}
|
||||
];
|
||||
|
||||
this.series.show(new Backgrid.Grid(
|
||||
{
|
||||
row: Backgrid.SeriesIndexTableRow,
|
||||
columns : columns,
|
||||
collection : this.seriesCollection,
|
||||
className: 'table table-hover'
|
||||
|
2
UI/Series/Index/Table/ControlsColumnTemplate.html
Normal file
2
UI/Series/Index/Table/ControlsColumnTemplate.html
Normal file
@ -0,0 +1,2 @@
|
||||
<i class="icon-cog x-edit" title="Edit Series"></i>
|
||||
<i class="icon-remove x-remove" title="Delete Series"></i>
|
44
UI/app.js
44
UI/app.js
@ -71,49 +71,6 @@ define('app', function () {
|
||||
|
||||
console.log('starting application');
|
||||
|
||||
//TODO: move these out of here
|
||||
Backgrid.SeriesStatusCell = Backgrid.Cell.extend({
|
||||
className: "series-status-cell",
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
var monitored = this.model.get('monitored');
|
||||
var status = this.model.get('status');
|
||||
|
||||
if (!monitored) {
|
||||
this.$el.html('<i class="icon-pause grid-icon" title="Not Monitored"></i>');
|
||||
}
|
||||
else if (status === 0) {
|
||||
this.$el.html('<i class="icon-play grid-icon" title="Continuing"></i>');
|
||||
}
|
||||
|
||||
else {
|
||||
this.$el.html('<i class="icon-stop grid-icon" title="Ended"></i>');
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
var AirDateFormatter = Backgrid.AirDateFormatter = function () {};
|
||||
AirDateFormatter.prototype = new Backgrid.CellFormatter();
|
||||
_.extend(AirDateFormatter.prototype, {
|
||||
/**
|
||||
Converts any value to a string using Ecmascript's implicit type
|
||||
conversion. If the given value is `null` or `undefined`, an empty string is
|
||||
returned instead.
|
||||
|
||||
@member Backgrid.StringFormatter
|
||||
@param {*} rawValue
|
||||
@return {string}
|
||||
*/
|
||||
fromRaw: function (rawValue) {
|
||||
return 'Hello World';
|
||||
|
||||
if (_.isUndefined(rawValue) || _.isNull(rawValue)) return '';
|
||||
return rawValue + '';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
NzbDrone.addRegions({
|
||||
@ -122,7 +79,6 @@ define('app', function () {
|
||||
notificationRegion: '#notification-region'
|
||||
});
|
||||
|
||||
|
||||
window.NzbDrone.start();
|
||||
|
||||
return NzbDrone;
|
||||
|
Loading…
Reference in New Issue
Block a user