Deleting of Qualities now works.

Quality Settings UI looks better, colors, sizing
Test files for testing different webUI features
pull/6/head
markus101 14 years ago
parent 2ba6057ec7
commit 4b4499b4a2

@ -300,8 +300,17 @@ namespace NzbDrone.Web.Controllers
{ {
_configProvider.SetValue("DefaultQualityProfile", data.DefaultProfileId.ToString()); _configProvider.SetValue("DefaultQualityProfile", data.DefaultProfileId.ToString());
foreach (var dbProfile in _qualityProvider.GetAllProfiles().Where(q => q.UserProfile))
{
if (!data.UserProfiles.Exists(p => p.ProfileId == dbProfile.ProfileId))
_qualityProvider.Delete(dbProfile.ProfileId);
}
foreach (var profile in data.UserProfiles) foreach (var profile in data.UserProfiles)
{ {
Logger.Debug(String.Format("Updating User Profile: {0}", profile));
profile.Allowed = new List<QualityTypes>(); profile.Allowed = new List<QualityTypes>();
foreach (var quality in profile.AllowedString.Split(',')) foreach (var quality in profile.AllowedString.Split(','))
{ {
@ -311,7 +320,8 @@ namespace NzbDrone.Web.Controllers
//If the Cutoff value selected is not in the allowed list then use the last allowed value, this should be validated on submit //If the Cutoff value selected is not in the allowed list then use the last allowed value, this should be validated on submit
if (!profile.Allowed.Contains(profile.Cutoff)) if (!profile.Allowed.Contains(profile.Cutoff))
profile.Cutoff = profile.Allowed.Last(); throw new InvalidOperationException("Invalid Cutoff Value");
//profile.Cutoff = profile.Allowed.Last();
if (profile.ProfileId > 0) if (profile.ProfileId > 0)
_qualityProvider.Update(profile); _qualityProvider.Update(profile);
@ -319,7 +329,6 @@ namespace NzbDrone.Web.Controllers
else else
_qualityProvider.Add(profile); _qualityProvider.Add(profile);
} }
} }
catch (Exception e) catch (Exception e)

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace NzbDrone.Web.Models
{
public class TestModel
{
public int Number { get; set; }
}
}

@ -0,0 +1,31 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NzbDrone.Web.Models.TestModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Test
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Test</h2>
<% using (Html.BeginForm("Test", "Home", FormMethod.Post, new { id = "form", name = "form" }))
{%>
<div>One: <%=Html.RadioButtonFor(t => t.Number, 1)%></div>
<div>Two: <%=Html.RadioButtonFor(t => t.Number, 2)%></div>
<div>Three: <%=Html.RadioButtonFor(t => t.Number, 3)%></div>
<div>Four: <%=Html.RadioButtonFor(t => t.Number, 4)%></div>
<input type="submit" class="button" value="Save" />
<% } %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="headerContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ActionMenu" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Scripts" runat="server">
</asp:Content>

@ -5,9 +5,15 @@
<% using (Html.BeginCollectionItem("UserProfiles")) <% using (Html.BeginCollectionItem("UserProfiles"))
{ %> { %>
<style type="text/css"> <style type="text/css">
#sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 143px;} #sortable1, #sortable2 { list-style-type: none; float: left; margin-right: 10px; background: #eee; padding-left: 5px; padding-right: 5px; width: 107px; }
.allowedQualities, .otherQualities { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 148px;} .allowedQualities, .otherQualities { list-style-type: none; float: left; margin-right: 10px; background: #eee; padding-left: 5px; padding-right: 5px; padding-top:6px; width: 112px; -khtml-border-radius:8px;border-radius:8px;-moz-border-radius:8px;-webkit-border-radius:8px; }
#sortable1 li, #sortable2 li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; } #sortable1 li, #sortable2 li { margin: 5px; margin-left: 0px; padding: 0px; font-size: 1.2em; width: 100px; -khtml-border-radius:8px;border-radius:8px;-moz-border-radius:8px;-webkit-border-radius:8px; }
#sortable1 li { background: #ddd; }
#sortable2 li { background: #DAA2A2; }
.sortableHeader { margin:2px; margin-left:12px }
#sortable1 li.ui-state-highlight, #sortable2 li.ui-state-highlight { background: #fbf5d0; }
.removeDiv { float: left; display:block; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
@ -34,21 +40,20 @@
<div class="userProfileSectionEditor"> <div class="userProfileSectionEditor">
<fieldset> <fieldset style="width:275px; margin:5px;">
<%--<label><%= Model.Name %></label>--%> <%--<label><%= Model.Name %></label>--%>
<%= Html.TextBoxFor(m => m.AllowedString, new { @id = "allowedString", @style = "display:none" })%> <%= Html.TextBoxFor(m => m.AllowedString, new { @id = "allowedString", @style = "display:none" })%>
<%--<%= Html.TextBoxFor(m => m.AllowedString, new { @id = "allowedString" })%>--%>
<%--<%= Html.TextBox("Name", "Empty", new { @id = "allowedString2" })%>--%>
<div class="editor-label"> <div class="config-group" style="width: 250px">
<%= Html.LabelFor(x => x.Name)%> <div class="config-title"><%= Html.LabelFor(x => x.Name)%></div>
</div> <div class="config-value"><%= Html.TextBoxFor(x => x.Name)%></div>
<div class="editor-field"> <div class="config-validation"><%= Html.ValidationMessageFor(x => x.Name)%></div>
<%= Html.TextBoxFor(x => x.Name) %>
<%= Html.ValidationMessageFor(x => x.Name)%>
</div> </div>
<div class="removeDiv"><a href="#" class="deleteRow">Remove</a></div>
<br />
<div class="hiddenProfileDetails"> <div class="hiddenProfileDetails">
<%= Html.TextBoxFor(x => x.ProfileId, new { @style = "display:none" })%> <%= Html.TextBoxFor(x => x.ProfileId, new { @style = "display:none" })%>
<%= Html.CheckBoxFor(x => x.UserProfile, new { @style = "display:none" })%> <%= Html.CheckBoxFor(x => x.UserProfile, new { @style = "display:none" })%>
@ -57,8 +62,8 @@
<br /> <br />
<div class="allowedQualities"> <div class="allowedQualities">
<h4 style="padding:0">Allowed</h4> <h4 class="sortableHeader">Allowed</h4>
<ul id="sortable1" class="connectedSortable" title> <ul id="sortable1" class="connectedSortable">
<% if (Model.Allowed != null) { %> <% if (Model.Allowed != null) { %>
<%for (int i = 0; i < Model.Allowed.Count(); i++){%> <%for (int i = 0; i < Model.Allowed.Count(); i++){%>
<li class="ui-state-default" id="<%= Model.Allowed[i].ToString() %>"> <li class="ui-state-default" id="<%= Model.Allowed[i].ToString() %>">
@ -71,7 +76,7 @@
</div> </div>
<div class="otherQualities"> <div class="otherQualities">
<h4 padding-left="10px">Not-Allowed</h4> <h4 class="sortableHeader">Not-Allowed</h4>
<ul id="sortable2" class="connectedSortable"> <ul id="sortable2" class="connectedSortable">
<% var qualitiesList = (List<QualityTypes>) ViewData["Qualities"]; %> <% var qualitiesList = (List<QualityTypes>) ViewData["Qualities"]; %>
@ -97,7 +102,8 @@
<% } %> <% } %>
</ul> </ul>
</div> </div>
<div class="removeDiv"><a href="#" class="deleteRow">Remove</a></div> <br />
</fieldset> </fieldset>
</div> </div>
<% } %> <% } %>
Loading…
Cancel
Save