diff --git a/NzbDrone.Web/Content/Grid.css b/NzbDrone.Web/Content/Grid.css index 0af7c6b89..b2d30e44e 100644 --- a/NzbDrone.Web/Content/Grid.css +++ b/NzbDrone.Web/Content/Grid.css @@ -1,8 +1,6 @@ .gridImage, .gridAction, .grid-icon { width: 17px; - /*height: 18px; - margin: 0px;*/ padding: 3px 1px; vertical-align: middle; border: none; diff --git a/NzbDrone.Web/Content/QualitySettings.css b/NzbDrone.Web/Content/QualitySettings.css index 4d11d82d1..6220c1381 100644 --- a/NzbDrone.Web/Content/QualitySettings.css +++ b/NzbDrone.Web/Content/QualitySettings.css @@ -14,6 +14,12 @@ font-size:16px; color: black; font-weight:bold; + vertical-align: middle; +} + +#addProfile > i { + color: green; + font-size: 20px; } #profileHeader @@ -97,11 +103,17 @@ padding-left: 5px; } -.deleteProfile -{ +.delete-profile { position: absolute; top: 0px; right: 0px; + font-size: 16px; + color: #000000; + text-decoration: none; +} + +.delete-profile > i[class*="icon-"]:hover { + cursor: pointer !important; } .titleText diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index d5242f877..79ba45cc7 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -288,6 +288,7 @@ namespace NzbDrone.Web.Controllers return PartialView("QualityProfileItem", model); } + [HttpPost] [JsonErrorFilter] public JsonResult DeleteQualityProfile(int profileId) { @@ -296,7 +297,7 @@ namespace NzbDrone.Web.Controllers _qualityProvider.Delete(profileId); - return new JsonResult(); + return Json("ok"); } public PartialViewResult AddNewznabProvider() diff --git a/NzbDrone.Web/Scripts/NzbDrone/qualitySettings.js b/NzbDrone.Web/Scripts/NzbDrone/qualitySettings.js index 03618b3c1..c222a2e4a 100644 --- a/NzbDrone.Web/Scripts/NzbDrone/qualitySettings.js +++ b/NzbDrone.Web/Scripts/NzbDrone/qualitySettings.js @@ -12,11 +12,22 @@ $(document).on("click", "#addProfile", function (event) { event.preventDefault(); }); -function deleteProfile(id) { - sendToServer(id); - var profileDiv = '#profile_' + id; - $(profileDiv).remove(); -} +$(document).on('click', '.delete-profile', function (e) { + var container = $(this).closest('.profileSection'); + var id = $(container).attr('data-profile-id'); + + $.ajax({ + type: "POST", + url: deleteQualityProfileUrl, + data: jQuery.param({ profileId: id }), + success: function (data, textStatus, jqXHR) { + $(container).remove(); + removeOption(id); + } + }); + + e.preventDefault(); +}); function renameOption(text, value) { $("#DefaultQualityProfileId option[value='" + value + "']").html(text); @@ -35,23 +46,9 @@ function removeOption(value) { $("#DefaultQualityProfileId option[value='" + value + "']").remove(); } -function sendToServer(id) { - $.ajax({ - type: "POST", - url: deleteQualityProfileUrl, - data: jQuery.param({ profileId: id }), - success: function (data, textStatus, jqXHR) { - if (data == "ok") { - $("#profile_" + id).remove(); - removeOption(id); - } - } - }); -} - function getProfileId(obj) { - var parentProfileSection = $(obj).parents('.profileSection'); - return parentProfileSection.children('.qualityProfileId').val(); + var parentProfileSection = $(obj).closest('.profileSection'); + return parentProfileSection.attr('data-profile-id'); } function getCleanId(obj) { @@ -61,8 +58,10 @@ function getCleanId(obj) { $(document).on('keyup', '.profileName_textbox', function () { var value = $(this).val(); + + $(this).closest('.profileSection').find('.titleText').text(value); var profileId = getProfileId(this); - $("#title_" + profileId).text(value); + renameOption(value, profileId); }).keyup(); diff --git a/NzbDrone.Web/Views/Settings/Quality.cshtml b/NzbDrone.Web/Views/Settings/Quality.cshtml index 86b3d4d9f..cb61cc982 100644 --- a/NzbDrone.Web/Views/Settings/Quality.cshtml +++ b/NzbDrone.Web/Views/Settings/Quality.cshtml @@ -18,8 +18,9 @@
- Add New Profile - Add New Profile + + Add New Profile +
@foreach (var item in (List)ViewData["Profiles"]) diff --git a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml index 21b439a86..c857da0dc 100644 --- a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml +++ b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml @@ -7,12 +7,14 @@ { var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); -
+
- + @Model.Name - - Delete + + + +
@Html.LabelFor(x => x.Name)