2011-04-21 01:43:09 +00:00
|
|
|
@model NzbDrone.Core.Repository.Quality.QualityProfile
|
|
|
|
@using NzbDrone.Core.Repository.Quality
|
|
|
|
@using NzbDrone.Web.Helpers
|
|
|
|
|
2011-04-22 00:30:19 +00:00
|
|
|
@{
|
|
|
|
Layout = null;
|
|
|
|
}
|
|
|
|
|
2011-05-18 03:39:26 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function () {
|
|
|
|
addOption('@Model.Name', '@ViewData["ProfileId"]');
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2011-05-29 04:07:11 +00:00
|
|
|
@using (Html.BeginCollectionItem("Profiles"))
|
2011-04-21 01:43:09 +00:00
|
|
|
{
|
|
|
|
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
|
2011-04-22 00:30:19 +00:00
|
|
|
var ugly = ViewData.TemplateInfo.HtmlFieldPrefix;
|
2011-04-21 01:43:09 +00:00
|
|
|
|
|
|
|
string sortable1 = String.Format("{0}_sortable1", idClean);
|
|
|
|
string sortable2 = String.Format("{0}_sortable2", idClean);
|
|
|
|
string allowedStringName = String.Format("{0}_AllowedString", idClean);
|
|
|
|
string connectedSortable = String.Format("connected{0}", idClean);
|
|
|
|
string title = String.Format("{0}_Title", idClean);
|
|
|
|
string nameBox = String.Format("{0}_Name", idClean);
|
2011-04-22 00:30:19 +00:00
|
|
|
string cutoff = String.Format("{0}.Cutoff", ugly);
|
2011-04-21 01:43:09 +00:00
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
.sortable1, .sortable2 { list-style-type: none; margin-right: 10px; background: #eee; padding-left: 5px; padding-right: 5px; padding-top: 0px; padding-bottom: 6px; width: 117px; margin-bottom: 3px; }
|
|
|
|
.allowedQualities, .otherQualities { list-style-type: none; float: left; margin-right: 10px; background: #eee; padding-left: 5px; padding-right: 5px; padding-top:6px; width: 122px; -khtml-border-radius:8px;border-radius:8px;-moz-border-radius:8px;-webkit-border-radius:8px; }
|
|
|
|
.sortable1 li, .sortable2 li { margin: 5px; margin-left: 0px; padding: 0px; font-size: 1.2em; width: 110px; -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; border-color: #065EFE; }
|
|
|
|
.removeDiv { float: left; display:block; }
|
|
|
|
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function () {
|
2011-04-21 03:52:09 +00:00
|
|
|
$("#@sortable1, #@sortable2").sortable({
|
|
|
|
connectWith: ".@connectedSortable",
|
2011-04-21 01:43:09 +00:00
|
|
|
placeholder: "ui-state-highlight",
|
|
|
|
dropOnEmpty: true,
|
|
|
|
|
|
|
|
create: function (event, ui) {
|
2011-04-21 03:52:09 +00:00
|
|
|
var order = $('#@sortable1').sortable("toArray");
|
2011-04-22 00:30:19 +00:00
|
|
|
$("#@allowedStringName").val(order);
|
2011-04-21 01:43:09 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
update: function (event, ui) {
|
2011-04-21 03:52:09 +00:00
|
|
|
var order = $('#@sortable1').sortable("toArray");
|
|
|
|
$("#@allowedStringName").val(order);
|
2011-04-21 01:43:09 +00:00
|
|
|
|
2011-04-22 00:30:19 +00:00
|
|
|
//If this is the first QualityType added to the Profile select it as the cutoff value (in-case the user forgets)
|
|
|
|
var $list = $('#@sortable1 li');
|
|
|
|
if ($list.length == 1) {
|
|
|
|
var $radios = $('input[name="@cutoff"]');
|
|
|
|
$radios.filter('[value=' + order + ']').attr('checked', true);
|
|
|
|
}
|
|
|
|
}
|
2011-04-21 01:43:09 +00:00
|
|
|
}).disableSelection();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2011-05-29 04:07:11 +00:00
|
|
|
<div class="profileSectionEditor" id="div_@(ViewData["ProfileId"])">
|
2011-04-21 01:43:09 +00:00
|
|
|
|
2011-05-18 03:39:26 +00:00
|
|
|
<fieldset style="width:285px; max-width:285px; margin:5px; margin-top: 0px; border-color:#CCCCCD">
|
2011-04-22 00:30:19 +00:00
|
|
|
<div id="tester"></div>
|
2011-04-21 01:43:09 +00:00
|
|
|
|
|
|
|
<div id="qualityHeader" style="padding-bottom: 5px; margin: 0px;">
|
2011-04-22 00:30:19 +00:00
|
|
|
<h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="@title">@{Html.DisplayTextFor(m => m.Name);}</h2>
|
2011-05-29 04:07:11 +00:00
|
|
|
<a href="#" id="@Model.QualityProfileId" class="deleteRow" onclick="deleteProfile('@ViewData["ProfileId"]'); return false;" style="float:right; padding-top:15px;"><img src="../../Content/Images/X.png" alt="Delete"/></a>
|
2011-04-21 01:43:09 +00:00
|
|
|
</div>
|
|
|
|
|
2011-05-18 03:39:26 +00:00
|
|
|
<div class="config-group" style="width: 270px; margin-bottom: 5px; margin-left: 5px;">
|
2011-04-21 01:43:09 +00:00
|
|
|
<div class="config-title">@Html.LabelFor(x => x.Name)</div>
|
2011-05-18 03:39:26 +00:00
|
|
|
<div class="config-value">@Html.TextBoxFor(x => x.Name, new { maxlength = 16})</div>
|
2011-04-21 01:43:09 +00:00
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(x => x.Name)</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="sortablesDiv" style="margin: 0px;">
|
|
|
|
<div class="allowedQualities">
|
|
|
|
<h4 class="sortableHeader">Allowed</h4>
|
2011-04-21 03:52:09 +00:00
|
|
|
<ul id="@sortable1" class="@connectedSortable sortable1">
|
2011-04-21 01:43:09 +00:00
|
|
|
@if (Model.Allowed != null)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < Model.Allowed.Count(); i++)
|
|
|
|
{
|
2011-04-21 03:52:09 +00:00
|
|
|
<li class="ui-state-default" id="@Model.Allowed[i].ToString()">
|
2011-04-21 01:43:09 +00:00
|
|
|
@Html.RadioButtonFor(x => x.Cutoff, Model.Allowed[i])
|
|
|
|
@Html.DisplayTextFor(c => c.Allowed[i])
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="otherQualities">
|
|
|
|
<h4 class="sortableHeader">Not-Allowed</h4>
|
|
|
|
<ul id="@sortable2" class="@connectedSortable sortable2">
|
|
|
|
|
|
|
|
@{var qualitiesList = (List<QualityTypes>)ViewData["Qualities"];}
|
|
|
|
|
|
|
|
@for (int i = 0; i < qualitiesList.Count(); i++)
|
|
|
|
{
|
|
|
|
//Skip Unknown and any item that is in the allowed list
|
2011-04-22 00:30:19 +00:00
|
|
|
//if (qualitiesList[i].ToString() == "Unknown")
|
|
|
|
//{
|
|
|
|
// continue;
|
|
|
|
//}
|
2011-04-21 01:43:09 +00:00
|
|
|
|
|
|
|
if (Model.Allowed != null)
|
|
|
|
{
|
|
|
|
if (Model.Allowed.Contains(qualitiesList[i]))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-21 03:52:09 +00:00
|
|
|
<li class="ui-state-default" id="@qualitiesList[i].ToString()">
|
2011-04-21 01:43:09 +00:00
|
|
|
@Html.RadioButtonFor(x => x.Cutoff, qualitiesList[i])
|
|
|
|
@Html.Label(qualitiesList[i].ToString())
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@Html.ValidationMessageFor(x => x.Cutoff)
|
|
|
|
|
|
|
|
<div class="hiddenProfileDetails">
|
|
|
|
@Html.TextBoxFor(x => x.QualityProfileId, new { @style = "display:none" })
|
|
|
|
@Html.CheckBoxFor(x => x.UserProfile, new { @style = "display:none" })
|
|
|
|
@Html.TextBoxFor(m => m.AllowedString, new { @style = "display:none" })
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2011-04-21 03:52:09 +00:00
|
|
|
$("#@nameBox").keyup(function () {
|
2011-04-21 01:43:09 +00:00
|
|
|
var value = $(this).val();
|
2011-04-21 03:52:09 +00:00
|
|
|
$("#@title").text(value);
|
2011-05-18 03:39:26 +00:00
|
|
|
renameOption(value, '@ViewData["ProfileId"]');
|
2011-04-21 01:43:09 +00:00
|
|
|
}).keyup();
|
|
|
|
</script>
|
|
|
|
}
|