From d481000001a5cb7f4bdda6a9cb09e3a068fdb394 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 10 Dec 2012 20:39:35 -0800 Subject: [PATCH] Adding works! --- NzbDrone.Api/NzbDrone.Api.ncrunchproject | 20 ++++++++++++ .../QualityProfiles/QualityProfileService.cs | 4 +-- NzbDrone.Web/Content/QualitySettings.css | 6 ++-- .../FakesAssemblies/Ninject.Web.Mvc.Fakes.dll | Bin 91136 -> 91136 bytes .../Scripts/backbone/views/qualityProfiles.js | 29 ++++++++++++------ NzbDrone.Web/Views/Settings/Quality.cshtml | 8 ++--- 6 files changed, 49 insertions(+), 18 deletions(-) create mode 100644 NzbDrone.Api/NzbDrone.Api.ncrunchproject diff --git a/NzbDrone.Api/NzbDrone.Api.ncrunchproject b/NzbDrone.Api/NzbDrone.Api.ncrunchproject new file mode 100644 index 000000000..575717ac8 --- /dev/null +++ b/NzbDrone.Api/NzbDrone.Api.ncrunchproject @@ -0,0 +1,20 @@ + + false + false + false + true + false + false + false + false + true + true + false + true + true + 60000 + + + + AutoDetect + \ No newline at end of file diff --git a/NzbDrone.Api/QualityProfiles/QualityProfileService.cs b/NzbDrone.Api/QualityProfiles/QualityProfileService.cs index abaeffc7d..370ed7067 100644 --- a/NzbDrone.Api/QualityProfiles/QualityProfileService.cs +++ b/NzbDrone.Api/QualityProfiles/QualityProfileService.cs @@ -40,8 +40,8 @@ public override object OnGet(QualityProfileModel request) public override object OnPost(QualityProfileModel request) { var profile = Mapper.Map(request); - _qualityProvider.Add(profile); - + request.Id = _qualityProvider.Add(profile); + return request; } diff --git a/NzbDrone.Web/Content/QualitySettings.css b/NzbDrone.Web/Content/QualitySettings.css index 1fe456a0a..2117fffd3 100644 --- a/NzbDrone.Web/Content/QualitySettings.css +++ b/NzbDrone.Web/Content/QualitySettings.css @@ -16,13 +16,13 @@ #add-profile { text-decoration: none; - font-size:16px; + font-size: 14px; color: black; - font-weight:bold; + font-weight: bold; vertical-align: middle; } -#add-profile > i { +#add-profile i:before { color: green; font-size: 20px; } diff --git a/NzbDrone.Web/FakesAssemblies/Ninject.Web.Mvc.Fakes.dll b/NzbDrone.Web/FakesAssemblies/Ninject.Web.Mvc.Fakes.dll index ec011fe75217e6dcf2aa719ace42194bada34023..8d7768cb10d6de5ecdf8c1bd4140ffdff54cdf7a 100644 GIT binary patch delta 249 zcmV=pVc*9}&@qL(o}Q5J?7Z$)lCo zfkm*KznskfCB&vl7WIf;AoVVVrRdW@$_^IBpFlcJh$J4|7QsGQ?t_aA=nOd{cgi5A zrX1A~jwi?|*r28BiCnYS)=_}LfP!2QOO0{nO$+Imku(=&UjPQll1fhA>@mo zl_3FTgU|xE&;kKa84&uA5Z3^#21vPwiyM8d&Pyhe`00IC202~1T z04#X{04!Sp08&##Q}&E5VnTX4MUC66TB3HvgO@;C0XUa@TLH|GFa)x9j+==!PlwVy;_pXLP4ozVx z$a{jeO}I4?W7)|K)pA!Uw2n5#VvXcFBdSP$_^#@&uzp={g?_({&XX(UAdi{UhM~MGar9NOIE6nwX zUr+%!gU|xE&;kKa84yue9yk%@Q9++oUEyLc%H6jx90BA$ENfB0Pyhe`00IC202~1T z04#X{04!Sp08&##Q>llck%SCdNWKXB&3`{9VV6K#0XPGAI5wAeTLI0tNL&H92fI~h AxBvhE diff --git a/NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js b/NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js index d4d6bcae5..1c5e4b602 100644 --- a/NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js +++ b/NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js @@ -15,6 +15,7 @@ //Add to cutoff //Update model var target = $(e.target); + var el = $(this.el); var checked = $(target).attr('checked') != undefined; var id = this.model.get("Id"); @@ -25,10 +26,9 @@ if (qualityType.Id == qualityId) { qualityType.Allowed = checked; - - //Todo: Add/Remove from cutoff + //Find cutoff dropdown - var cutoff = ('select#' + id); + var cutoff = $(el).find('.cutoff'); if (checked) { $('').val(qualityId).appendTo(cutoff); @@ -49,7 +49,6 @@ this.model.save(); }, changeCutoff: function(e) { - //Todo: save change var cutoff = $(e.target).val(); this.model.set({ "Cutoff": cutoff }); @@ -58,15 +57,14 @@ changeName: function(e) { var name = $(e.target).val(); - //Todo: update default quality dropdown $('#DefaultQualityProfileId option[value="' + this.model.get("Id") + '"]').html(name); this.model.set({ "Name": name }); this.model.save(); }, destroy: function (e) { - if (e === undefined) - return; + //if (e === undefined) + // return; e.preventDefault(); this.model.destroy(); @@ -97,9 +95,22 @@ QualityProfileCollectionView = Backbone.Marionette.CompositeView.extend({ 'click #add-profile': 'addProfile' }, addProfile: function (e) { + e.preventDefault(); //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(); + var newProfile = new QualityProfile({ + Name: '', Cutoff: 0, Qualities: [ + { "Id": 0, "Weight": 0, "Name": "Unknown", "Allowed": false }, + { "Id": 1, "Weight": 1, "Name": "SDTV", "Allowed": false }, + { "Id": 2, "Weight": 2, "Name": "DVD", "Allowed": false }, + { "Id": 4, "Weight": 4, "Name": "HDTV", "Allowed": false }, + { "Id": 5, "Weight": 5, "Name": "WEBDL-720p", "Allowed": false }, + { "Id": 3, "Weight": 7, "Name": "WEBDL-1080p", "Allowed": false }, + { "Id": 6, "Weight": 6, "Name": "Bluray720p", "Allowed": false }, + { "Id": 7, "Weight": 8, "Name": "Bluray1080p", "Allowed": false } + ] + }); + + this.collection.add(newProfile); } }); \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/Quality.cshtml b/NzbDrone.Web/Views/Settings/Quality.cshtml index 2c72b2d8c..6244e16d5 100644 --- a/NzbDrone.Web/Views/Settings/Quality.cshtml +++ b/NzbDrone.Web/Views/Settings/Quality.cshtml @@ -121,7 +121,7 @@
- <% _.each(Qualities, function(quality) { %> <% if (quality.Allowed === true) { %> @@ -147,12 +147,12 @@