mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
Adding history
This commit is contained in:
parent
6a3d886588
commit
7ab1084437
20 changed files with 289 additions and 7 deletions
|
@ -4,7 +4,8 @@ define(['app', 'Shared/ModalRegion', 'AddSeries/AddSeriesLayout',
|
|||
'Calendar/CalendarCollectionView', 'Shared/NotificationView',
|
||||
'Shared/NotFoundView', 'MainMenuView',
|
||||
'Series/Details/SeriesDetailsView', 'Series/EpisodeCollection',
|
||||
'Settings/SettingsLayout', 'Missing/MissingLayout'],
|
||||
'Settings/SettingsLayout', 'Missing/MissingLayout',
|
||||
'History/HistoryLayout'],
|
||||
function (app, modalRegion) {
|
||||
|
||||
var controller = Backbone.Marionette.Controller.extend({
|
||||
|
@ -61,6 +62,12 @@ define(['app', 'Shared/ModalRegion', 'AddSeries/AddSeriesLayout',
|
|||
NzbDrone.mainRegion.show(new NzbDrone.Missing.MissingLayout());
|
||||
},
|
||||
|
||||
history: function () {
|
||||
this._setTitle('History');
|
||||
|
||||
NzbDrone.mainRegion.show(new NzbDrone.History.HistoryLayout());
|
||||
},
|
||||
|
||||
notFound: function () {
|
||||
this._setTitle('Not Found');
|
||||
NzbDrone.mainRegion.show(new NzbDrone.Shared.NotFoundView(this));
|
||||
|
|
37
UI/History/Collection.js
Normal file
37
UI/History/Collection.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
define(['app', 'History/Model'], function () {
|
||||
NzbDrone.Missing.Collection = Backbone.PageableCollection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/history',
|
||||
model : NzbDrone.History.Model,
|
||||
|
||||
state: {
|
||||
pageSize: 10,
|
||||
sortKey: "date",
|
||||
order: 1
|
||||
},
|
||||
|
||||
queryParams: {
|
||||
totalPages: null,
|
||||
totalRecords: null,
|
||||
pageSize: 'pageSize',
|
||||
sortKey: "sortKey",
|
||||
order: "sortDir",
|
||||
directions: {
|
||||
"-1": "asc",
|
||||
"1": "desc"
|
||||
}
|
||||
},
|
||||
|
||||
parseState: function (resp, queryParams, state) {
|
||||
return {totalRecords: resp.totalRecords};
|
||||
},
|
||||
|
||||
parseRecords: function (resp) {
|
||||
if (resp) {
|
||||
return resp.records;
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
});
|
||||
});
|
1
UI/History/ControlsColumnTemplate.html
Normal file
1
UI/History/ControlsColumnTemplate.html
Normal file
|
@ -0,0 +1 @@
|
|||
<i class="icon-search x-search" title="Search"></i>
|
2
UI/History/EpisodeColumnTemplate.html
Normal file
2
UI/History/EpisodeColumnTemplate.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
{{seasonNumber}}x{{paddedEpisodeNumber}}
|
89
UI/History/HistoryLayout.js
Normal file
89
UI/History/HistoryLayout.js
Normal file
|
@ -0,0 +1,89 @@
|
|||
"use strict";
|
||||
define([
|
||||
'app',
|
||||
'History/Collection',
|
||||
'Series/Index/Table/AirDateCell',
|
||||
'Shared/Toolbar/ToolbarView',
|
||||
'Shared/Toolbar/ToolbarLayout'
|
||||
],
|
||||
function () {
|
||||
NzbDrone.History.HistoryLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'History/HistoryLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
history: '#x-history',
|
||||
toolbar: '#x-toolbar',
|
||||
pager : '#x-pager'
|
||||
},
|
||||
|
||||
showTable: function () {
|
||||
|
||||
var columns = [
|
||||
{
|
||||
name : 'seriesTitle',
|
||||
label : 'Series Title',
|
||||
editable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/SeriesTitleTemplate' }),
|
||||
headerCell: 'nzbDrone'
|
||||
},
|
||||
{
|
||||
name : 'episode',
|
||||
label : 'Episode',
|
||||
editable : false,
|
||||
sortable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/EpisodeColumnTemplate' }),
|
||||
headerCell: 'nzbDrone'
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Episode Title',
|
||||
editable : false,
|
||||
sortable : false,
|
||||
cell : 'string',
|
||||
headerCell: 'nzbDrone'
|
||||
},
|
||||
{
|
||||
name : 'airDate',
|
||||
label : 'Air Date',
|
||||
editable : false,
|
||||
cell : 'airDate',
|
||||
headerCell: 'nzbDrone'
|
||||
},
|
||||
{
|
||||
name : 'edit',
|
||||
label : '',
|
||||
editable : false,
|
||||
sortable : false,
|
||||
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/ControlsColumnTemplate' }),
|
||||
headerCell: 'nzbDrone'
|
||||
}
|
||||
];
|
||||
|
||||
this.history.show(new Backgrid.Grid(
|
||||
{
|
||||
row : NzbDrone.History.Row,
|
||||
columns : columns,
|
||||
collection: this.historyCollection,
|
||||
className : 'table table-hover'
|
||||
}));
|
||||
|
||||
this.pager.show(new Backgrid.NzbDronePaginator({
|
||||
columns: columns,
|
||||
collection: this.historyCollection
|
||||
}));
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.historyCollection = new NzbDrone.History.Collection();
|
||||
this.historyCollection.fetch();
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.showTable();
|
||||
//this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
|
||||
}
|
||||
|
||||
})
|
||||
;
|
||||
})
|
||||
;
|
11
UI/History/HistoryLayoutTemplate.html
Normal file
11
UI/History/HistoryLayoutTemplate.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div id="x-toolbar"></div>
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="x-history"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="x-pager"></div>
|
||||
</div>
|
||||
</div>
|
6
UI/History/Model.js
Normal file
6
UI/History/Model.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
define(['app'], function (app) {
|
||||
NzbDrone.History.Model = Backbone.Model.extend({
|
||||
|
||||
});
|
||||
});
|
9
UI/History/Row.js
Normal file
9
UI/History/Row.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
NzbDrone.Missing.Row = Backgrid.Row.extend({
|
||||
events: {
|
||||
'click .x-search' : 'search'
|
||||
},
|
||||
|
||||
search: function () {
|
||||
window.alert('Episode Search');
|
||||
}
|
||||
});
|
1
UI/History/SeriesTitleTemplate.html
Normal file
1
UI/History/SeriesTitleTemplate.html
Normal file
|
@ -0,0 +1 @@
|
|||
<a href="series/details/{{series.titleSlug}}">{{series.title}}</a>
|
|
@ -71,12 +71,11 @@ define([
|
|||
columns: columns,
|
||||
collection: this.missingCollection
|
||||
}));
|
||||
|
||||
this.missingCollection.getFirstPage();
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.missingCollection = new NzbDrone.Missing.Collection();
|
||||
this.missingCollection.fetch();
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
|
|
|
@ -17,6 +17,7 @@ require(['app', 'Controller'], function (app, controller) {
|
|||
'settings' : 'settings',
|
||||
'settings/:action(/:query)' : 'settings',
|
||||
'missing' : 'missing',
|
||||
'history' : 'history',
|
||||
':whatever' : 'notFound'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -10,6 +10,11 @@ define(['app', 'Series/SeriesModel'], function () {
|
|||
sortKey: "title",
|
||||
order: -1,
|
||||
pageSize: 1000000
|
||||
},
|
||||
|
||||
queryParams: {
|
||||
sortKey: null,
|
||||
order: null
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -58,6 +58,7 @@ define('app', function () {
|
|||
window.NzbDrone.Settings.System = {};
|
||||
window.NzbDrone.Settings.Misc = {};
|
||||
window.NzbDrone.Missing = {};
|
||||
window.NzbDrone.History = {};
|
||||
|
||||
window.NzbDrone.Events = {
|
||||
//TODO: Move to commands
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue