From 24b2cd0a9ce465cb70dc84168ce8a5d375f51503 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 11 Mar 2016 16:06:52 +0000 Subject: [PATCH] Styling, Added the functionality for the Sonarr Profiles on the Admin page #2 resolved. --- PlexRequests.Api.Interfaces/ISonarrApi.cs | 38 + .../PlexRequests.Api.Interfaces.csproj | 1 + PlexRequests.Api/MockApiData.Designer.cs | 102 + PlexRequests.Api/MockApiData.resx | 444 ++ PlexRequests.Api/Mocks/MockSonarrApi.cs | 46 + PlexRequests.Api/PlexRequests.Api.csproj | 13 +- PlexRequests.Api/SonarrApi.cs | 3 +- PlexRequests.Helpers/UriHelper.cs | 14 +- PlexRequests.UI/Bootstrapper.cs | 4 + PlexRequests.UI/Content/custom.css | 171 +- PlexRequests.UI/Content/custom.min.css | 1 + PlexRequests.UI/Content/custom.scss | 159 + PlexRequests.UI/Content/handlebars.js | 4648 ----------------- PlexRequests.UI/Content/handlebars.min.js | 45 + PlexRequests.UI/Content/requests.js | 2 +- PlexRequests.UI/Content/search.js | 4 +- PlexRequests.UI/Modules/AdminModule.cs | 15 +- PlexRequests.UI/PlexRequests.UI.csproj | 17 +- PlexRequests.UI/Program.cs | 3 +- .../Views/Admin/Authentication.cshtml | 6 +- .../Views/Admin/CouchPotato.cshtml | 2 +- PlexRequests.UI/Views/Admin/Plex.cshtml | 2 +- PlexRequests.UI/Views/Admin/Settings.cshtml | 2 +- PlexRequests.UI/Views/Admin/Sonarr.cshtml | 103 +- PlexRequests.UI/Views/Login/Index.cshtml | 2 +- PlexRequests.UI/Views/Login/Register.cshtml | 2 +- PlexRequests.UI/Views/Requests/Index.cshtml | 32 +- PlexRequests.UI/Views/Search/Index.cshtml | 4 +- PlexRequests.UI/Views/Shared/_Layout.cshtml | 4 +- PlexRequests.UI/Views/UserLogin/Index.cshtml | 2 +- PlexRequests.UI/compilerconfig.json | 6 + PlexRequests.UI/compilerconfig.json.defaults | 49 + PlexRequests.sln | 1 + 33 files changed, 1180 insertions(+), 4767 deletions(-) create mode 100644 PlexRequests.Api.Interfaces/ISonarrApi.cs create mode 100644 PlexRequests.Api/MockApiData.Designer.cs create mode 100644 PlexRequests.Api/MockApiData.resx create mode 100644 PlexRequests.Api/Mocks/MockSonarrApi.cs create mode 100644 PlexRequests.UI/Content/custom.min.css create mode 100644 PlexRequests.UI/Content/custom.scss delete mode 100644 PlexRequests.UI/Content/handlebars.js create mode 100644 PlexRequests.UI/Content/handlebars.min.js create mode 100644 PlexRequests.UI/compilerconfig.json create mode 100644 PlexRequests.UI/compilerconfig.json.defaults diff --git a/PlexRequests.Api.Interfaces/ISonarrApi.cs b/PlexRequests.Api.Interfaces/ISonarrApi.cs new file mode 100644 index 000000000..d9d49d10e --- /dev/null +++ b/PlexRequests.Api.Interfaces/ISonarrApi.cs @@ -0,0 +1,38 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: ISonarrApi.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion +using System; +using System.Collections.Generic; + +using PlexRequests.Api.Models.Sonarr; + +namespace PlexRequests.Api.Interfaces +{ + public interface ISonarrApi + { + List GetProfiles(string apiKey, Uri baseUrl); + } +} \ No newline at end of file diff --git a/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj b/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj index 45ff3157f..42a2cfe0c 100644 --- a/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj +++ b/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj @@ -48,6 +48,7 @@ + diff --git a/PlexRequests.Api/MockApiData.Designer.cs b/PlexRequests.Api/MockApiData.Designer.cs new file mode 100644 index 000000000..590b1af35 --- /dev/null +++ b/PlexRequests.Api/MockApiData.Designer.cs @@ -0,0 +1,102 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace PlexRequests.Api { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MockApiData { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MockApiData() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PlexRequests.Api.MockApiData", typeof(MockApiData).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to [ + /// { + /// "name": "SD", + /// "cutoff": { + /// "id": 1, + /// "name": "SDTV" + /// }, + /// "items": [ + /// { + /// "quality": { + /// "id": 1, + /// "name": "SDTV" + /// }, + /// "allowed": true + /// }, + /// { + /// "quality": { + /// "id": 8, + /// "name": "WEBDL-480p" + /// }, + /// "allowed": true + /// }, + /// { + /// "quality": { + /// "id": 2, + /// "name": "DVD" + /// }, + /// "allowed": true + /// }, + /// { + /// "quality": { [rest of string was truncated]";. + /// + internal static string Sonarr_Profiles { + get { + return ResourceManager.GetString("Sonarr_Profiles", resourceCulture); + } + } + } +} diff --git a/PlexRequests.Api/MockApiData.resx b/PlexRequests.Api/MockApiData.resx new file mode 100644 index 000000000..2380d9a92 --- /dev/null +++ b/PlexRequests.Api/MockApiData.resx @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + [ + { + "name": "SD", + "cutoff": { + "id": 1, + "name": "SDTV" + }, + "items": [ + { + "quality": { + "id": 1, + "name": "SDTV" + }, + "allowed": true + }, + { + "quality": { + "id": 8, + "name": "WEBDL-480p" + }, + "allowed": true + }, + { + "quality": { + "id": 2, + "name": "DVD" + }, + "allowed": true + }, + { + "quality": { + "id": 4, + "name": "HDTV-720p" + }, + "allowed": false + }, + { + "quality": { + "id": 9, + "name": "HDTV-1080p" + }, + "allowed": false + }, + { + "quality": { + "id": 10, + "name": "Raw-HD" + }, + "allowed": false + }, + { + "quality": { + "id": 5, + "name": "WEBDL-720p" + }, + "allowed": false + }, + { + "quality": { + "id": 6, + "name": "Bluray-720p" + }, + "allowed": false + }, + { + "quality": { + "id": 3, + "name": "WEBDL-1080p" + }, + "allowed": false + }, + { + "quality": { + "id": 7, + "name": "Bluray-1080p" + }, + "allowed": false + } + ], + "id": 1 + }, + { + "name": "HD 720p", + "cutoff": { + "id": 4, + "name": "HDTV-720p" + }, + "items": [ + { + "quality": { + "id": 1, + "name": "SDTV" + }, + "allowed": false + }, + { + "quality": { + "id": 8, + "name": "WEBDL-480p" + }, + "allowed": false + }, + { + "quality": { + "id": 2, + "name": "DVD" + }, + "allowed": false + }, + { + "quality": { + "id": 4, + "name": "HDTV-720p" + }, + "allowed": true + }, + { + "quality": { + "id": 9, + "name": "HDTV-1080p" + }, + "allowed": false + }, + { + "quality": { + "id": 10, + "name": "Raw-HD" + }, + "allowed": false + }, + { + "quality": { + "id": 5, + "name": "WEBDL-720p" + }, + "allowed": true + }, + { + "quality": { + "id": 6, + "name": "Bluray-720p" + }, + "allowed": true + }, + { + "quality": { + "id": 3, + "name": "WEBDL-1080p" + }, + "allowed": false + }, + { + "quality": { + "id": 7, + "name": "Bluray-1080p" + }, + "allowed": false + } + ], + "id": 2 + }, + { + "name": "HD 1080p", + "cutoff": { + "id": 9, + "name": "HDTV-1080p" + }, + "items": [ + { + "quality": { + "id": 1, + "name": "SDTV" + }, + "allowed": false + }, + { + "quality": { + "id": 8, + "name": "WEBDL-480p" + }, + "allowed": false + }, + { + "quality": { + "id": 2, + "name": "DVD" + }, + "allowed": false + }, + { + "quality": { + "id": 4, + "name": "HDTV-720p" + }, + "allowed": false + }, + { + "quality": { + "id": 9, + "name": "HDTV-1080p" + }, + "allowed": true + }, + { + "quality": { + "id": 10, + "name": "Raw-HD" + }, + "allowed": false + }, + { + "quality": { + "id": 5, + "name": "WEBDL-720p" + }, + "allowed": false + }, + { + "quality": { + "id": 6, + "name": "Bluray-720p" + }, + "allowed": false + }, + { + "quality": { + "id": 3, + "name": "WEBDL-1080p" + }, + "allowed": true + }, + { + "quality": { + "id": 7, + "name": "Bluray-1080p" + }, + "allowed": true + } + ], + "id": 3 + }, + { + "name": "HD - All", + "cutoff": { + "id": 4, + "name": "HDTV-720p" + }, + "items": [ + { + "quality": { + "id": 1, + "name": "SDTV" + }, + "allowed": false + }, + { + "quality": { + "id": 8, + "name": "WEBDL-480p" + }, + "allowed": false + }, + { + "quality": { + "id": 2, + "name": "DVD" + }, + "allowed": false + }, + { + "quality": { + "id": 4, + "name": "HDTV-720p" + }, + "allowed": true + }, + { + "quality": { + "id": 9, + "name": "HDTV-1080p" + }, + "allowed": true + }, + { + "quality": { + "id": 10, + "name": "Raw-HD" + }, + "allowed": false + }, + { + "quality": { + "id": 5, + "name": "WEBDL-720p" + }, + "allowed": true + }, + { + "quality": { + "id": 6, + "name": "Bluray-720p" + }, + "allowed": true + }, + { + "quality": { + "id": 3, + "name": "WEBDL-1080p" + }, + "allowed": true + }, + { + "quality": { + "id": 7, + "name": "Bluray-1080p" + }, + "allowed": true + } + ], + "id": 4 + } +] + + \ No newline at end of file diff --git a/PlexRequests.Api/Mocks/MockSonarrApi.cs b/PlexRequests.Api/Mocks/MockSonarrApi.cs new file mode 100644 index 000000000..9d565080c --- /dev/null +++ b/PlexRequests.Api/Mocks/MockSonarrApi.cs @@ -0,0 +1,46 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: MockSonarrApi.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion +using System; +using System.Collections.Generic; + +using Newtonsoft.Json; + +using PlexRequests.Api.Interfaces; +using PlexRequests.Api.Models.Sonarr; + +namespace PlexRequests.Api.Mocks +{ + public class MockSonarrApi : ISonarrApi + { + public List GetProfiles(string apiKey, Uri baseUrl) + { + var json = MockApiData.Sonarr_Profiles; + var obj = JsonConvert.DeserializeObject>(json); + return obj; + } + } +} \ No newline at end of file diff --git a/PlexRequests.Api/PlexRequests.Api.csproj b/PlexRequests.Api/PlexRequests.Api.csproj index fa917a6de..44f5a10ad 100644 --- a/PlexRequests.Api/PlexRequests.Api.csproj +++ b/PlexRequests.Api/PlexRequests.Api.csproj @@ -66,6 +66,12 @@ + + True + True + MockApiData.resx + + @@ -93,7 +99,12 @@ PlexRequests.Helpers - + + + ResXFileCodeGenerator + MockApiData.Designer.cs + + - + - + diff --git a/PlexRequests.UI/Views/UserLogin/Index.cshtml b/PlexRequests.UI/Views/UserLogin/Index.cshtml index 54d3ce57a..414083139 100644 --- a/PlexRequests.UI/Views/UserLogin/Index.cshtml +++ b/PlexRequests.UI/Views/UserLogin/Index.cshtml @@ -28,7 +28,7 @@ }
- + diff --git a/PlexRequests.UI/compilerconfig.json b/PlexRequests.UI/compilerconfig.json new file mode 100644 index 000000000..347a6059b --- /dev/null +++ b/PlexRequests.UI/compilerconfig.json @@ -0,0 +1,6 @@ +[ + { + "outputFile": "Content/custom.css", + "inputFile": "Content/custom.scss" + } +] \ No newline at end of file diff --git a/PlexRequests.UI/compilerconfig.json.defaults b/PlexRequests.UI/compilerconfig.json.defaults new file mode 100644 index 000000000..1f91b752f --- /dev/null +++ b/PlexRequests.UI/compilerconfig.json.defaults @@ -0,0 +1,49 @@ +{ + "compilers": { + "less": { + "autoPrefix": "", + "cssComb": "none", + "ieCompat": true, + "strictMath": false, + "strictUnits": false, + "relativeUrls": true, + "rootPath": "", + "sourceMapRoot": "", + "sourceMapBasePath": "", + "sourceMap": false + }, + "sass": { + "includePath": "", + "indentType": "space", + "indentWidth": 2, + "outputStyle": "nested", + "Precision": 5, + "relativeUrls": true, + "sourceMapRoot": "", + "sourceMap": false + }, + "stylus": { + "sourceMap": false + }, + "babel": { + "sourceMap": false + }, + "coffeescript": { + "bare": false, + "runtimeMode": "node", + "sourceMap": false + } + }, + "minifiers": { + "css": { + "enabled": true, + "termSemicolons": true, + "gzip": false + }, + "javascript": { + "enabled": true, + "termSemicolons": true, + "gzip": false + } + } +} \ No newline at end of file diff --git a/PlexRequests.sln b/PlexRequests.sln index 8bd25df43..e735cd6c7 100644 --- a/PlexRequests.sln +++ b/PlexRequests.sln @@ -19,6 +19,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution appveyor.yml = appveyor.yml LICENSE = LICENSE README.md = README.md + WE-Palette.css = WE-Palette.css EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Helpers", "PlexRequests.Helpers\PlexRequests.Helpers.csproj", "{1252336D-42A3-482A-804C-836E60173DFA}"