mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-26 01:37:07 +00:00
Cleaned up Quality partial page.
Fixed the sortable, so multiple user profiles correctly update order (and save), user profile sortable is no long connected.
This commit is contained in:
parent
e7cbc4cbcf
commit
baeda11ece
5 changed files with 44 additions and 59 deletions
|
@ -137,6 +137,15 @@ namespace NzbDrone.Web.Controllers
|
|||
return PartialView();
|
||||
}
|
||||
|
||||
public QualityModel GetUpdatedProfileList()
|
||||
{
|
||||
var profiles = _qualityProvider.GetAllProfiles().ToList();
|
||||
var defaultQualityProfileId = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].ProfileId, true));
|
||||
var selectList = new SelectList(profiles, "ProfileId", "Name");
|
||||
|
||||
return new QualityModel {DefaultProfileId = defaultQualityProfileId, SelectList = selectList};
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Index(SettingsModel data)
|
||||
{
|
||||
|
|
|
@ -270,6 +270,7 @@
|
|||
<Content Include="Views\Series\EpisodeDetail.ascx" />
|
||||
<Content Include="Views\Series\index.aspx" />
|
||||
<Content Include="Views\Series\Unmapped.aspx" />
|
||||
<Content Include="Views\Settings\Copy of UserProfileSection.ascx" />
|
||||
<Content Include="Views\Settings\Downloads.ascx" />
|
||||
<Content Include="Views\Settings\General.ascx" />
|
||||
<Content Include="Views\Settings\Index.aspx" />
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<% 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.") %>
|
||||
<%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%>
|
||||
|
||||
<fieldset>
|
||||
<legend>Download Settings</legend>
|
||||
|
|
|
@ -6,32 +6,14 @@
|
|||
$(document).ready(function () {
|
||||
var options = {
|
||||
target: '#result',
|
||||
beforeSerialize: saveOrder,
|
||||
beforeSubmit: showRequest,
|
||||
success: showResponse,
|
||||
type: 'post',
|
||||
resetForm: false
|
||||
};
|
||||
$('#form').ajaxForm(options);
|
||||
$.simpledropdown("#dropdown1");
|
||||
|
||||
});
|
||||
|
||||
function saveOrder(jqForm, options) {
|
||||
//Save the order of the sortable
|
||||
|
||||
var sortResult = $('#sortable').sortable("toArray");
|
||||
|
||||
var firstPart = "Indexers_";
|
||||
var secondPart = "__Order";
|
||||
|
||||
jQuery.each(sortResult, function (index, value) {
|
||||
var id = firstPart + value + secondPart;
|
||||
var newValue = index + 1;
|
||||
$("#" + id).val(newValue);
|
||||
});
|
||||
}
|
||||
|
||||
function showRequest(formData, jqForm, options) {
|
||||
$("#result").empty().html('Saving...');
|
||||
$("#form :input").attr("disabled", true);
|
||||
|
@ -40,26 +22,10 @@
|
|||
function showResponse(responseText, statusText, xhr, $form) {
|
||||
$("#result").empty().html(responseText);
|
||||
$("#form :input").attr("disabled", false);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#sortable { list-style-type: none; margin: 0; padding: 0; width: 30%; }
|
||||
#sortable li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; height: 1.5em; }
|
||||
#sortable li { height: 1.5em; line-height: 1.2em; }
|
||||
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$("#sortable").sortable({
|
||||
placeholder: "ui-state-highlight"
|
||||
});
|
||||
$("#sortable").disableSelection();
|
||||
});
|
||||
</script>
|
||||
|
||||
<% using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
|
||||
{%>
|
||||
<fieldset>
|
||||
|
|
|
@ -3,40 +3,50 @@
|
|||
<%@ Import Namespace="NzbDrone.Core.Repository.Quality" %>
|
||||
|
||||
<% 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);
|
||||
%>
|
||||
|
||||
<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; }
|
||||
|
||||
</style>
|
||||
.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",
|
||||
$("#<%= sortable1 %>, #<%= sortable2 %>").sortable({
|
||||
connectWith: ".<%= connectedSortable %>",
|
||||
placeholder: "ui-state-highlight",
|
||||
dropOnEmpty: true,
|
||||
|
||||
create: function (event, ui) {
|
||||
var order = $('#sortable1').sortable("toArray");
|
||||
$("#allowedString").val(order);
|
||||
var order = $('#<%= sortable1 %>').sortable("toArray");
|
||||
$("#<%= allowedStringName %>").val(order);
|
||||
},
|
||||
|
||||
update: function (event, ui) {
|
||||
var order = $('#sortable1').sortable("toArray");
|
||||
$("#allowedString").val(order);
|
||||
var order = $('#<%= sortable1 %>').sortable("toArray");
|
||||
$("#<%= allowedStringName %>").val(order);
|
||||
}
|
||||
|
||||
}).disableSelection();
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<div class="userProfileSectionEditor">
|
||||
|
||||
|
@ -56,7 +66,7 @@
|
|||
<div id="sortablesDiv" style="margin: 0px;">
|
||||
<div class="allowedQualities">
|
||||
<h4 class="sortableHeader">Allowed</h4>
|
||||
<ul id="sortable1" class="connectedSortable">
|
||||
<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() %>">
|
||||
|
@ -70,7 +80,7 @@
|
|||
|
||||
<div class="otherQualities">
|
||||
<h4 class="sortableHeader">Not-Allowed</h4>
|
||||
<ul id="sortable2" class="connectedSortable">
|
||||
<ul id="<%= sortable2 %>" class="<%= connectedSortable %> sortable2">
|
||||
<% var qualitiesList = (List<QualityTypes>) ViewData["Qualities"]; %>
|
||||
|
||||
<%for (int i = 0; i < qualitiesList.Count(); i++){%>
|
||||
|
@ -101,9 +111,8 @@
|
|||
<div class="hiddenProfileDetails">
|
||||
<%= Html.TextBoxFor(x => x.ProfileId, new { @style = "display:none" })%>
|
||||
<%= Html.CheckBoxFor(x => x.UserProfile, new { @style = "display:none" })%>
|
||||
<%= Html.TextBoxFor(m => m.AllowedString, new { @id = "allowedString", @style = "display:none" })%>
|
||||
<%= Html.TextBoxFor(m => m.AllowedString, new { @style = "display:none" })%>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
<% } %>
|
Loading…
Reference in a new issue