From 86ef30480fccc7aa29061d16020abf991f5ab5e3 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 5 Sep 2014 08:28:58 -0700 Subject: [PATCH] Searching icons and spinner fix New: Manual search has its own icon on series details instead of a dropdown Fixed: Automatic search icon will spin showing activity --- .../IndexerSearch/EpisodeSearchCommand.cs | 7 ++-- src/UI/Cells/EpisodeActionsCell.js | 32 ++++++++----------- src/UI/Cells/EpisodeActionsCellTemplate.hbs | 14 -------- src/UI/Cells/cells.less | 19 ++--------- src/UI/Commands/CommandController.js | 1 - src/UI/Commands/CommandModel.js | 15 +++++++-- src/UI/Content/icons.less | 6 +++- 7 files changed, 37 insertions(+), 57 deletions(-) delete mode 100644 src/UI/Cells/EpisodeActionsCellTemplate.hbs diff --git a/src/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs b/src/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs index 67e275118..fb1d43113 100644 --- a/src/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs +++ b/src/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs @@ -1,11 +1,12 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using NzbDrone.Core.Messaging.Commands; namespace NzbDrone.Core.IndexerSearch { public class EpisodeSearchCommand : Command { - public List EpisodeIds { get; set; } + public List EpisodeIds { get; set; } public override bool SendUpdatesToClient { @@ -19,7 +20,7 @@ namespace NzbDrone.Core.IndexerSearch { } - public EpisodeSearchCommand(List episodeIds) + public EpisodeSearchCommand(List episodeIds) { EpisodeIds = episodeIds; } diff --git a/src/UI/Cells/EpisodeActionsCell.js b/src/UI/Cells/EpisodeActionsCell.js index ad87c1468..0a116dabe 100644 --- a/src/UI/Cells/EpisodeActionsCell.js +++ b/src/UI/Cells/EpisodeActionsCell.js @@ -3,37 +3,31 @@ define( [ 'vent', - 'marionette', 'Cells/NzbDroneCell', 'Commands/CommandController' - ], function (vent, Marionette, NzbDroneCell, CommandController) { + ], function (vent, 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' + 'click .x-automatic-search' : '_automaticSearch', + 'click .x-manual-search' : '_manualSearch' }, render: function () { - var templateName = this.column.get('template') || this.template; + this.$el.empty(); - this.templateFunction = Marionette.TemplateCache.get(templateName); - var data = this.cellValue.toJSON(); - var html = this.templateFunction(data); - this.$el.html(html); + this.$el.html( + '' + + '' + ); CommandController.bindToCommand({ - element: this.$(this.ui.automaticSearch), + element: this.$el.find('.x-automatic-search'), command: { - name : 'episodeSearch', - episodeId: this.model.get('id') + name : 'episodeSearch', + episodeIds : [ this.model.get('id') ] } }); @@ -43,8 +37,8 @@ define( _automaticSearch: function () { CommandController.Execute('episodeSearch', { - name : 'episodeSearch', - episodeIds: [ this.model.get('id') ] + name : 'episodeSearch', + episodeIds : [ this.model.get('id') ] }); }, diff --git a/src/UI/Cells/EpisodeActionsCellTemplate.hbs b/src/UI/Cells/EpisodeActionsCellTemplate.hbs deleted file mode 100644 index a30cf3d5f..000000000 --- a/src/UI/Cells/EpisodeActionsCellTemplate.hbs +++ /dev/null @@ -1,14 +0,0 @@ - - -
- -
\ No newline at end of file diff --git a/src/UI/Cells/cells.less b/src/UI/Cells/cells.less index 0eb6b6f30..0c8e1c5f4 100644 --- a/src/UI/Cells/cells.less +++ b/src/UI/Cells/cells.less @@ -114,24 +114,11 @@ td.episode-status-cell, td.quality-cell, td.history-quality-cell { } .episode-actions-cell { - width: 65px; + width: 55px; - li { + i { .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); + margin-left : 8px; } } diff --git a/src/UI/Commands/CommandController.js b/src/UI/Commands/CommandController.js index 90efe0829..a1a131b77 100644 --- a/src/UI/Commands/CommandController.js +++ b/src/UI/Commands/CommandController.js @@ -52,7 +52,6 @@ define( bindToCommand: function (options) { var self = this; - var existingCommand = CommandCollection.findCommand(options.command); if (existingCommand) { diff --git a/src/UI/Commands/CommandModel.js b/src/UI/Commands/CommandModel.js index cdb492ca6..9f1774b08 100644 --- a/src/UI/Commands/CommandModel.js +++ b/src/UI/Commands/CommandModel.js @@ -1,8 +1,9 @@ 'use strict'; define( [ + 'underscore', 'backbone' - ], function (Backbone) { + ], function (_, Backbone) { return Backbone.Model.extend({ url: window.NzbDrone.ApiRoot + '/command', @@ -18,8 +19,16 @@ define( } for (var key in command) { - if (key !== 'name' && command[key] !== this.get(key)) { - return false; + if (key !== 'name') { + if (Array.isArray(command[key])) { + if (_.difference(command[key], this.get(key)).length > 0) { + return false; + } + } + + else if (command[key] !== this.get(key)) { + return false; + } } } diff --git a/src/UI/Content/icons.less b/src/UI/Content/icons.less index 0468bd894..cd0be768b 100644 --- a/src/UI/Content/icons.less +++ b/src/UI/Content/icons.less @@ -190,4 +190,8 @@ .icon-nd-health-error:before { .icon(@exclamation-sign); color : @brand-danger; -} \ No newline at end of file +} + +.icon-nd-manual-search:before { + .icon(@male); +}