sonarr-repo-only/NzbDrone.Web/Views/Series/Editor.cshtml

187 lines
7.0 KiB
Plaintext

@using NzbDrone.Web.Helpers
@model IEnumerable<NzbDrone.Core.Repository.Series>
@{ViewBag.Title = "Series Editor";}
@section HeaderContent
{
@Html.IncludeCss("Settings.css")
@Html.IncludeCss("SeriesEditor.css")
}
@section ActionMenu
{
<ul class="sub-menu">
<li>@Ajax.ActionLink("Force Refresh", "ForceRefreshAll", "Command", null, null, new { Title = "Refresh episode and series information and scan for new episodes for all series" })</li>
<li>@Ajax.ActionLink("Rename All Series", "RenameAllSeries", "Episode", null, new AjaxOptions { Confirm = "Are you sure you want to rename all series?" }, new { Title = "Rename all series monitored by NzbDrone" })</li>
</ul>
}
@using (Html.BeginForm("SaveEditor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" }))
{
<table id="seriesEditorGrid" class="dataTable dataTablesGrid no-details">
<thead>
<tr>
<th width="14px">@Html.CheckBox("editToggleMaster", false, new { @class = "editToggleMaster" })</th>
<th>Title</th>
<th width="125px;">Quality</th>
<th class="checkboxColumn">Monitored</th>
<th class="checkboxColumn">Season Folder</th>
<th width="100px">Backlog Status</th>
<th width="310px">Path</th>
</tr>
</thead>
<tbody>
@foreach (var series in Model)
{
Html.RenderPartial("EditorItem", series);
}
</tbody>
<tfoot>
<tr>
<th></th>
<th class="editing-count"></th>
<th>
@Html.DropDownList("masterQualitySelector", (SelectList)ViewData["MasterProfileSelectList"], new { @class = "footer-control-quality masterSelector master-quality", disabled = true })
</th>
<th>
@Html.DropDownList("masterMonitored", (SelectList)ViewData["BoolSelectList"], new { @class = "footer-control masterSelector master-monitored", disabled = true })
</th>
<th>
@Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "footer-control masterSelector master-season-folder", disabled = true })
</th>
<th>
@Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "footer-control masterSelector master-backlog-setting", disabled = true })
</th>
<th>
<button id="series-editor-save" type="submit" class="save_button" disabled="disabled" title="Commit the settings from your series above to the database">
Save Changes
</button>
</th>
</tr>
</tfoot>
</table>
}
@section Scripts
{
<script type="text/javascript">
$(document).ready(function() {
$('#seriesEditorGrid').removeClass('hidden-grid');
oTable = $('.dataTablesGrid').dataTable({
"bShowAll": false,
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false
});
new FixedHeader(oTable, { "top": true, "left": false, "right": false, "bottom": true });
$('.editToggle').enableCheckboxRangeSelection();
//$('.master-quality option[value=-10]').text('Quality...');
//$('.master-monitored option[value=-10]').text('Monitored...');
//$('.master-season-folder option[value=-10]').text('Season Folder...');
//$('.master-backlog-setting option[value=-10]').text('Backlog Setting...');
});
$(document).on('change', '.editToggleMaster', function () {
var toggle = $(this).prop('checked');
$('.editToggle').each(function () {
$(this).prop('checked', toggle);
});
});
$(document).on('change', '.editToggle, .editToggleMaster', function () {
var selectedCount = $('.editToggle:checked');
if (selectedCount.length > 0) {
$('.masterSelector').each(function () {
$(this).attr("disabled", false);
});
$('.editing-count').text(selectedCount.length + ' series have been selected for editing');
if (selectedCount.length === 1) {
$('.editing-count').text(selectedCount.length + ' series has been selected for editing');
}
}
else {
$('.masterSelector').each(function () {
$(this).attr("disabled", true);
$('.editing-count').text('');
});
}
});
$(document).on('change', '#masterQualitySelector', function () {
var profileId = $(this).val();
if (profileId === -10)
return;
var selected = $('.editToggle:checked');
selected.each(function () {
$(this).parent('td').parent('.seriesEditRow').find('.quality').val(profileId);
});
});
$(document).on('change', '#masterMonitored', function () {
var monitored = $(this).val();
if (monitored === -10)
return;
var monitoredBool = true;
if (monitored != 1)
monitoredBool = false;
var selected = $('.editToggle:checked');
selected.each(function () {
$(this).parent('td').parent('.seriesEditRow').find('.monitored').prop('checked', monitoredBool);
});
});
$(document).on('change', '#masterSeasonFolder', function () {
var seasonFolder = $(this).val();
if (seasonFolder === -10)
return;
var seasonFolderBool = true;
if (seasonFolder != 1)
seasonFolderBool = false;
var selected = $('.editToggle:checked');
selected.each(function () {
$(this).parent('td').parent('.seriesEditRow').find('.seasonFolder').prop('checked', seasonFolderBool);
});
});
$(document).on('change', '#masterBacklogSetting', function () {
var backlogStatus = $(this).val();
if (backlogStatus === -10)
return;
var selected = $('.editToggle:checked');
selected.each(function () {
$(this).parent('td').parent('.seriesEditRow').find('.backlogSetting').val(backlogStatus);
});
});
$(document).on('click', '#series-editor-save', function () {
$('#SeriesEditor').submit();
});
</script>
}