Added search button/menu to series details grid

Also fixed some names to make name navigation easier.
This commit is contained in:
Mark McDowall 2013-09-18 22:49:15 -07:00
commit 7320342123
11 changed files with 120 additions and 11 deletions

View file

@ -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' });
}
});
});

View file

@ -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>

View file

@ -27,7 +27,7 @@ define(
_showDetails: function () {
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 });
}
});
});

View file

@ -61,4 +61,26 @@ td.episode-status-cell, td.quality-cell {
.nzb-title-cell {
max-width: 600px;
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);
}
}