mirror of https://github.com/lidarr/Lidarr
Quality Config, Dynamically add new User Profiles, just need to get them to save.
This commit is contained in:
parent
d083d653db
commit
be6bdbc483
|
@ -9,10 +9,12 @@ namespace NzbDrone.Core.Repository.Quality
|
|||
{
|
||||
[SubSonicPrimaryKey(true)]
|
||||
public int ProfileId { get; set; }
|
||||
[DisplayName("Name")]
|
||||
public string Name { get; set; }
|
||||
public bool UserProfile { get; set; } //Allows us to tell the difference between default and user profiles
|
||||
|
||||
[SubSonicIgnore]
|
||||
[DisplayName("Allowed Qualities")]
|
||||
public List<QualityTypes> Allowed { get; set; }
|
||||
|
||||
public QualityTypes Cutoff { get; set; }
|
||||
|
|
|
@ -123,6 +123,11 @@ namespace NzbDrone.Web.Controllers
|
|||
return View("Index", model);
|
||||
}
|
||||
|
||||
public ViewResult AddUserProfile()
|
||||
{
|
||||
return View("UserProfileSection", new QualityProfile());
|
||||
}
|
||||
|
||||
public ActionResult SubMenu()
|
||||
{
|
||||
return PartialView();
|
||||
|
|
|
@ -269,6 +269,9 @@
|
|||
<Content Include="Views\Settings\Indexers.ascx" />
|
||||
<Content Include="Views\Settings\Quality.ascx" />
|
||||
<Content Include="Views\Settings\SubMenu.ascx" />
|
||||
<Content Include="Views\Settings\Test.ascx" />
|
||||
<Content Include="Views\Settings\Test2.ascx" />
|
||||
<Content Include="Views\Settings\UserProfileSection.ascx" />
|
||||
<Content Include="Views\Shared\Footer.ascx" />
|
||||
<Content Include="Web.config">
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Web.Models.QualityModel>" %>
|
||||
<%@ Import Namespace="NzbDrone.Core.Repository.Quality" %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
@ -71,10 +72,46 @@
|
|||
<%: Html.DropDownListFor(m => m.DefaultProfileId, Model.SelectList)%>
|
||||
<%= Html.ValidationMessageFor(m => m.DefaultProfileId)%>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="profile-editor">
|
||||
<%= Html.ActionLink("Add a New Profile", "AddUserProfile", null, new { id = "addItem" }) %>
|
||||
<div id="user-profiles">
|
||||
<%for (int i = 0; i < Model.UserProfiles.Count(); i++){%>
|
||||
<% Html.RenderPartial("UserProfileSection", Model.UserProfiles[i]); %>
|
||||
<%--<%= Html.TextBoxFor(m => m.UserProfiles[i].ApiUrl, new { @style = "display:none" })%>--%>
|
||||
<%}%>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<input type="submit" class="button" value="Save" />
|
||||
</fieldset>
|
||||
|
||||
<%}%>
|
||||
<div id="result"></div>
|
||||
<div id="result"></div>
|
||||
|
||||
<%--<script type="text/javascript">
|
||||
$('#add-profile').click(
|
||||
function () {
|
||||
<% Model.UserProfiles.Add(new QualityProfile{Name = "New Quality"}); %>
|
||||
$('<%: Html.LabelFor(m => m.UserProfiles.Last().Name) %><%: Html.TextBoxFor(m => m.UserProfiles.Last().Name) %><br/>')
|
||||
.prependTo($('#user-profiles'));
|
||||
});
|
||||
|
||||
</script>--%>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$("#addItem").click(function () {
|
||||
$.ajax({
|
||||
url: this.href,
|
||||
cache: false,
|
||||
success: function (html) { $("#user-profiles").prepend(html); }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$("a.deleteRow").live("click", function () {
|
||||
$(this).parents("div.editorRow:first").remove();
|
||||
return false;
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,9 @@
|
|||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Core.Repository.Quality.QualityProfile>" %>
|
||||
|
||||
<div class="editor-label">
|
||||
<%= Html.LabelFor(m => m.Name) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(m => m.Name)%>
|
||||
<%= Html.ValidationMessageFor(m => m.Name)%>
|
||||
</div>
|
|
@ -19,7 +19,7 @@
|
|||
<link href="../../Content/jquery-ui.custom.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../../Content/jquery-simpledropdown.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="../../Scripts/jquery-1.4.3.min.js"></script>
|
||||
<script type="text/javascript" src="../../Scripts/jquery-ui-1.8.8.min.js"></script>
|
||||
<%--<script type="text/javascript" src="../../Scripts/jquery-ui-1.8.8.min.js"></script>--%>
|
||||
<asp:ContentPlaceHolder ID="headerContent" runat="server"></asp:ContentPlaceHolder>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -52,7 +52,8 @@
|
|||
</body>
|
||||
<asp:ContentPlaceHolder runat="server" id="Scripts" />
|
||||
<% Html.Telerik().ScriptRegistrar().Scripts(
|
||||
c => c.Add("jquery-ui-1.8.8.min.js")
|
||||
c => c.Add("jquery-1.4.3.min.js")
|
||||
.Add("jquery-ui-1.8.8.min.js")
|
||||
.Add("jquery.form.js")
|
||||
.Add("jquery.jgrowl.js")
|
||||
.Add("Notification.js")
|
||||
|
|
Loading…
Reference in New Issue