1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-27 18:28:19 +00:00
Sonarr/NzbDrone.Web/Views/Settings/Quality.cshtml
Mark McDowall 8e214029c9 Renamed Download settings to Sabnzbd settings.
Moved Download Propers to Quality settings.
Cleaned up Quality UI and enhanced it with some jQuery goodness. Mmmmm jQuery.
2011-05-17 20:39:26 -07:00

131 lines
No EOL
4.9 KiB
Text

@using NzbDrone.Web.Helpers;
@model NzbDrone.Web.Models.QualityModel
<script type="text/javascript">
$(document).ready(function () {
var options = {
target: '#result',
beforeSubmit: showRequest,
success: showResponse,
type: 'post',
resetForm: false
};
$('#form').ajaxForm(options);
$('#save_button').attr('disabled', '');
});
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);
}
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);
}
</script>
@using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
{
<fieldset>
<legend>Quality</legend>
<div class="rightSide" style="float: right; width: 65%;">
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.DownloadPropers)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.DownloadPropers)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.DownloadPropers)</div>
<div class="config-description">@Html.DescriptionFor(m => m.DownloadPropers)</div>
</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.DefaultQualityProfileId)</div>
<div class="config-value">@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.SelectList)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.DefaultQualityProfileId)</div>
<div class="config-description">@Html.DescriptionFor(m => m.DefaultQualityProfileId)</div>
</div>
</div>
</div>
<div id="leftSide" style="width:35%;">
<div style="padding-top: 10px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddUserProfile", "Settings")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" />
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Profile</h4></a>
</div>
<div id="user-profiles">
@foreach (var item in Model.UserProfiles)
{
Html.RenderAction("GetQualityProfileView", item);
}
</div>
</div>
<div style="margin-top: 10px; padding-left: 5px;">
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</div>
</div>
</fieldset>
}
<div id="result" class="hiddenResult"></div>
<script type="text/javascript">
$("#addItem").click(function () {
$.ajax({
url: this.href,
cache: false,
success: function (html) {
$("#user-profiles").prepend(html);
}
});
return false;
});
var deleteQualityProfileUrl = '@Url.Action("DeleteQualityProfile", "Settings")';
function deleteProfile(id) {
sendToServer(id);
$("#div_" + id).remove();
removeOption(id);
}
function sendToServer(id) {
$.ajax({
type: "POST",
url: deleteQualityProfileUrl,
data: jQuery.param({ profileId: id }),
error: function (req, status, error) {
alert("Sorry! We could not delete your Profile at this time. " + error);
}
});
}
</script>