From 764f67f8e88834ebcce15896826c9cd2891373ef Mon Sep 17 00:00:00 2001 From: markus101 Date: Thu, 3 Feb 2011 10:28:14 -0800 Subject: [PATCH] JquerySimpleDropdown menu added, not sure of full usage yet. Fixed SettingsController for Quality Config. --- NzbDrone.Web/Content/Images/arrow.png | Bin 0 -> 1041 bytes NzbDrone.Web/Content/ie.css | 12 +++++ .../Content/jquery-simpledropdown.css | 34 +++++++++++++++ .../Controllers/Copy of SettingsController.cs | 41 ------------------ .../Controllers/SettingsController.cs | 2 +- NzbDrone.Web/Models/SettingsModels.cs | 5 --- NzbDrone.Web/NzbDrone.Web.csproj | 5 ++- NzbDrone.Web/Scripts/jquery.simpledropdown.js | 32 ++++++++++++++ NzbDrone.Web/Views/Settings/Index.aspx | 4 +- NzbDrone.Web/Views/Settings/Quality.ascx | 31 +++++++++++++ NzbDrone.Web/Views/Shared/Site.Master | 4 +- 11 files changed, 119 insertions(+), 51 deletions(-) create mode 100644 NzbDrone.Web/Content/Images/arrow.png create mode 100644 NzbDrone.Web/Content/ie.css create mode 100644 NzbDrone.Web/Content/jquery-simpledropdown.css delete mode 100644 NzbDrone.Web/Controllers/Copy of SettingsController.cs create mode 100644 NzbDrone.Web/Scripts/jquery.simpledropdown.js diff --git a/NzbDrone.Web/Content/Images/arrow.png b/NzbDrone.Web/Content/Images/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..7e687e6aed3818ef4a81fbfc824755cf2c32a3db GIT binary patch literal 1041 zcmaJ=&rcIU6y72Rg>aGJuZxq##Dli`qm;5s3thUcZL|$3O{h1vyF@nGF#vhyb2_r34Ed9yi}y*)g5 zb&#T{;dDyQk^g|V&h=50FA_ewK!PhcQNZ(P30D*wQj&&>5Tp&I1anZ)s`vL{grd#> zJzv0u%w17MMnLf}0oSkyo1!8!uBE8U5Q8Et>1LEZe7!>hU5nBSp$wa`;;^izYBrp& zW%FunSrs&TW*S6Xkq8(NE5J2YOh&{1vO!a6d6r>GRsDvr{`=}8HO)s;1!cAH4U z7+0|vF2H&vb%2@7|DlG_MLReLPyPN=*vVHd$mF1dR&AAB+|rnr$`a!?R4}sh2(5Iw zI9Em(Ib~#l_z)NycVmVGuP9}qV zf=>vNByr;cH__qBNL@9ci91~Flsns#>kWcok<2o*^#@Q(+Qg|aW9{LzqfZ5ti|fh#+&{9OlqG9~{(pYb%7QY?50_R6ZpNG+>*v5~qA9tyN?d|PHzmEm? e2uw{)JsqMh4%~?iZ{57)J<@a{E5Dpwtp5QR&QP%c literal 0 HcmV?d00001 diff --git a/NzbDrone.Web/Content/ie.css b/NzbDrone.Web/Content/ie.css new file mode 100644 index 000000000..eb4b13d1d --- /dev/null +++ b/NzbDrone.Web/Content/ie.css @@ -0,0 +1,12 @@ +/* +Name: jQuery Simple Drop Down Plugin Stylesheet +Author: Etienne Fardet +Version: 1.2 +-- Fixes for IE -- +*/ + +¨* {zoom:1;} + +.drop ul, .drop ul li {width:134px;} +.drop ul li a, .drop ul li a:hover {padding:8px;} +.drop ul li a:hover {background-color:#06f;} diff --git a/NzbDrone.Web/Content/jquery-simpledropdown.css b/NzbDrone.Web/Content/jquery-simpledropdown.css new file mode 100644 index 000000000..a55d488a8 --- /dev/null +++ b/NzbDrone.Web/Content/jquery-simpledropdown.css @@ -0,0 +1,34 @@ +/* +Name: jQuery Simple Drop Down Plugin Stylesheet +Author: Etienne Fardet +Version: 1.2 +*/ + +/* Demo common styles - Not needed to make the plugin work */ +/* +body {font-family:Verdana, Geneva, sans-serif; font-size:14px;width:40%;margin:0 auto;} +a {text-decoration:none;color:#039;} +h3 {clear:both;color: #039;} +pre {border:1px solid black; padding:8px;width:700px; margin:20px;} +strong {color: #093;} +.requirements {list-style:square;} +.author {color: #003;font-size: 12px;font-weight: bold;font-style: italic;} +*/ + +/* Demo divs - Lists need to be placed in a div with an assigned ID that will be called within the page as a parameter for the main plugin function */ +/* +#dropdown1 {position:relative;z-index:2;} +#dropdown2 {position:relative;z-index:1;} +#dropdown3 {position:relative;z-index:0;margin-left:170px;} +*/ + +/* Necessary Styles to make the demo work - Change background colors and colors to match your needs */ +.dropdown {background:url(./images/arrow.png) no-repeat 10px 8px #D9D6D5;color:#D9D6D5;-khtml-border-radius:8px;border-radius:8px;-moz-border-radius:8px;-webkit-border-radius:8px;cursor:pointer;margin:0;padding:0;position:absolute;} +.dropdown a {text-decoration:none; color:#000;} +.dropdown {list-style-type:none;margin:0;padding:0;width:120;margin:0 auto;} +.drop ul {list-style-type:none;margin:0;padding:0;} +.drop ul li:first-child {border-top:1px solid #D9D6D5;} +.drop ul li {display:none; -moz-border-radius:0;-webkit-border-radius:0;background-color:#D9D6D5;padding:0px; padding-left:4px; padding-right:4px} +.drop ul li:last-child {display:none;-khtml-border-radius:0 0 8px 8px;border-radius:0 0 8px 8px;-moz-border-radius:0 0 8px 8px;-webkit-border-radius:0 0 8px 8px;} +.selected {padding:4px;color:#000;} +.drop ul li:hover {background-color:#06f;} diff --git a/NzbDrone.Web/Controllers/Copy of SettingsController.cs b/NzbDrone.Web/Controllers/Copy of SettingsController.cs deleted file mode 100644 index 8f8f229ba..000000000 --- a/NzbDrone.Web/Controllers/Copy of SettingsController.cs +++ /dev/null @@ -1,41 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Threading; -//using System.Web; -//using System.Web.Mvc; -//using NzbDrone.Core.Providers; -//using NzbDrone.Web.Models; - -//namespace NzbDrone.Web.Controllers -//{ -// [HandleError] -// public class SettingsController : Controller -// { -// // -// // GET: /Settings/ -// private IConfigProvider _configProvider; - -// public SettingsController(IConfigProvider configProvider) -// { -// _configProvider = configProvider; -// } - -// public ActionResult Index() -// { -// return View(new SettingsModel() { TvFolder = _configProvider.SeriesRoot }); -// } - -// [HttpPost] -// public ActionResult Index(SettingsModel model) -// { -// if (ModelState.IsValid) -// { -// _configProvider.SeriesRoot = model.TvFolder; -// //return RedirectToAction("index"); -// } -// return RedirectToAction("index", "series"); -// } - -// } -//} diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index ea71dfa07..74c51e943 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -95,7 +95,7 @@ namespace NzbDrone.Web.Controllers public ActionResult Quality() { - ViewData["viewName"] = "Downloads"; + ViewData["viewName"] = "Quality"; var userProfiles = _qualityProvider.GetProfiles().Where(q => q.UserProfile).ToList(); var profiles = _qualityProvider.GetProfiles().Where(q => q.UserProfile == false).ToList(); diff --git a/NzbDrone.Web/Models/SettingsModels.cs b/NzbDrone.Web/Models/SettingsModels.cs index e9ea8389e..381ff0e3f 100644 --- a/NzbDrone.Web/Models/SettingsModels.cs +++ b/NzbDrone.Web/Models/SettingsModels.cs @@ -2,11 +2,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Globalization; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using System.Web.Security; using NzbDrone.Core.Model; using NzbDrone.Core.Repository; diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index fe4bc2d85..c4264af8d 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -73,7 +73,6 @@ - @@ -103,6 +102,8 @@ + + @@ -144,6 +145,7 @@ + @@ -253,6 +255,7 @@ + diff --git a/NzbDrone.Web/Scripts/jquery.simpledropdown.js b/NzbDrone.Web/Scripts/jquery.simpledropdown.js new file mode 100644 index 000000000..29e6963cc --- /dev/null +++ b/NzbDrone.Web/Scripts/jquery.simpledropdown.js @@ -0,0 +1,32 @@ +/* +Name: jQuery Simple Drop Down Plugin +Author: Etienne Fardet +Version: 1.2 +*/ + +(function($){ + $.simpledropdown = function(selector) { + + $(selector).children("ul").addClass("dropdown"); + $("ul.dropdown>li:first-child").addClass("selected"); + $("ul.dropdown>li").not(".dropdown>li:first-child").addClass("drop"); + + $("ul.dropdown").click(function() { + var subitems = $(this).find(".drop ul li"); + var selecteditem = $(this).find(".selected"); + subitems.slideToggle("fast", function() { + + subitems.click(function() { + var selection = $(this).text(); + selecteditem.text(selection).fadeOut(5, function() { + if (jQuery.browser.msie) { + $(this).fadeIn(100); + } else { + $(this).fadeIn(400); + } + }); + }); + }); + }); + }; +})(jQuery); diff --git a/NzbDrone.Web/Views/Settings/Index.aspx b/NzbDrone.Web/Views/Settings/Index.aspx index 0757c5618..7edad835d 100644 --- a/NzbDrone.Web/Views/Settings/Index.aspx +++ b/NzbDrone.Web/Views/Settings/Index.aspx @@ -1,4 +1,4 @@ -<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> +<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> Settings @@ -11,5 +11,5 @@ - <% Html.RenderPartial(ViewData["viewName"].ToString(), Model); %> + <% Html.RenderPartial(ViewData["viewName"].ToString()); %> diff --git a/NzbDrone.Web/Views/Settings/Quality.ascx b/NzbDrone.Web/Views/Settings/Quality.ascx index 6957dd439..a9d61eda6 100644 --- a/NzbDrone.Web/Views/Settings/Quality.ascx +++ b/NzbDrone.Web/Views/Settings/Quality.ascx @@ -11,6 +11,8 @@ resetForm: false }; $('#form').ajaxForm(options); + $.simpledropdown("#dropdown1"); + }); function saveOrder(jqForm, options) { @@ -57,5 +59,34 @@ }); + <% using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new { id = "form", name = "form" })) + {%> +<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %> + + +
+
+
+
+
+
+
+
+ + + <%}%>
\ No newline at end of file diff --git a/NzbDrone.Web/Views/Shared/Site.Master b/NzbDrone.Web/Views/Shared/Site.Master index a7be22481..8bef89d9d 100644 --- a/NzbDrone.Web/Views/Shared/Site.Master +++ b/NzbDrone.Web/Views/Shared/Site.Master @@ -17,6 +17,7 @@ + @@ -55,7 +56,8 @@ .Add("jquery.form.js") .Add("jquery.jgrowl.js") .Add("Notification.js") - .Add("jquery-tgc-countdown-1.0.js")) + .Add("jquery-tgc-countdown-1.0.js") + .Add("jquery.simpledropdown.js")) .Render(); %>