mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
added release results to episode detail tab
This commit is contained in:
parent
a5be71fd8c
commit
890d1f2398
14 changed files with 191 additions and 48 deletions
|
@ -1,5 +1,5 @@
|
|||
"use strict";
|
||||
define(['app', 'Episode/Summary/View'], function () {
|
||||
define(['app', 'Shared/SpinnerView', 'Episode/Summary/View', 'Episode/Search/Layout', 'Release/Collection'], function () {
|
||||
|
||||
NzbDrone.Episode.Layout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Episode/LayoutTemplate',
|
||||
|
@ -27,6 +27,7 @@ define(['app', 'Episode/Summary/View'], function () {
|
|||
|
||||
onShow: function () {
|
||||
this.showSummary();
|
||||
this._releaseSearchActivated = false;
|
||||
},
|
||||
|
||||
|
||||
|
@ -53,9 +54,23 @@ define(['app', 'Episode/Summary/View'], function () {
|
|||
e.preventDefault();
|
||||
}
|
||||
|
||||
if (this._releaseSearchActivated) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
this.ui.search.tab('show');
|
||||
this.search.show(new NzbDrone.Shared.SpinnerView());
|
||||
|
||||
var releases = new NzbDrone.Release.Collection();
|
||||
var promise = releases.fetchEpisodeReleases(this.model.id);
|
||||
|
||||
promise.done(function () {
|
||||
self.search.show(new NzbDrone.Episode.Search.Layout({collection: releases}));
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,9 +2,65 @@
|
|||
define(['app'], function () {
|
||||
|
||||
NzbDrone.Episode.Search.Layout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Episode/Search/LayoutTemplate'
|
||||
template: 'Episode/Search/LayoutTemplate',
|
||||
|
||||
regions: {
|
||||
grid: '#episode-release-grid'
|
||||
},
|
||||
|
||||
columns: [
|
||||
{
|
||||
name : 'age',
|
||||
label : 'Age',
|
||||
sortable: true,
|
||||
cell : Backgrid.IntegerCell
|
||||
},
|
||||
{
|
||||
name : 'size',
|
||||
label : 'Size',
|
||||
sortable: true,
|
||||
cell : Backgrid.IntegerCell
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
sortable: true,
|
||||
cell : Backgrid.StringCell
|
||||
},
|
||||
{
|
||||
name : 'seasonNumber',
|
||||
label: 'season',
|
||||
cell : Backgrid.IntegerCell
|
||||
},
|
||||
{
|
||||
name : 'episodeNumber',
|
||||
label: 'episode',
|
||||
cell : Backgrid.StringCell
|
||||
},
|
||||
{
|
||||
name : 'approved',
|
||||
label: 'Approved',
|
||||
cell : Backgrid.BooleanCell
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
|
||||
initialize: function () {
|
||||
|
||||
},
|
||||
|
||||
onShow :function(){
|
||||
if (!this.isClosed) {
|
||||
this.grid.show(new Backgrid.Grid(
|
||||
{
|
||||
row : Backgrid.Row,
|
||||
columns : this.columns,
|
||||
collection: this.collection,
|
||||
className : 'table table-hover'
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
|
||||
<div id="episode-release-grid"/>
|
||||
|
|
|
@ -4,6 +4,10 @@ define(['app', 'Release/Model'], function () {
|
|||
url : NzbDrone.Constants.ApiRoot + '/release',
|
||||
model: NzbDrone.Release.Model,
|
||||
|
||||
mode : 'client'
|
||||
mode: 'client',
|
||||
|
||||
fetchEpisodeReleases: function (episodeId) {
|
||||
return this.fetch({ data: { episodeId: episodeId }});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,9 +10,18 @@ define(['app'], function () {
|
|||
$(document).on('click', 'a[href]', this._handleClick);
|
||||
},
|
||||
|
||||
_isInTab: function (element) {
|
||||
return;
|
||||
},
|
||||
|
||||
_handleClick: function (event) {
|
||||
var $target = $(event.target);
|
||||
|
||||
//check if tab nav
|
||||
if ($target.parents('.nav-tabs').length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($target.hasClass('no-router')) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue