diff --git a/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs index 7c1504d4a..d147bc47b 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs @@ -19,6 +19,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The Office - S01E01 - Pilot [HTDV-1080p]", "DRONE")] [TestCase("The.Walking.Dead.S04E13.720p.WEB-DL.AAC2.0.H.264-Cyphanix", "Cyphanix")] [TestCase("Arrow.S02E01.720p.WEB-DL.DD5.1.H.264.mkv", "DRONE")] + [TestCase("Series Title S01E01 Episode Title", "DRONE")] public void should_parse_release_group(string title, string expected) { Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); diff --git a/src/UI/Mixins/AsModelBoundView.js b/src/UI/Mixins/AsModelBoundView.js index be70ec65b..0095370e0 100644 --- a/src/UI/Mixins/AsModelBoundView.js +++ b/src/UI/Mixins/AsModelBoundView.js @@ -30,7 +30,7 @@ define( } }; - this.prototype.beforeClose = function () { + this.prototype.onBeforeClose = function () { if (this._modelBinder) { this._modelBinder.unbind(); diff --git a/src/UI/Mixins/AsValidatedView.js b/src/UI/Mixins/AsValidatedView.js index 952c1da69..7a6cea293 100644 --- a/src/UI/Mixins/AsValidatedView.js +++ b/src/UI/Mixins/AsValidatedView.js @@ -12,19 +12,12 @@ define( var originalBeforeClose = this.prototype.onBeforeClose; var errorHandler = function (response) { - - if (response.status === 400) { - - var view = this; - var validationErrors = JSON.parse(response.responseText); - _.each(validationErrors, function (error) { - view.$el.processServerError(error); - }); - } + this.model.trigger('validation:failed', response); }; - var validatedSync = function (method, model,options) { - this.$el.removeAllErrors(); + var validatedSync = function (method, model, options) { + model.trigger('validation:sync'); +// this.$el.removeAllErrors(); arguments[2].isValidatedCall = true; return model._originalSync.apply(this, arguments).fail(errorHandler.bind(this)); }; @@ -39,6 +32,21 @@ define( this.prototype.onRender = function () { + this.listenTo(this.model, 'validation:sync', function () { + this.$el.removeAllErrors(); + }); + + this.listenTo(this.model, 'validation:failed', function (response) { + if (response.status === 400) { + + var view = this; + var validationErrors = JSON.parse(response.responseText); + _.each(validationErrors, function (error) { + view.$el.processServerError(error); + }); + } + }); + Validation.bind(this); this.bindToModelValidation = bindToModel.bind(this); @@ -55,6 +63,10 @@ define( if (this.model) { Validation.unbind(this); + + //If we don't do this the next time the model is used the sync is bound to an old view + this.model.sync = this.model._originalSync; + this.model._originalSync = undefined; } if (originalBeforeClose) { diff --git a/src/UI/Settings/DownloadClient/DownloadClientLayoutTemplate.html b/src/UI/Settings/DownloadClient/DownloadClientLayoutTemplate.html index 89c20761e..7450b08d3 100644 --- a/src/UI/Settings/DownloadClient/DownloadClientLayoutTemplate.html +++ b/src/UI/Settings/DownloadClient/DownloadClientLayoutTemplate.html @@ -1,5 +1,6 @@