From a34e6f3c70f8ac23c55a2ca78fe65935562121c8 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 23 Jun 2013 21:37:55 -0700 Subject: [PATCH] Season Search added to series details --- UI/Commands/CommandController.js | 2 +- UI/Series/Details/SeasonLayout.js | 47 ++++++++++++++++++++- UI/Series/Details/SeasonLayoutTemplate.html | 2 +- UI/Series/details.less | 7 +++ 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/UI/Commands/CommandController.js b/UI/Commands/CommandController.js index 16a0a17f9..2b7bc3e90 100644 --- a/UI/Commands/CommandController.js +++ b/UI/Commands/CommandController.js @@ -4,7 +4,7 @@ define(['app'], function () { NzbDrone.Commands.Execute = function (name, properties) { var data = { command: name }; - if (!properties) { + if (properties) { $.extend(data, properties); } diff --git a/UI/Series/Details/SeasonLayout.js b/UI/Series/Details/SeasonLayout.js index ea1da3b97..1b4fcfe64 100644 --- a/UI/Series/Details/SeasonLayout.js +++ b/UI/Series/Details/SeasonLayout.js @@ -4,11 +4,20 @@ define([ 'Cells/EpisodeStatusCell', 'Cells/EpisodeTitleCell', 'Cells/AirDateCell', - 'Cells/ToggleCell'], - function (App, EpisodeStatusCell, EpisodeTitleCell, AirDateCell, ToggleCell) { + 'Cells/ToggleCell', + 'Shared/Messenger'], + function (App, EpisodeStatusCell, EpisodeTitleCell, AirDateCell, ToggleCell, Messenger) { return Backbone.Marionette.Layout.extend({ template: 'Series/Details/SeasonLayoutTemplate', + ui: { + seasonSearch: '.x-season-search' + }, + + events: { + 'click .x-season-search': '_seasonSearch' + }, + regions: { episodeGrid: '#x-episode-grid' }, @@ -63,6 +72,40 @@ define([ collection: this.episodeCollection, className : 'table table-hover season-grid' })); + }, + + _seasonSearch: function () { + var command = 'seasonSearch'; + + this.idle = false; + + this.ui.seasonSearch.addClass('icon-spinner icon-spin'); + + var properties = { + seriesId: this.model.get('seriesId'), + seasonNumber: this.model.get('seasonNumber') + }; + + var self = this; + var commandPromise = App.Commands.Execute(command, properties); + + commandPromise.fail(function (options) { + if (options.readyState === 0 || options.status === 0) { + return; + } + + Messenger.show({ + message: 'Season search failed', + type : 'error' + }); + }); + + commandPromise.always(function () { + if (!self.isClosed) { + self.ui.seasonSearch.removeClass('icon-spinner icon-spin'); + self.idle = true; + } + }); } }); }); diff --git a/UI/Series/Details/SeasonLayoutTemplate.html b/UI/Series/Details/SeasonLayoutTemplate.html index 472a5dd68..4522cc268 100644 --- a/UI/Series/Details/SeasonLayoutTemplate.html +++ b/UI/Series/Details/SeasonLayoutTemplate.html @@ -1,4 +1,4 @@ 
-

{{seasonTitle}}

+

{{seasonTitle}}

diff --git a/UI/Series/details.less b/UI/Series/details.less index 193440582..15f2996e7 100644 --- a/UI/Series/details.less +++ b/UI/Series/details.less @@ -1,3 +1,5 @@ +@import "../shared/Styles/clickable.less"; + .series-season { .episode-number-cell { width: 22px; @@ -34,3 +36,8 @@ width: 10px; } } + +.season-search { + .clickable; + font-size: 24px; +} \ No newline at end of file