2011-05-18 06:39:26 +03:00
|
|
|
@using NzbDrone.Web.Helpers;
|
|
|
|
@model NzbDrone.Web.Models.QualityModel
|
2011-02-03 04:49:52 +02:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function () {
|
|
|
|
var options = {
|
|
|
|
target: '#result',
|
|
|
|
beforeSubmit: showRequest,
|
|
|
|
success: showResponse,
|
|
|
|
type: 'post',
|
|
|
|
resetForm: false
|
|
|
|
};
|
|
|
|
$('#form').ajaxForm(options);
|
2011-02-15 03:59:23 +02:00
|
|
|
$('#save_button').attr('disabled', '');
|
2011-02-03 04:49:52 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
function showRequest(formData, jqForm, options) {
|
|
|
|
$("#result").empty().html('Saving...');
|
|
|
|
$("#form :input").attr("disabled", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function showResponse(responseText, statusText, xhr, $form) {
|
|
|
|
$("#result").empty().html(responseText);
|
|
|
|
$("#form :input").attr("disabled", false);
|
2011-02-12 08:10:38 +02:00
|
|
|
}
|
2011-05-18 06:39:26 +03:00
|
|
|
|
|
|
|
function addOption(text, value) {
|
|
|
|
var myCombo = $('#DefaultQualityProfileId');
|
|
|
|
|
|
|
|
var exists = $("#DefaultQualityProfileId option[value='" + value + "']");
|
|
|
|
|
|
|
|
if (exists.length == 0)
|
|
|
|
myCombo.append($('\<option\> \</option\>').val(value).html(text));
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeOption(value) {
|
|
|
|
$("#DefaultQualityProfileId option[value='" + value + "']").remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
function renameOption(text, value) {
|
|
|
|
$("#DefaultQualityProfileId option[value='" + value + "']").html(text);
|
|
|
|
}
|
2011-02-03 04:49:52 +02:00
|
|
|
</script>
|
|
|
|
|
2011-04-21 04:43:09 +03:00
|
|
|
@using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
|
|
|
|
{
|
2011-05-30 07:49:56 +03:00
|
|
|
<fieldset style="position: relative;">
|
2011-04-21 04:43:09 +03:00
|
|
|
<legend>Quality</legend>
|
2011-02-03 20:28:14 +02:00
|
|
|
|
2011-05-30 07:49:56 +03:00
|
|
|
<div id="top">
|
2011-05-18 06:39:26 +03:00
|
|
|
<div class="config-section">
|
|
|
|
<div class="config-group">
|
2011-04-21 04:43:09 +03:00
|
|
|
<div class="config-title">@Html.LabelFor(m => m.DefaultQualityProfileId)</div>
|
2011-05-29 11:59:25 +03:00
|
|
|
<div class="config-value">@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList)</div>
|
2011-05-18 06:39:26 +03:00
|
|
|
</div>
|
|
|
|
<div class="config-group2">
|
2011-04-21 04:43:09 +03:00
|
|
|
<div class="config-validation">@Html.ValidationMessageFor(m => m.DefaultQualityProfileId)</div>
|
2011-05-18 06:39:26 +03:00
|
|
|
<div class="config-description">@Html.DescriptionFor(m => m.DefaultQualityProfileId)</div>
|
2011-02-08 09:08:38 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2011-02-05 08:07:25 +02:00
|
|
|
</div>
|
2011-05-30 07:49:56 +03:00
|
|
|
<div id="bottom" style="float: left; padding-bottom: 55px;">
|
|
|
|
<div style="padding-left: 7px; margin-bottom: 5px;">
|
|
|
|
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddProfile", "Settings")">
|
2011-05-30 07:57:40 +03:00
|
|
|
<img src="../../Content/Images/Plus.png" alt="Add New Profile" width="20px" height="20px" />
|
2011-05-30 07:49:56 +03:00
|
|
|
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Profile</h4></a>
|
2011-02-08 09:08:38 +02:00
|
|
|
</div>
|
2011-02-06 04:52:49 +02:00
|
|
|
|
2011-05-30 07:49:56 +03:00
|
|
|
<div id="profiles">
|
|
|
|
@foreach (var item in Model.Profiles)
|
|
|
|
{
|
|
|
|
Html.RenderAction("GetQualityProfileView", item);
|
|
|
|
}
|
2011-02-05 20:27:14 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2011-02-06 04:52:49 +02:00
|
|
|
|
2011-05-30 07:49:56 +03:00
|
|
|
<input type="submit" id="save_button" value="Save" disabled="disabled" style="position: absolute; bottom: 0px; display: block; padding-left: 5px;"/>
|
|
|
|
</fieldset>
|
|
|
|
}
|
2011-05-13 07:46:26 +03:00
|
|
|
<div id="result" class="hiddenResult"></div>
|
2011-02-05 20:27:14 +02:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
$("#addItem").click(function () {
|
|
|
|
$.ajax({
|
|
|
|
url: this.href,
|
|
|
|
cache: false,
|
2011-05-18 06:39:26 +03:00
|
|
|
success: function (html) {
|
2011-05-30 01:44:05 +03:00
|
|
|
$("#profiles").append(html);
|
2011-05-18 06:39:26 +03:00
|
|
|
|
|
|
|
}
|
2011-02-05 20:27:14 +02:00
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2011-04-22 03:30:19 +03:00
|
|
|
var deleteQualityProfileUrl = '@Url.Action("DeleteQualityProfile", "Settings")';
|
|
|
|
|
|
|
|
function deleteProfile(id) {
|
|
|
|
sendToServer(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
function sendToServer(id) {
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: deleteQualityProfileUrl,
|
|
|
|
data: jQuery.param({ profileId: id }),
|
|
|
|
error: function (req, status, error) {
|
2011-04-25 02:00:09 +03:00
|
|
|
alert("Sorry! We could not delete your Profile at this time. " + error);
|
2011-05-29 07:07:11 +03:00
|
|
|
},
|
|
|
|
success: function (data, textStatus, jqXHR) {
|
|
|
|
if (data == "ok") {
|
2011-05-30 07:57:40 +03:00
|
|
|
$("#profile_" + id).remove();
|
2011-05-29 07:07:11 +03:00
|
|
|
removeOption(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
alert(data);
|
|
|
|
}
|
2011-04-22 03:30:19 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2011-02-05 20:27:14 +02:00
|
|
|
</script>
|