1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fix: Series Editor enhancements to make it more straight forward.

Fix: History and Missing Grids now link to Seriesi/Details.
This commit is contained in:
Mark McDowall 2012-02-26 20:47:49 -08:00
parent f342b31271
commit 24dae1927f
11 changed files with 81 additions and 26 deletions

View File

@ -1,6 +1,7 @@
using System.Linq;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Providers;
using NzbDrone.Web.Models;
@ -33,6 +34,7 @@ public JsonResult AjaxBinding()
EpisodeTitle = h.Episode.Title,
EpisodeOverview = h.Episode.Overview,
SeriesTitle = h.SeriesTitle,
SeriesTitleSorter = SortHelper.SkipArticles(h.SeriesTitle),
NzbTitle = h.NzbTitle,
Quality = h.Quality.ToString(),
IsProper = h.IsProper,

View File

@ -5,6 +5,7 @@
using System.Web.Mvc;
using System.Web.Script.Serialization;
using NzbDrone.Core;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Providers;
using NzbDrone.Web.Models;
@ -31,6 +32,7 @@ public ActionResult Index()
EpisodeTitle = e.Title,
Overview = e.Overview,
SeriesTitle = e.Series.Title,
SeriesTitleSorter = SortHelper.SkipArticles(e.Series.Title),
AirDate = e.AirDate.Value.ToString("MM/dd/yyyy"),
AirDateString = e.AirDate.Value.ToBestDateString()
});

View File

@ -133,19 +133,19 @@ public ActionResult Details(int seriesId)
return View(model);
}
public ActionResult SeriesEditor()
public ActionResult Editor()
{
var profiles = _qualityProvider.All();
ViewData["QualityProfiles"] = profiles;
//Create the select lists
var masterProfiles = profiles.ToList();
masterProfiles.Insert(0, new QualityProfile {QualityProfileId = -10, Name = "Unchanged"});
masterProfiles.Insert(0, new QualityProfile {QualityProfileId = -10, Name = "Select..."});
ViewData["MasterProfileSelectList"] = new SelectList(masterProfiles, "QualityProfileId", "Name");
ViewData["BoolSelectList"] = new SelectList(new List<KeyValuePair<int, string>>
{
new KeyValuePair<int, string>(-10, "Unchanged"),
new KeyValuePair<int, string>(-10, "Select..."),
new KeyValuePair<int, string>(1, "True"),
new KeyValuePair<int, string>(0, "False")
}, "Key", "Value"
@ -161,7 +161,7 @@ public ActionResult SeriesEditor()
ViewData["BacklogSettingTypes"] = backlogSettingTypes;
var masterBacklogList = backlogSettingTypes.ToList();
masterBacklogList.Insert(0, new KeyValuePair<int, string>(-10, "Unchanged"));
masterBacklogList.Insert(0, new KeyValuePair<int, string>(-10, "Select..."));
ViewData["MasterBacklogSettingSelectList"] = new SelectList(masterBacklogList, "Key", "Value");
var series = _seriesProvider.GetAllSeries().OrderBy(o => SortHelper.SkipArticles(o.Title));
@ -170,7 +170,7 @@ public ActionResult SeriesEditor()
}
[HttpPost]
public JsonResult SaveSeriesEditor(List<Series> series)
public JsonResult SaveEditor(List<Series> series)
{
//Save edits
if (series == null || series.Count == 0)

View File

@ -8,6 +8,7 @@ public class HistoryModel
public int HistoryId { get; set; }
public int SeriesId { get; set; }
public string SeriesTitle { get; set; }
public string SeriesTitleSorter { get; set; }
public string EpisodeNumbering { get; set; }
public string EpisodeTitle { get; set; }
public string EpisodeOverview { get; set; }

View File

@ -9,6 +9,7 @@ public class MissingEpisodeModel
public int SeriesId { get; set; }
public int EpisodeId { get; set; }
public string SeriesTitle { get; set; }
public string SeriesTitleSorter { get; set; }
public string EpisodeNumbering { get; set; }
public string EpisodeTitle { get; set; }
public string AirDate { get; set; }

View File

@ -479,10 +479,10 @@
<Content Include="Views\Settings\Misc.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\SeriesEditor.cshtml" />
<Content Include="Views\Series\Editor.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\SeriesEditorItem.cshtml" />
<Content Include="Views\Series\EditorItem.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\DownloadClient.cshtml" />

View File

@ -66,7 +66,15 @@
return "<img src='/Content/Images/Indexers/" + row.aData['Indexer'] + ".png' alt=" + row.aData["Indexer"] + ">";
}
}, //Image
{ sWidth: 'auto', "mDataProp": "SeriesTitle" }, //Series Title
{ sWidth: 'auto', "mDataProp": function (source, type, val) {
// 'display' and 'filter' use our fancy naming
if (type === 'display' || type === 'filter') {
return "<a href='/Series/Details?seriesId=" + source["SeriesId"] + "'>" + source["SeriesTitle"] + "</a>";
}
// 'sort' and 'type' both just use the raw data
return source["SeriesTitleSorter"];
}
}, //Series Title
{ sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false }, //EpisodeNumbering
{ sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title
{ sWidth: '70px', "mDataProp": "Quality", "bSortable": false }, //Quality

View File

@ -68,7 +68,15 @@
"iDisplayLength": 20,
"sPaginationType": "four_button",
"aoColumns": [
{ sWidth: 'auto', "mDataProp": "SeriesTitle" }, //Series Title
{ sWidth: 'auto', "mDataProp": function (source, type, val) {
// 'display' and 'filter' use our fancy naming
if (type === 'display' || type === 'filter') {
return "<a href='/Series/Details?seriesId=" + source["SeriesId"] + "'>" + source["SeriesTitle"] + "</a>";
}
// 'sort' and 'type' both just use the raw data
return source["SeriesTitleSorter"];
}
}, //Series Title
{ sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false }, //EpisodeNumbering
{ sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title
{ sWidth: '150px', "mDataProp": function (source, type, val) {

View File

@ -1,6 +1,6 @@
@using NzbDrone.Web.Helpers
@model IEnumerable<NzbDrone.Core.Repository.Series>
@{ViewBag.Title = "NzbDrone";}
@{ViewBag.Title = "Series Editor";}
@section HeaderContent
{
@ -33,10 +33,23 @@
td .backlogSetting {
width: 90px;
}
#stylized, .settingsForm {
overflow: hidden;
}
#stylized {
float: left;
}
#changesOverview {
margin-top: 15px;
float: left;
}
</style>
}
@using (Html.BeginForm("SaveSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" }))
@using (Html.BeginForm("SaveEditor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" }))
{
<table id ="seriesEditorGrid" class="dataTable dataTablesGrid no-details">
<thead>
@ -52,7 +65,7 @@
<tbody>
@foreach (var series in Model)
{
Html.RenderPartial("SeriesEditorItem", series);
Html.RenderPartial("EditorItem", series);
}
</tbody>
</table>
@ -63,26 +76,27 @@
<label class="labelClass">Quality Profile
<span class="small">Which Quality Profile should NzbDrone use to download episodes?</span>
</label>
@Html.DropDownList("masterQualitySelector", (SelectList)ViewData["MasterProfileSelectList"], new { @class = "inputClass" })
@Html.DropDownList("masterQualitySelector", (SelectList)ViewData["MasterProfileSelectList"], new { @class = "inputClass masterSelector", disabled = true })
<label class="labelClass">Monitored
<span class="small">Should NzbDrone download episodes for this series?</span>
</label>
@Html.DropDownList("masterMonitored", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass" })
@Html.DropDownList("masterMonitored", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass masterSelector", disabled = true })
<label class="labelClass">Use Season Folder
<span class="small">Should downloaded episodes be stored in season folders?</span>
</label>
@Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass" })
@Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass masterSelector", disabled = true })
<label class="labelClass">Backlog Status
<span class="small">Should NzbDrone perform backlog searches for this series?</span>
</label>
@Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "inputClass" })
@Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "inputClass masterSelector", disabled = true })
</div>
</div>
<div id="changesOverview" style="border-color: transparent;">
<h1><div id="editingCount"></div></h1>
</div>
</div>
<div class="buttons">
<button id="updateSelected" title="Update the selected series with the settings above">Update Selected</button>
<div class="buttons">
<button type="submit" class="save_button" disabled="disabled" title="Commit the settings from your series above to the database">
Save Changes</button>
</div>
@ -105,14 +119,37 @@
});
});
$('.editToggleMaster').live('change', function () {
$(document).on('change', '.editToggleMaster', function () {
var toggle = $(this).prop('checked');
$('.editToggle').each(function () {
$(this).prop('checked', toggle);
});
});
$('#updateSelected').live('click', function () {
$(document).on('change', '.editToggle, .editToggleMaster', function () {
var selectedCount = $('.editToggle:checked');
if (selectedCount.length > 0) {
$('.masterSelector').each(function () {
$(this).attr("disabled", false);
});
$('#editingCount').text(selectedCount.length + ' series have been selected for editing');
if (selectedCount.length === 1) {
$('#editingCount').text(selectedCount.length + ' series has been selected for editing');
}
}
else {
$('.masterSelector').each(function () {
$(this).attr("disabled", true);
$('#editingCount').text('');
});
}
});
$(document).on('change', '.masterSelector', function () {
//Find selected values
var profileId = $('#masterQualitySelector').val();
var monitored = $('#masterMonitored').val();
@ -146,10 +183,6 @@
$(this).parent('td').parent('.seriesEditRow').find('.backlogSetting').val(backlogStatus);
}
});
});
//Update all checked rows
</script>
}

View File

@ -76,7 +76,7 @@
<ul class="sub-menu">
<li>@Html.ActionLink("Add Series", "Index", "AddSeries")</li>
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null)</li>
<li>@Html.ActionLink("Series Editor", "SeriesEditor", "Series")</li>
<li>@Html.ActionLink("Series Editor", "Editor", "Series")</li>
</ul>
}