Settings partial pages are all in RAZOR now!

This commit is contained in:
Mark McDowall 2011-04-20 18:43:09 -07:00
parent f3457a730c
commit 0e5ceff380
16 changed files with 732 additions and 790 deletions

View File

@ -626,7 +626,7 @@
<Content Include="Views\Series\SubMenu.ascx" /> <Content Include="Views\Series\SubMenu.ascx" />
<Content Include="Views\Settings\RootDir.ascx" /> <Content Include="Views\Settings\RootDir.ascx" />
<Content Include="Views\Settings\Notifications.ascx" /> <Content Include="Views\Settings\Notifications.ascx" />
<Content Include="Views\Settings\Downloads.ascx" /> <Content Include="Views\Settings\Downloads2.ascx" />
<Content Include="Views\Settings\EpisodeSorting.ascx" /> <Content Include="Views\Settings\EpisodeSorting.ascx" />
<Content Include="Views\Settings\General.ascx" /> <Content Include="Views\Settings\General.ascx" />
<Content Include="Views\Settings\Index.aspx" /> <Content Include="Views\Settings\Index.aspx" />
@ -664,6 +664,7 @@
<Content Include="Views\Web.config" /> <Content Include="Views\Web.config" />
<Content Include="Views\Settings\Indexers.cshtml" /> <Content Include="Views\Settings\Indexers.cshtml" />
<Content Include="Views\Timers\index.cshtml" /> <Content Include="Views\Timers\index.cshtml" />
<Content Include="Views\Settings\Downloads.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />

View File

@ -1,189 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Web.Models.DownloadSettingsModel>" %>
<script type="text/javascript">
$(document).ready(function () {
var options = {
target: '#result',
beforeSubmit: showRequest,
success: showResponse,
type: 'post',
resetForm: false
};
$('#form').ajaxForm(options);
selectDownloadOption(); //Load either SAB or Blackhole div
$('#save_button').attr('disabled', '');
});
function selectDownloadOption() {
var selected = $("input[name='UseBlackHole']:checked").val();
if (selected == "True") {
document.getElementById('blackhole').style.display = 'block';
document.getElementById('sab').style.display = 'none';
}
else {
document.getElementById('sab').style.display = 'block';
document.getElementById('blackhole').style.display = 'none';
}
}
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);
}
$(".blackhole_radio").live("change", function () {
selectDownloadOption(); //Load either SAB or Blackhole div
});
</script>
<%
Html.EnableClientValidation();%>
<%
using (Html.BeginForm("SaveDownloads", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
{%>
<%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%>
<fieldset>
<legend>Download Settings</legend>
<%--//Sync Frequency
//Download Propers?
//Retention
//SAB Host/IP
//SAB Port
//SAB APIKey
//SAB Username
//SAB Password
//SAB Category
//SAB Priority--%>
<fieldset class="sub-field">
<legend>Usenet Variables</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SyncFrequency)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.SyncFrequency)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SyncFrequency)%></div>
</div>
<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-validation"><%=Html.ValidationMessageFor(m => m.DownloadPropers)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.Retention)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.Retention)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.Retention)%></div>
</div>
</fieldset>
<div>
<div>
<b><%=Html.LabelFor(m => m.UseBlackHole)%></b>
</div>
<div>
<%=Html.RadioButtonFor(m => m.UseBlackHole, true, new {@class = "blackhole_radio"})%>Blackhole
</div>
<div>
<%=Html.RadioButtonFor(m => m.UseBlackHole, false, new {@class = "blackhole_radio"})%>SABnzbd
</div>
</div>
<div id="sab" style="display:none">
<fieldset class="sub-field">
<legend>SABnzbd</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SabHost)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.SabHost)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabHost)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SabPort)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.SabPort)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabPort)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SabApiKey)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.SabApiKey)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabApiKey)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SabUsername)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.SabUsername)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabUsername)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SabPassword)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.SabPassword)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabPassword)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SabTvCategory)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.SabTvCategory)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabTvCategory)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SabTvPriority)%></div>
<div class="config-value"><%=Html.DropDownListFor(m => m.SabTvPriority, Model.PrioritySelectList)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabTvPriority)%></div>
</div>
</fieldset>
</div>
<div id="blackhole" style="display:none">
<fieldset class="sub-field">
<legend>Blackhole</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.BlackholeDirectory)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.BlackholeDirectory)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.BlackholeDirectory)%></div>
</div>
</fieldset>
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
<%
}%>
</fieldset>
<div id="result"></div>

View File

@ -0,0 +1,175 @@
@model NzbDrone.Web.Models.DownloadSettingsModel
<script type="text/javascript">
$(document).ready(function () {
var options = {
target: '#result',
beforeSubmit: showRequest,
success: showResponse,
type: 'post',
resetForm: false
};
$('#form').ajaxForm(options);
selectDownloadOption(); //Load either SAB or Blackhole div
$('#save_button').attr('disabled', '');
});
function selectDownloadOption() {
var selected = $("input[name='UseBlackHole']:checked").val();
if (selected == "True") {
document.getElementById('blackhole').style.display = 'block';
document.getElementById('sab').style.display = 'none';
}
else {
document.getElementById('sab').style.display = 'block';
document.getElementById('blackhole').style.display = 'none';
}
}
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);
}
$(".blackhole_radio").live("change", function () {
selectDownloadOption(); //Load either SAB or Blackhole div
});
</script>
@using (Html.BeginForm("SaveDownloads", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
{
<fieldset>
<legend>Download Settings</legend>
<fieldset class="sub-field">
<legend>Usenet Variables</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SyncFrequency)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SyncFrequency)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SyncFrequency)</div>
</div>
<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-validation">@Html.ValidationMessageFor(m => m.DownloadPropers)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.Retention)</div>
<div class="config-value">@Html.TextBoxFor(m => m.Retention)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.Retention)</div>
</div>
</fieldset>
<div>
<div>
<b>@Html.LabelFor(m => m.UseBlackHole)</b>
</div>
<div>
@Html.RadioButtonFor(m => m.UseBlackHole, true, new { @class = "blackhole_radio" })Blackhole
</div>
<div>
@Html.RadioButtonFor(m => m.UseBlackHole, false, new { @class = "blackhole_radio" })SABnzbd
</div>
</div>
<div id="sab" style="display:none">
<fieldset class="sub-field">
<legend>SABnzbd</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabHost)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SabHost)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabHost)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabPort)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SabPort)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabPort)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabApiKey)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SabApiKey)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabApiKey)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabUsername)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SabUsername)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabUsername)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabPassword)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SabPassword)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabPassword)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabTvCategory)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SabTvCategory)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabTvCategory)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SabTvPriority)</div>
<div class="config-value">@Html.DropDownListFor(m => m.SabTvPriority, Model.PrioritySelectList)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SabTvPriority)</div>
</div>
</fieldset>
</div>
<div id="blackhole" style="display:none">
<fieldset class="sub-field">
<legend>Blackhole</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.BlackholeDirectory)</div>
<div class="config-value">@Html.TextBoxFor(m => m.BlackholeDirectory)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.BlackholeDirectory)</div>
</div>
</fieldset>
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</fieldset>
}
<div id="result"></div>

View File

@ -1,129 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Web.Models.EpisodeSortingModel>" %>
<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);
}
</script>
<%
Html.EnableClientValidation();%>
<%
using (Html.BeginForm("SaveEpisodeSorting", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
{%>
<%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%>
<fieldset>
<legend>Episode Sorting</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.ShowName)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.ShowName)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.ShowName)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.EpisodeName)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.EpisodeName)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.EpisodeName)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.ReplaceSpaces)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.ReplaceSpaces)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.ReplaceSpaces)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.AppendQuality)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.AppendQuality)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.AppendQuality)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.UseAirByDate)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.UseAirByDate)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.UseAirByDate)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SeasonFolders)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.SeasonFolders)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SeasonFolders)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SeasonFolderFormat)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.SeasonFolderFormat)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SeasonFolderFormat)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.SeparatorStyle)%></div>
<div class="config-value"><%=Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.SeparatorStyle)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.NumberStyle)%></div>
<div class="config-value"><%=Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.NumberStyle)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.MultiEpisodeStyle)%></div>
<div class="config-value"><%=Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.MultiEpisodeStyle)%></div>
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
<%
}%>
</fieldset>
<div id="result"></div>

View File

@ -0,0 +1,124 @@
@model NzbDrone.Web.Models.EpisodeSortingModel
<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);
}
</script>
@using (Html.BeginForm("SaveEpisodeSorting", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
{
@Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.")
;
<fieldset>
<legend>Episode Sorting</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.ShowName)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.ShowName)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.ShowName)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.EpisodeName)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.EpisodeName)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.EpisodeName)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.ReplaceSpaces)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.ReplaceSpaces)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.ReplaceSpaces)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.AppendQuality)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.AppendQuality)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.AppendQuality)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.UseAirByDate)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.UseAirByDate)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.UseAirByDate)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeasonFolders)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.SeasonFolders)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolders)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeasonFolderFormat)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SeasonFolderFormat)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolderFormat)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeparatorStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeparatorStyle)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.NumberStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.NumberStyle)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.MultiEpisodeStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.MultiEpisodeStyle)</div>
</div>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</fieldset>
}
<div id="result"></div>

View File

@ -1,92 +0,0 @@
<%@ 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);
$('#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);
}
</script>
<%
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.")%>
<fieldset>
<legend>General</legend>
<div style="padding-top: 10px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="<%:Url.Action("AddRootDir", "Settings")%>">
<img src="../Content/Images/Plus.png" alt="Add New Profile" />
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Root Directory</h4></a>
</div>
<div id="root-dirs">
<%
foreach (var item in Model.Directories)
{%>
<%
Html.RenderPartial("RootDir", item);%>
<%
}%>
</div>
</div>
<p>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</p>
</fieldset>
<%
}
Html.EndForm();%>
<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>

View File

@ -0,0 +1,85 @@
@model 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);
$('#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);
}
</script>
@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.");
<fieldset>
<legend>General</legend>
<div style="padding-top: 10px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddRootDir", "Settings")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" />
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Root Directory</h4></a>
</div>
<div id="root-dirs">
@foreach (var item in Model.Directories)
{
Html.RenderPartial("RootDir", item);
}
</div>
</div>
<p>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</p>
</fieldset>
}
<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>

View File

@ -1,168 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Web.Models.NotificationSettingsModel>" %>
<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);
}
</script>
<%
Html.EnableClientValidation();%>
<%
using (Html.BeginForm("SaveNotifications", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
{%>
<%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%>
<fieldset>
<legend>Notification Settings</legend>
<fieldset class="sub-field">
<legend>XBMC</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcEnabled)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcEnabled)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcEnabled)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcNotifyOnGrab)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcNotifyOnGrab)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcNotifyOnGrab)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcNotifyOnDownload)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcNotifyOnDownload)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcNotifyOnDownload)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcNotifyOnRename)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcNotifyOnRename)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcNotifyOnRename)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcNotificationImage)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcNotificationImage)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcNotificationImage)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcDisplayTime)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.XbmcDisplayTime)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcDisplayTime)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcUpdateOnDownload)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcUpdateOnDownload)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcUpdateOnDownload)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcUpdateOnRename)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcUpdateOnRename)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcUpdateOnRename)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcFullUpdate)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcFullUpdate)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcFullUpdate)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcCleanOnDownload)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcCleanOnDownload)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcCleanOnDownload)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcCleanOnRename)%></div>
<div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcCleanOnRename)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcCleanOnRename)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcHosts)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.XbmcHosts)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcHosts)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcUsername)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.XbmcUsername)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcUsername)%></div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title"><%=Html.LabelFor(m => m.XbmcPassword)%></div>
<div class="config-value"><%=Html.TextBoxFor(m => m.XbmcPassword)%></div>
</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcPassword)%></div>
</div>
</fieldset>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
<%
}%>
</fieldset>
<div id="result"></div>

View File

@ -0,0 +1,161 @@
@model NzbDrone.Web.Models.NotificationSettingsModel
<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);
}
</script>
@using (Html.BeginForm("SaveNotifications", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
{
<fieldset>
<legend>Notification Settings</legend>
<fieldset class="sub-field">
<legend>XBMC</legend>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcEnabled)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcEnabled)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcEnabled)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnGrab)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnGrab)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnGrab)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnDownload)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotifyOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotifyOnRename)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotifyOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcNotificationImage)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcNotificationImage)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcNotificationImage)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcDisplayTime)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcDisplayTime)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcDisplayTime)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUpdateOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcUpdateOnDownload)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUpdateOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUpdateOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcUpdateOnRename)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUpdateOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcFullUpdate)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcFullUpdate)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcFullUpdate)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcCleanOnDownload)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcCleanOnDownload)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcCleanOnDownload)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcCleanOnRename)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.XbmcCleanOnRename)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcCleanOnRename)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcHosts)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcHosts)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcHosts)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcUsername)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcUsername)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcUsername)</div>
</div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.XbmcPassword)</div>
<div class="config-value">@Html.TextBoxFor(m => m.XbmcPassword)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.XbmcPassword)</div>
</div>
</fieldset>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</fieldset>
}
<div id="result"></div>

View File

@ -1,4 +1,4 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Web.Models.QualityModel>" %> @model NzbDrone.Web.Models.QualityModel
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
@ -22,26 +22,21 @@
$("#result").empty().html(responseText); $("#result").empty().html(responseText);
$("#form :input").attr("disabled", false); $("#form :input").attr("disabled", false);
} }
</script> </script>
<%
Html.EnableClientValidation();%>
<% @using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new {id = "form", name = "form"}))
using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new {id = "form", name = "form"})) {
{%>
<fieldset> <fieldset>
<legend>Quality</legend> <legend>Quality</legend>
<%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%>
<div class="rightSide" style="float: right; width: 65%;"> <div class="rightSide" style="float: right; width: 65%;">
<div id="defaultQualityDiv" style="float: left; margin: 30px;"> <div id="defaultQualityDiv" style="float: left; margin: 30px;">
<div class="config-group" style="width: 250px; margin-bottom: 5px; margin-left: 5px;"> <div class="config-group" style="width: 250px; margin-bottom: 5px; margin-left: 5px;">
<div class="config-title"><%=Html.LabelFor(m => m.DefaultQualityProfileId)%></div> <div class="config-title">@Html.LabelFor(m => m.DefaultQualityProfileId)</div>
<div class="config-value"><%:Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.SelectList)%></div> <div class="config-value">@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.SelectList)</div>
<div class="config-validation"><%=Html.ValidationMessageFor(m => m.DefaultQualityProfileId)%></div> <div class="config-validation">@Html.ValidationMessageFor(m => m.DefaultQualityProfileId)</div>
</div> </div>
</div> </div>
</div> </div>
@ -49,19 +44,17 @@
<div id="leftSide" style="width:35%;"> <div id="leftSide" style="width:35%;">
<div style="padding-top: 10px;"> <div style="padding-top: 10px;">
<div style="padding-left: 7px; margin-bottom: 5px;"> <div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="<%:Url.Action("AddUserProfile", "Settings")%>"> <a id="addItem" style="text-decoration:none;" href="@Url.Action("AddUserProfile", "Settings")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" /> <img src="../../Content/Images/Plus.png" alt="Add New Profile" />
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Profile</h4></a> <h4 style="margin-left: 3px; display: inline; color: Black;">Add New Profile</h4></a>
</div> </div>
<div id="user-profiles"> <div id="user-profiles">
<%
foreach (var item in Model.UserProfiles) @foreach (var item in Model.UserProfiles)
{%> {
<% Html.RenderPartial("UserProfileSection", item);
Html.RenderPartial("UserProfileSection", item);%> }
<%
}%>
</div> </div>
</div> </div>
@ -71,9 +64,7 @@
</div> </div>
</fieldset> </fieldset>
}
<%
}%>
<div id="result"></div> <div id="result"></div>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1,32 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Core.Repository.RootDir>" %>
<%@ Import Namespace="NzbDrone.Web.Helpers" %>
<%
using (Html.BeginCollectionItem("Directories"))
{%>
<%
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
//string sortable1 = String.Format("{0}_sortable1", idClean);
%>
<style type="text/css">
.root_dir_text
{
width: 300px;
}
</style>
<div class="rootDirSection">
<fieldset>
<div>
<%:Html.TextBoxFor(m => m.Path, new {@class = "root_dir_text"})%>
<a href="#" class="deleteRow">
<img src="../Content/Images/X.png" alt="Delete" /></a>
</div>
<div>
<%:Html.ValidationMessageFor(m => m.Path)%>
</div>
<div class="hiddenProfileDetails">
<%=Html.TextBoxFor(x => x.Id, new {@style = "display:none"})%>
</div>
</fieldset>
</div>
<%
}%>

View File

@ -0,0 +1,30 @@
@model NzbDrone.Core.Repository.RootDir
@using NzbDrone.Web.Helpers;
<style type="text/css">
.root_dir_text
{
width: 300px;
}
</style>
@using (Html.BeginCollectionItem("Directories"))
{
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
<div class="rootDirSection">
<fieldset>
<div>
@Html.TextBoxFor(m => m.Path, new { @class = "root_dir_text" })
<a href="#" class="deleteRow">
<img src="../../Content/Images/X.png" alt="Delete" /></a>
</div>
<div>
@Html.ValidationMessageFor(m => m.Path)
</div>
<div class="hiddenProfileDetails">
@Html.TextBoxFor(x => x.Id, new { @style = "display:none" })
</div>
</fieldset>
</div>
}

View File

@ -1,17 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%
Html.Telerik().Menu().Name("Menu").Items(items =>
{
items.Add().Text("General").Action("General", "Settings");
items.Add().Text("Indexers").Action("Indexers", "Settings");
items.Add().Text("Downloads").Action("Downloads", "Settings");
items.Add().Text("Quality").Action("Quality", "Settings");
items.Add().Text("Episode Sorting").Action("EpisodeSorting",
"Settings");
items.Add().Text("Notifications").Action("Notifications",
"Settings");
}).Render();
%>

View File

@ -0,0 +1,12 @@
@{Html.Telerik().Menu().Name("Menu").Items(items =>
{
items.Add().Text("General").Action("General", "Settings");
items.Add().Text("Indexers").Action("Indexers", "Settings");
items.Add().Text("Downloads").Action("Downloads", "Settings");
items.Add().Text("Quality").Action("Quality", "Settings");
items.Add().Text("Episode Sorting").Action("EpisodeSorting",
"Settings");
items.Add().Text("Notifications").Action("Notifications",
"Settings");
}).Render();
}

View File

