From ffbb3d9a443f31d97af3ea477e93fc5c2f62483f Mon Sep 17 00:00:00 2001 From: tidusjar Date: Mon, 18 Apr 2016 18:46:09 +0100 Subject: [PATCH] Fixed #162 --- PlexRequests.UI/Views/Admin/Sonarr.cshtml | 54 +++++++++++++---------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/PlexRequests.UI/Views/Admin/Sonarr.cshtml b/PlexRequests.UI/Views/Admin/Sonarr.cshtml index 6ca64285d..fd50071f5 100644 --- a/PlexRequests.UI/Views/Admin/Sonarr.cshtml +++ b/PlexRequests.UI/Views/Admin/Sonarr.cshtml @@ -130,34 +130,40 @@ @if (!string.IsNullOrEmpty(Model.QualityProfile)) { + - var qualitySelected = @Model.QualityProfile; - if (!qualitySelected) { - return; - } - var $form = $("#mainForm"); - $.ajax({ - type: $form.prop("method"), - data: $form.serialize(), - url: "sonarrprofiles", - dataType: "json", - success: function(response) { - response.forEach(function(result) { - if (result.id == qualitySelected) { - $("#select").append(""); - } else { - $("#select").append(""); - } - }); - }, - error: function(e) { - console.log(e); - generateNotify("Something went wrong!", "danger"); + preLoad(); + + function preLoad() { + var qualitySelected = @Model.QualityProfile; + if (!qualitySelected) { + return; } - }); + var $form = $("#mainForm"); + $.ajax({ + type: $form.prop("method"), + data: $form.serialize(), + url: "sonarrprofiles", + dataType: "json", + success: function(response) { + response.forEach(function(result) { + if (result.id == qualitySelected) { + + $("#select").append(""); + } else { + $("#select").append(""); + } + }); + }, + error: function(e) { + console.log(e); + generateNotify("Something went wrong!", "danger"); + } + }); + } - } + } $('#save').click(function(e) {