mirror of https://github.com/Sonarr/Sonarr
Added search button/menu to series details grid
Also fixed some names to make name navigation easier.
This commit is contained in:
parent
4a3410f85a
commit
7320342123
|
@ -0,0 +1,54 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
define(
|
||||||
|
[
|
||||||
|
'app',
|
||||||
|
'Cells/NzbDroneCell',
|
||||||
|
'Commands/CommandController'
|
||||||
|
], function (App, NzbDroneCell, CommandController) {
|
||||||
|
return NzbDroneCell.extend({
|
||||||
|
|
||||||
|
className: 'episode-actions-cell',
|
||||||
|
template : 'Cells/EpisodeActionsCellTemplate',
|
||||||
|
|
||||||
|
ui: {
|
||||||
|
automaticSearch: '.x-automatic-search-icon'
|
||||||
|
},
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'click .x-automatic-search': '_automaticSearch',
|
||||||
|
'click .x-manual-search' : '_manualSearch'
|
||||||
|
},
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
CommandController.bindToCommand({
|
||||||
|
element: this.$(this.ui.automaticSearch),
|
||||||
|
command: {
|
||||||
|
name : 'episodeSearch',
|
||||||
|
episodeId: this.model.get('id')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.delegateEvents();
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
_automaticSearch: function () {
|
||||||
|
CommandController.Execute('episodeSearch', {
|
||||||
|
name : 'episodeSearch',
|
||||||
|
episodeId: this.model.get('id')
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_manualSearch: function () {
|
||||||
|
App.vent.trigger(App.Commands.ShowEpisodeDetails, { episode: this.cellValue, hideSeriesLink: true, openingTab: 'search' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,10 @@
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-mini x-automatic-search x-automatic-search-icon" title="Automatic Search" data-container="body"><i class="icon-search"></i></button>
|
||||||
|
<button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li class="x-automatic-search">Automatic Search</li>
|
||||||
|
<li class="x-manual-search">Manual Search</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -27,7 +27,7 @@ define(
|
||||||
_showDetails: function () {
|
_showDetails: function () {
|
||||||
var hideSeriesLink = this.column.get('hideSeriesLink');
|
var hideSeriesLink = this.column.get('hideSeriesLink');
|
||||||
|
|
||||||
App.vent.trigger(App.Commands.ShowEpisodeDetails, {episode: this.cellValue, hideSeriesLink: hideSeriesLink });
|
App.vent.trigger(App.Commands.ShowEpisodeDetails, { episode: this.cellValue, hideSeriesLink: hideSeriesLink });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -62,3 +62,25 @@ td.episode-status-cell, td.quality-cell {
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.episode-actions-cell {
|
||||||
|
width: 20px;
|
||||||
|
|
||||||
|
li {
|
||||||
|
.clickable();
|
||||||
|
|
||||||
|
display: block;
|
||||||
|
padding: 3px 20px;
|
||||||
|
clear: both;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 20px;
|
||||||
|
color: rgb(51, 51, 51);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
li:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
background-color: rgb(0, 129, 194);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,12 +3,12 @@ define(
|
||||||
[
|
[
|
||||||
'marionette',
|
'marionette',
|
||||||
'Episode/Summary/EpisodeSummaryLayout',
|
'Episode/Summary/EpisodeSummaryLayout',
|
||||||
'Episode/Search/Layout',
|
'Episode/Search/EpisodeSearchLayout',
|
||||||
'Series/SeriesCollection'
|
'Series/SeriesCollection'
|
||||||
], function (Marionette, SummaryLayout, SearchLayout, SeriesCollection) {
|
], function (Marionette, SummaryLayout, SearchLayout, SeriesCollection) {
|
||||||
|
|
||||||
return Marionette.Layout.extend({
|
return Marionette.Layout.extend({
|
||||||
template: 'Episode/LayoutTemplate',
|
template: 'Episode/EpisodeDetailsLayoutTemplate',
|
||||||
|
|
||||||
regions: {
|
regions: {
|
||||||
summary : '#episode-summary',
|
summary : '#episode-summary',
|
||||||
|
@ -38,11 +38,21 @@ define(
|
||||||
|
|
||||||
this.series = SeriesCollection.find({ id: this.model.get('seriesId') });
|
this.series = SeriesCollection.find({ id: this.model.get('seriesId') });
|
||||||
this.templateHelpers.series = this.series.toJSON();
|
this.templateHelpers.series = this.series.toJSON();
|
||||||
|
this.openingTab = options.openingTab || 'summary'
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
this._showSummary();
|
|
||||||
this.searchLayout = new SearchLayout({ model: this.model });
|
this.searchLayout = new SearchLayout({ model: this.model });
|
||||||
|
|
||||||
|
if (this.openingTab === 'search') {
|
||||||
|
this.searchLayout.startManualSearch = true;
|
||||||
|
this._showSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
this._showSummary();
|
||||||
|
}
|
||||||
|
|
||||||
this._setMonitoredState();
|
this._setMonitoredState();
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,7 @@ define(
|
||||||
], function (App, Marionette, ButtonsView, ManualSearchLayout, ReleaseCollection, SeriesCollection,CommandController, LoadingView) {
|
], function (App, Marionette, ButtonsView, ManualSearchLayout, ReleaseCollection, SeriesCollection,CommandController, LoadingView) {
|
||||||
|
|
||||||
return Marionette.Layout.extend({
|
return Marionette.Layout.extend({
|
||||||
template: 'Episode/Search/LayoutTemplate',
|
template: 'Episode/Search/EpisodeSearchLayoutTemplate',
|
||||||
|
|
||||||
regions: {
|
regions: {
|
||||||
main: '#episode-search-region'
|
main: '#episode-search-region'
|
||||||
|
@ -29,7 +29,13 @@ define(
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
this._showMainView();
|
if (this.startManualSearch) {
|
||||||
|
this._searchManual();
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
this._showMainView();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_searchAuto: function (e) {
|
_searchAuto: function (e) {
|
|
@ -29,7 +29,7 @@ define(
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
this.$el.html('');
|
this.$el.empty();
|
||||||
|
|
||||||
if (this.model.get('downloadAllowed'))
|
if (this.model.get('downloadAllowed'))
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,9 +8,10 @@ define(
|
||||||
'Cells/EpisodeTitleCell',
|
'Cells/EpisodeTitleCell',
|
||||||
'Cells/RelativeDateCell',
|
'Cells/RelativeDateCell',
|
||||||
'Cells/EpisodeStatusCell',
|
'Cells/EpisodeStatusCell',
|
||||||
|
'Cells/EpisodeActionsCell',
|
||||||
'Commands/CommandController',
|
'Commands/CommandController',
|
||||||
'moment'
|
'moment'
|
||||||
], function (App, Marionette, Backgrid, ToggleCell, EpisodeTitleCell, RelativeDateCell, EpisodeStatusCell, CommandController, Moment) {
|
], function (App, Marionette, Backgrid, ToggleCell, EpisodeTitleCell, RelativeDateCell, EpisodeStatusCell, EpisodeActionsCell, CommandController, Moment) {
|
||||||
return Marionette.Layout.extend({
|
return Marionette.Layout.extend({
|
||||||
template: 'Series/Details/SeasonLayoutTemplate',
|
template: 'Series/Details/SeasonLayoutTemplate',
|
||||||
|
|
||||||
|
@ -67,6 +68,12 @@ define(
|
||||||
label : 'Status',
|
label : 'Status',
|
||||||
cell : EpisodeStatusCell,
|
cell : EpisodeStatusCell,
|
||||||
sortable: false
|
sortable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'this',
|
||||||
|
label : '',
|
||||||
|
cell : EpisodeActionsCell,
|
||||||
|
sortable: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ define(
|
||||||
'marionette',
|
'marionette',
|
||||||
'Series/Edit/EditSeriesView',
|
'Series/Edit/EditSeriesView',
|
||||||
'Series/Delete/DeleteSeriesView',
|
'Series/Delete/DeleteSeriesView',
|
||||||
'Episode/Layout',
|
'Episode/EpisodeDetailsLayout',
|
||||||
'History/Details/HistoryDetailsView'
|
'History/Details/HistoryDetailsView'
|
||||||
], function (App, Marionette, EditSeriesView, DeleteSeriesView, EpisodeLayout, HistoryDetailsView) {
|
], function (App, Marionette, EditSeriesView, DeleteSeriesView, EpisodeDetailsLayout, HistoryDetailsView) {
|
||||||
|
|
||||||
var router = Marionette.AppRouter.extend({
|
var router = Marionette.AppRouter.extend({
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ define(
|
||||||
},
|
},
|
||||||
|
|
||||||
_showEpisode: function (options) {
|
_showEpisode: function (options) {
|
||||||
var view = new EpisodeLayout({ model: options.episode, hideSeriesLink: options.hideSeriesLink });
|
var view = new EpisodeDetailsLayout({ model: options.episode, hideSeriesLink: options.hideSeriesLink, openingTab: options.openingTab });
|
||||||
App.modalRegion.show(view);
|
App.modalRegion.show(view);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue