2013-05-15 03:17:24 +02:00
|
|
|
"use strict";
|
2013-06-07 02:17:57 +02:00
|
|
|
define(['app', 'Shared/SpinnerView', 'Episode/Summary/View', 'Episode/Search/Layout', 'Release/Collection'], function () {
|
2013-05-15 03:17:24 +02:00
|
|
|
|
2013-05-21 02:17:33 +02:00
|
|
|
NzbDrone.Episode.Layout = Backbone.Marionette.Layout.extend({
|
|
|
|
template: 'Episode/LayoutTemplate',
|
|
|
|
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
summary : '#episode-summary',
|
|
|
|
activity: '#episode-activity',
|
|
|
|
search : '#episode-search'
|
|
|
|
},
|
|
|
|
|
|
|
|
ui: {
|
|
|
|
summary : '.x-episode-summary',
|
|
|
|
activity: '.x-episode-activity',
|
|
|
|
search : '.x-episode-search'
|
|
|
|
},
|
|
|
|
|
|
|
|
events: {
|
|
|
|
|
|
|
|
'click .x-episode-summary' : 'showSummary',
|
|
|
|
'click .x-episode-activity': 'showActivity',
|
|
|
|
'click .x-episode-search' : 'showSearch'
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
this.showSummary();
|
2013-06-07 02:17:57 +02:00
|
|
|
this._releaseSearchActivated = false;
|
2013-05-21 02:17:33 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
showSummary: function (e) {
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.ui.summary.tab('show');
|
|
|
|
this.summary.show(new NzbDrone.Episode.Summary.View({model: this.model}));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
showActivity: function (e) {
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.ui.activity.tab('show');
|
|
|
|
},
|
|
|
|
|
|
|
|
showSearch: function (e) {
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
|
2013-06-07 02:17:57 +02:00
|
|
|
if (this._releaseSearchActivated) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
2013-05-21 02:17:33 +02:00
|
|
|
this.ui.search.tab('show');
|
2013-06-07 02:17:57 +02:00
|
|
|
this.search.show(new NzbDrone.Shared.SpinnerView());
|
|
|
|
|
|
|
|
var releases = new NzbDrone.Release.Collection();
|
|
|
|
var promise = releases.fetchEpisodeReleases(this.model.id);
|
|
|
|
|
|
|
|
promise.done(function () {
|
2013-06-07 16:34:54 +02:00
|
|
|
if (!self.isClosed) {
|
|
|
|
self.search.show(new NzbDrone.Episode.Search.Layout({collection: releases}));
|
|
|
|
}
|
2013-06-07 02:17:57 +02:00
|
|
|
});
|
2013-05-21 02:17:33 +02:00
|
|
|
}
|
2013-05-15 03:17:24 +02:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2013-06-07 02:17:57 +02:00
|
|
|
});
|