2011-04-21 03:43:09 +02:00
|
|
|
@model NzbDrone.Core.Repository.Quality.QualityProfile
|
2011-05-29 10:59:25 +02:00
|
|
|
@using System.Collections
|
2011-04-21 03:43:09 +02:00
|
|
|
@using NzbDrone.Core.Repository.Quality
|
|
|
|
@using NzbDrone.Web.Helpers
|
2011-04-22 02:30:19 +02:00
|
|
|
@{
|
|
|
|
Layout = null;
|
|
|
|
}
|
2011-05-29 23:25:00 +02:00
|
|
|
<style>
|
2011-06-04 03:56:53 +02:00
|
|
|
.quality-selectee
|
|
|
|
{
|
|
|
|
width: 75px;
|
|
|
|
padding: 1px;
|
|
|
|
padding-left: 3px;
|
|
|
|
padding-right: 3px;
|
|
|
|
margin: 2px;
|
|
|
|
float: left;
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
.quality-selecting
|
|
|
|
{
|
|
|
|
background: #85AEF9;
|
|
|
|
}
|
|
|
|
.quality-selected
|
|
|
|
{
|
|
|
|
background: #065EFE;
|
|
|
|
color: white;
|
|
|
|
}
|
2011-05-29 23:25:00 +02:00
|
|
|
</style>
|
2011-05-29 06:07:11 +02:00
|
|
|
@using (Html.BeginCollectionItem("Profiles"))
|
2011-04-21 03:43:09 +02:00
|
|
|
{
|
|
|
|
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
|
2011-04-22 02:30:19 +02:00
|
|
|
var ugly = ViewData.TemplateInfo.HtmlFieldPrefix;
|
2011-04-21 03:43:09 +02:00
|
|
|
|
2011-05-29 10:59:25 +02:00
|
|
|
string selectable = String.Format("{0}_selectable", idClean);
|
2011-04-21 03:43:09 +02:00
|
|
|
string allowedStringName = String.Format("{0}_AllowedString", idClean);
|
|
|
|
string title = String.Format("{0}_Title", idClean);
|
|
|
|
string nameBox = String.Format("{0}_Name", idClean);
|
2011-05-29 23:25:00 +02:00
|
|
|
string cutoff = String.Format("{0}_Cutoff", idClean);
|
2011-04-21 03:43:09 +02:00
|
|
|
|
2011-05-30 06:49:56 +02:00
|
|
|
<div class="profileSectionEditor" id="profile_@(ViewData["ProfileId"])" style="float: left; height: 175px; width: 285px; margin-bottom: -14px;">
|
2011-06-04 03:56:53 +02:00
|
|
|
<fieldset style="width: 264px; margin: 5px; margin-top: 0px; border-color: #CCCCCD">
|
2011-05-29 10:59:25 +02:00
|
|
|
<div class="header">
|
|
|
|
<div id="qualityHeader" style="padding-bottom: 5px; margin: 0px;">
|
2011-06-04 03:56:53 +02:00
|
|
|
<h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="@title">
|
|
|
|
@{Html.DisplayTextFor(m => m.Name);}
|
|
|
|
</h2>
|
|
|
|
<a href="#" id="@Model.QualityProfileId" class="deleteRow" onclick="deleteProfile('@ViewData["ProfileId"]'); return false;" style="float:right; padding-top:8px; padding-right: 5px;">
|
|
|
|
<img src="../../Content/Images/X.png" alt="Delete" width="20px" height="20px" /></a>
|
2011-05-29 10:59:25 +02:00
|
|
|
</div>
|
|
|
|
<div class="config-group" style="width: 255px; margin-bottom: 5px; margin-left: 5px;">
|
|
|
|
<div class="config-title">@Html.LabelFor(x => x.Name)</div>
|
2011-05-30 08:19:13 +02:00
|
|
|
<div class="config-value">@Html.TextBoxFor(x => x.Name, new { maxlength = 15 })</div>
|
2011-05-29 10:59:25 +02:00
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(x => x.Name)</div>
|
|
|
|
</div>
|
|
|
|
<div class="config-group" style="width: 255px; margin-bottom: 5px; margin-left: 5px;">
|
|
|
|
<div class="config-title">@Html.LabelFor(x => x.Cutoff)</div>
|
2011-05-29 23:25:00 +02:00
|
|
|
<div class="config-value">@Html.DropDownListFor(m => m.Cutoff, new SelectList(Model.Allowed, Model.Cutoff))</div>
|
2011-05-29 10:59:25 +02:00
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(x => x.Cutoff)</div>
|
2011-06-04 03:56:53 +02:00
|
|
|
</div>
|
2011-04-21 03:43:09 +02:00
|
|
|
</div>
|
2011-05-29 10:59:25 +02:00
|
|
|
<div class="selectableDiv" style="margin-top: 30px;">
|
2011-05-29 23:25:00 +02:00
|
|
|
<div id="@selectable">
|
2011-05-29 10:59:25 +02:00
|
|
|
@{var qualitiesList = (List<QualityTypes>)ViewData["Qualities"];}
|
|
|
|
@for (int i = 0; i < qualitiesList.Count(); i++)
|
|
|
|
{
|
2011-05-29 23:25:00 +02:00
|
|
|
if (qualitiesList[i].ToString() == "Unknown")
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2011-06-04 03:56:53 +02:00
|
|
|
|
2011-05-29 10:59:25 +02:00
|
|
|
if (Model.Allowed != null)
|
2011-04-21 03:43:09 +02:00
|
|
|
{
|
2011-05-29 10:59:25 +02:00
|
|
|
if (Model.Allowed.Contains(qualitiesList[i]))
|
2011-04-21 03:43:09 +02:00
|
|
|
{
|
2011-06-04 03:56:53 +02:00
|
|
|
<fieldset class="quality-selectee quality-selected">@qualitiesList[i].ToString()</fieldset>
|
2011-05-29 10:59:25 +02:00
|
|
|
continue;
|
2011-04-21 03:43:09 +02:00
|
|
|
}
|
|
|
|
}
|
2011-05-29 10:59:25 +02:00
|
|
|
|
2011-05-29 23:25:00 +02:00
|
|
|
<fieldset class="quality-selectee">@qualitiesList[i].ToString()</fieldset>
|
2011-05-29 10:59:25 +02:00
|
|
|
}
|
2011-05-29 23:25:00 +02:00
|
|
|
</div>
|
2011-04-21 03:43:09 +02:00
|
|
|
</div>
|
2011-05-29 23:25:00 +02:00
|
|
|
<div class="hiddenProfileDetails">
|
2011-05-29 10:59:25 +02:00
|
|
|
@Html.HiddenFor(x => x.QualityProfileId)
|
|
|
|
@Html.HiddenFor(m => m.AllowedString)
|
2011-04-21 03:43:09 +02:00
|
|
|
</div>
|
|
|
|
</fieldset>
|
2011-05-29 23:25:00 +02:00
|
|
|
</div>
|
2011-04-21 03:43:09 +02:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2011-05-29 23:25:00 +02:00
|
|
|
$(document).ready(function () {
|
|
|
|
addOption('@Model.Name', '@ViewData["ProfileId"]');
|
|
|
|
|
|
|
|
result = "";
|
|
|
|
$("#@selectable .quality-selected").each(function () {
|
|
|
|
result += this.firstChild.data + ",";
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#@allowedStringName").empty().val(result);
|
|
|
|
$('#@selectable .quality-selectee').disableSelection();
|
2011-05-30 06:49:56 +02:00
|
|
|
|
|
|
|
$('#@cutoff option').each(function () { if ($(this).text().indexOf('Unknown') > -1) $('#@cutoff option').remove(':contains("' + $(this).text() + '")'); });
|
2011-05-29 23:25:00 +02:00
|
|
|
});
|
|
|
|
|
2011-04-21 05:52:09 +02:00
|
|
|
$("#@nameBox").keyup(function () {
|
2011-04-21 03:43:09 +02:00
|
|
|
var value = $(this).val();
|
2011-04-21 05:52:09 +02:00
|
|
|
$("#@title").text(value);
|
2011-05-18 05:39:26 +02:00
|
|
|
renameOption(value, '@ViewData["ProfileId"]');
|
2011-04-21 03:43:09 +02:00
|
|
|
}).keyup();
|
2011-05-29 23:25:00 +02:00
|
|
|
|
|
|
|
$('#@selectable .quality-selectee').click(function () {
|
2011-06-04 03:56:53 +02:00
|
|
|
if ($(this).hasClass('quality-selected')) {
|
2011-05-29 23:25:00 +02:00
|
|
|
$(this).removeClass('quality-selected');
|
|
|
|
var toRemove = this.firstChild.data;
|
|
|
|
$('#@cutoff option').each(function () { if ($(this).text().indexOf(toRemove) > -1) $('#@cutoff option').remove(':contains("' + $(this).text() + '")'); });
|
|
|
|
}
|
2011-06-04 03:56:53 +02:00
|
|
|
|
2011-05-29 23:25:00 +02:00
|
|
|
else {
|
|
|
|
$(this).addClass('quality-selected');
|
|
|
|
$('<option>' + this.firstChild.data + '</option>').appendTo('#@cutoff');
|
|
|
|
}
|
|
|
|
|
|
|
|
result = "";
|
|
|
|
$("#@selectable .quality-selected").each(function () {
|
|
|
|
result += this.firstChild.data + ",";
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#@allowedStringName").empty().val(result);
|
|
|
|
});
|
2011-04-21 03:43:09 +02:00
|
|
|
</script>
|
|
|
|
}
|