2011-01-29 06:10:22 +00:00
|
|
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Web.Models.SettingsModel>" %>
|
|
|
|
|
|
|
|
<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 01:59:23 +00:00
|
|
|
$('#save_button').attr('disabled', '');
|
2011-01-29 06:10:22 +00: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);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2011-04-10 02:44:01 +00:00
|
|
|
<%
|
|
|
|
using (Html.BeginForm("SaveGeneral", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
|
|
|
|
{%>
|
|
|
|
<%:Html.ValidationSummary(true,
|
|
|
|
"Unable to save your settings. Please correct the errors and try again.")%>
|
2011-03-09 07:40:48 +00:00
|
|
|
<fieldset>
|
2011-01-29 06:10:22 +00:00
|
|
|
<legend>General</legend>
|
2011-03-11 09:04:56 +00:00
|
|
|
|
2011-03-09 07:40:48 +00:00
|
|
|
<div style="padding-top: 10px;">
|
|
|
|
<div style="padding-left: 7px; margin-bottom: 5px;">
|
2011-04-10 02:44:01 +00:00
|
|
|
<a id="addItem" style="text-decoration:none;" href="<%:Url.Action("AddRootDir", "Settings")%>">
|
2011-04-06 02:53:32 +00:00
|
|
|
<img src="../Content/Images/Plus.png" alt="Add New Profile" />
|
2011-03-09 07:40:48 +00:00
|
|
|
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Root Directory</h4></a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="root-dirs">
|
2011-04-10 02:44:01 +00:00
|
|
|
<%
|
|
|
|
foreach (var item in Model.Directories)
|
|
|
|
{%>
|
|
|
|
<%
|
|
|
|
Html.RenderPartial("RootDir", item);%>
|
|
|
|
<%
|
|
|
|
}%>
|
2011-03-09 07:40:48 +00:00
|
|
|
</div>
|
2011-01-29 06:10:22 +00:00
|
|
|
</div>
|
2011-03-09 07:40:48 +00:00
|
|
|
|
2011-01-29 06:10:22 +00:00
|
|
|
<p>
|
2011-02-15 01:59:23 +00:00
|
|
|
<input type="submit" id="save_button" value="Save" disabled="disabled" />
|
2011-01-29 06:10:22 +00:00
|
|
|
</p>
|
|
|
|
</fieldset>
|
2011-04-10 02:44:01 +00:00
|
|
|
<%
|
|
|
|
}
|
|
|
|
Html.EndForm();%>
|
2011-03-09 07:40:48 +00:00
|
|
|
<div id="result"></div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
$("#addItem").click(function () {
|
|
|
|
$.ajax({
|
|
|
|
url: this.href,
|
|
|
|
cache: false,
|
|
|
|
success: function (html) { $("#root-dirs").append(html); }
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$("a.deleteRow").live("click", function () {
|
|
|
|
$(this).parents("div.rootDirSection:first").remove();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".defaultCheckbox").live("change", function () {
|
|
|
|
var checked = $(this).attr('checked');
|
|
|
|
|
|
|
|
if (checked) {
|
|
|
|
var thisOne = this;
|
|
|
|
$(".defaultCheckbox").attr('checked', false);
|
|
|
|
$(this).attr('checked', true);
|
|
|
|
}
|
|
|
|
|
|
|
|
//Don't let the user uncheck a checkbox (Like a radio button)
|
|
|
|
else {
|
|
|
|
$(this).attr('checked', true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|