@ -1,139 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Core.Repository.Quality.QualityProfile>" %>
<%@ Import Namespace="NzbDrone.Core.Repository.Quality" %>
<%@ Import Namespace="NzbDrone.Web.Helpers" %>
<%
using (Html.BeginCollectionItem("UserProfiles"))
{%>
<%
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
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);
%>
<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: 107px; 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: 112px; -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: 100px; -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 () {
$("#<%=sortable1%>, #<%=sortable2%>").sortable({
connectWith: ".<%=connectedSortable%>",
placeholder: "ui-state-highlight",
dropOnEmpty: true,
create: function (event, ui) {
var order = $('#<%=sortable1%>').sortable("toArray");
$("#<%=allowedStringName%>").val(order);
},
update: function (event, ui) {
var order = $('#<%=sortable1%>').sortable("toArray");
$("#<%=allowedStringName%>").val(order);
}
}).disableSelection();
});
</script>
<div class="userProfileSectionEditor">
<fieldset style="width:275px; margin:5px; margin-top: 0px; border-color:#CCCCCD">
<div id="qualityHeader" style="padding-bottom: 5px; margin: 0px;">
<h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="<%=title%>"><%=Html.DisplayTextFor(m => m.Name)%></h2>
<a href="#" class="deleteRow"><img src="../../Content/Images/X.png" alt="Delete" /></a>
</div>
<div class="config-group" style="width: 250px; margin-bottom: 5px; margin-left: 5px;">
<div class="config-title"><%=Html.LabelFor(x => x.Name)%></div>
<div class="config-value"><%=Html.TextBoxFor(x => x.Name)%></div>
<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>
<ul id="<%=sortable1%>" class="<%=connectedSortable%> sortable1">
<%
if (Model.Allowed != null)
{%>
<%
for (int i = 0; i < Model.Allowed.Count(); i++)
{%>
<li class="ui-state-default" id="<%=Model.Allowed[i].ToString()%>">
<%=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
if (qualitiesList[i].ToString() == "Unknown")
continue;
if (Model.Allowed != null)
{
if (Model.Allowed.Contains(qualitiesList[i]))
continue;
}
%>
<li class="ui-state-default" id="<%=qualitiesList[i].ToString()%>">
<%=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">
$("#<%:nameBox%>").keyup(function () {
var value = $(this).val();
$("#<%=title%>").text(value);
}).keyup();
</script>
<%
}%>

View File

@ -0,0 +1,129 @@
@model NzbDrone.Core.Repository.Quality.QualityProfile
@using NzbDrone.Core.Repository.Quality
@using NzbDrone.Web.Helpers
@using (Html.BeginCollectionItem("UserProfiles"))
{
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
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);
<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 () {
$("#<%=sortable1%>, #<%=sortable2%>").sortable({
connectWith: ".<%=connectedSortable%>",
placeholder: "ui-state-highlight",
dropOnEmpty: true,
create: function (event, ui) {
var order = $('#<%=sortable1%>').sortable("toArray");
$("#<%=allowedStringName%>").val(order);
},
update: function (event, ui) {
var order = $('#<%=sortable1%>').sortable("toArray");
$("#<%=allowedStringName%>").val(order);
}
}).disableSelection();
});
</script>
<div class="userProfileSectionEditor">
<fieldset style="width:285px; margin:5px; margin-top: 0px; border-color:#CCCCCD">
<div id="qualityHeader" style="padding-bottom: 5px; margin: 0px;">
<h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="<%=title%>"><@Html.DisplayTextFor(m => m.Name)</h2>
<a href="#" class="deleteRow"><img src="../../Content/Images/X.png" alt="Delete" /></a>
</div>
<div class="config-group" style="width: 250px; margin-bottom: 5px; margin-left: 5px;">
<div class="config-title">@Html.LabelFor(x => x.Name)</div>
<div class="config-value">@Html.TextBoxFor(x => x.Name)</div>
<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>
<ul id="<%=sortable1%>" class="<%=connectedSortable%> sortable1">
@if (Model.Allowed != null)
{
for (int i = 0; i < Model.Allowed.Count(); i++)
{
<li class="ui-state-default" id="<%=Model.Allowed[i].ToString()%>">
@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
if (qualitiesList[i].ToString() == "Unknown")
{
continue;
}
if (Model.Allowed != null)
{
if (Model.Allowed.Contains(qualitiesList[i]))
{
continue;
}
}
<li class="ui-state-default" id="<%=qualitiesList[i].ToString()%>">
@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">
$("#<%:nameBox%>").keyup(function () {
var value = $(this).val();
$("#<%=title%>").text(value);
}).keyup();
</script>
}