diff --git a/.gitignore b/.gitignore index 26929ed7a..d938c5a70 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ _ReSharper*/ [Ll]ogs/ [Aa]pp_Data/ /[Pp]ackage/ +/FakesAssemblies/ #NZBDrone specific *.db *Web.Publish.xml diff --git a/NzbDrone.Api/QualityProfiles/QualityProfileService.cs b/NzbDrone.Api/QualityProfiles/QualityProfileService.cs index c21f40ad2..abaeffc7d 100644 --- a/NzbDrone.Api/QualityProfiles/QualityProfileService.cs +++ b/NzbDrone.Api/QualityProfiles/QualityProfileService.cs @@ -36,29 +36,29 @@ namespace NzbDrone.Api.QualityProfiles return Mapper.Map(profile); } - public override object OnPost(QualityProfileModel data) + //Create + public override object OnPost(QualityProfileModel request) { - //Create - var profile = Mapper.Map(data); + var profile = Mapper.Map(request); _qualityProvider.Add(profile); - return data; + return request; } - public override object OnPut(QualityProfileModel data) + //Update + public override object OnPut(QualityProfileModel request) { - //Update - var profile = Mapper.Map(data); + var profile = Mapper.Map(request); _qualityProvider.Update(profile); - return data; + return request; } - public override object OnDelete(QualityProfileModel data) + public override object OnDelete(QualityProfileModel request) { - _qualityProvider.Delete(data.Id); + _qualityProvider.Delete(request.Id); - return "ok"; + return request.Id.ToString(); } } } \ No newline at end of file diff --git a/NzbDrone.Web/Content/QualitySettings.css b/NzbDrone.Web/Content/QualitySettings.css index 740fb0081..1fe456a0a 100644 --- a/NzbDrone.Web/Content/QualitySettings.css +++ b/NzbDrone.Web/Content/QualitySettings.css @@ -38,8 +38,7 @@ } /* QualityProfileItem */ -.quality-selectee -{ +.quality-selectee { border-color: #065EFE; border-style: solid; border-width: 1px; @@ -51,73 +50,50 @@ float: left; cursor: default; } -.quality-selecting -{ +.quality-selecting { background: #85AEF9; } -.quality-selected -{ + +.quality-selected { background: #065EFE; color: white; } -.profileSection -{ +.quality-profile { float: left; - width: 265px; + width: 260px; margin: 2px; border:solid 1px #CCCCCD; display: inline-block; overflow: hidden; padding: 5px 5px 5px 5px; + position: relative; } - -.profileOptions label -{ - margin-top: 10px; - margin-left: 7px; - margin-right: 20px; - font-weight: bold; + +.quality-profile-setting label { + width: 45px; display: inline-block; - width: 40px; -} - -.profileOptions input, .profileOptions select -{ - font-size:12px; - padding:4px 2px; - border:solid 1px #aacfe4; - width:170px; - margin-right: 2px; } -.profileOptions input -{ +.quality-profile-setting input { margin-left: 10px; - margin-bottom: 2px; + width: 160px; } -.profileOptions select -{ - width: 176px; - margin-bottom: 7px; +.quality-profile-setting select { + width: 166px; } -.qualitySelector -{ - padding-left: 5px; -} - -.delete-profile { +.remove-profile { position: absolute; top: 0px; - right: 0px; - font-size: 16px; + right: 4px; + font-size: 20px; color: #000000; text-decoration: none; } -.delete-profile > i[class*="icon-"]:hover { +.remove-profile > i[class*="icon-"]:hover { cursor: pointer !important; } diff --git a/NzbDrone.Web/FakesAssemblies/Ninject.Web.Mvc.Fakes.dll b/NzbDrone.Web/FakesAssemblies/Ninject.Web.Mvc.Fakes.dll index 8c7ba3d3a..51fc2b09c 100644 Binary files a/NzbDrone.Web/FakesAssemblies/Ninject.Web.Mvc.Fakes.dll and b/NzbDrone.Web/FakesAssemblies/Ninject.Web.Mvc.Fakes.dll differ diff --git a/NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js b/NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js index a95fa5794..d13a3fe4b 100644 --- a/NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js +++ b/NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js @@ -2,10 +2,14 @@ tagName: "div", className: "quality-profile", template: "#QualityProfileTemplate", + initialize: function() { + this.model.on('destroy', this.remove, this) + }, events: { 'click .quality-selectee': 'toggleAllowed', 'change .cutoff': 'changeCutoff', - 'change .name': 'changeName' + 'change .name': 'changeName', + 'click .remove-profile': 'destroy' }, toggleAllowed: function (e) { //Add to cutoff @@ -54,6 +58,17 @@ this.model.set({ "Name": name }); this.model.save(); + }, + destroy: function (e) { + if (e === undefined) + return; + + e.preventDefault(); + this.model.destroy(); + e.stopPropagation(); + }, + remove: function (e) { + $(this.el).remove(); } }); @@ -78,6 +93,7 @@ QualityProfileCollectionView = Backbone.Marionette.CompositeView.extend({ }, addProfile: function (e) { //Add new profile to collection + //Todo: How will we get the list of qualities (they would all be NOT allowed) - it all comes from the server side... this.collection.add(new QualityProfile()); e.preventDefault(); } diff --git a/NzbDrone.Web/Views/Settings/Quality.cshtml b/NzbDrone.Web/Views/Settings/Quality.cshtml index 0bb6df07f..2c72b2d8c 100644 --- a/NzbDrone.Web/Views/Settings/Quality.cshtml +++ b/NzbDrone.Web/Views/Settings/Quality.cshtml @@ -114,12 +114,13 @@ @*@Html.IncludeScript("backbone/bootstrapper.js")*@