mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Added Season Monitored editor (linked from Season Count on Series Grid), It would be under AJAX Edit, but it won't play nice with lists.
Editor should support about 40 seasons without scrolling (TvDb doesn't list all seasons for large series) Removed &pp=3 from SabProvider (it will use SAB's configured Post Processing value).
This commit is contained in:
parent
fa2b609ad3
commit
9caacc4809
@ -61,7 +61,12 @@ public virtual void EnsureSeason(int seriesId, int seasonId, int seasonNumber)
|
||||
|
||||
public virtual int SaveSeason(Season season)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (_repository.Exists<Season>(s => s.SeasonId == season.SeasonId))
|
||||
{
|
||||
return _repository.Update(season);
|
||||
}
|
||||
|
||||
return (int)_repository.Add(season);
|
||||
}
|
||||
|
||||
public virtual bool IsIgnored(int seasonId)
|
||||
|
@ -22,6 +22,7 @@ public class SeriesController : Controller
|
||||
private readonly SeriesProvider _seriesProvider;
|
||||
private readonly TvDbProvider _tvDbProvider;
|
||||
private readonly JobProvider _jobProvider;
|
||||
private readonly SeasonProvider _seasonProvider;
|
||||
//
|
||||
// GET: /Series/
|
||||
|
||||
@ -29,7 +30,8 @@ public SeriesController(SeriesProvider seriesProvider,
|
||||
EpisodeProvider episodeProvider,
|
||||
QualityProvider qualityProvider, MediaFileProvider mediaFileProvider,
|
||||
RenameProvider renameProvider, RootDirProvider rootDirProvider,
|
||||
TvDbProvider tvDbProvider, JobProvider jobProvider)
|
||||
TvDbProvider tvDbProvider, JobProvider jobProvider,
|
||||
SeasonProvider seasonProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
_episodeProvider = episodeProvider;
|
||||
@ -39,6 +41,7 @@ public SeriesController(SeriesProvider seriesProvider,
|
||||
_rootDirProvider = rootDirProvider;
|
||||
_tvDbProvider = tvDbProvider;
|
||||
_jobProvider = jobProvider;
|
||||
_seasonProvider = seasonProvider;
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
@ -64,6 +67,24 @@ public ActionResult LoadEpisodes(int seriesId)
|
||||
});
|
||||
}
|
||||
|
||||
public ActionResult SeasonEditor(int seriesId)
|
||||
{
|
||||
var model =
|
||||
_seriesProvider.GetSeries(seriesId).Seasons.Select(s => new SeasonEditModel
|
||||
{
|
||||
SeasonId = s.SeasonId,
|
||||
SeasonNumber = s.SeasonNumber,
|
||||
SeasonString = GetSeasonString(s.SeasonNumber),
|
||||
Monitored = s.Monitored
|
||||
}).OrderBy(s=> s.SeasonNumber).ToList();
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public ActionResult GetSingleSeasonView(SeasonEditModel model)
|
||||
{
|
||||
return PartialView("SingleSeason", model);
|
||||
}
|
||||
|
||||
[GridAction]
|
||||
public ActionResult _AjaxSeriesGrid()
|
||||
{
|
||||
@ -74,7 +95,7 @@ public ActionResult _AjaxSeriesGrid()
|
||||
|
||||
[AcceptVerbs(HttpVerbs.Post)]
|
||||
[GridAction]
|
||||
public ActionResult _SaveAjaxSeriesEditing(int id, string path, bool monitored, bool seasonFolder, int qualityProfileId)
|
||||
public ActionResult _SaveAjaxSeriesEditing(int id, string path, bool monitored, bool seasonFolder, int qualityProfileId, List<SeasonEditModel> seasons)
|
||||
{
|
||||
var oldSeries = _seriesProvider.GetSeries(id);
|
||||
oldSeries.Path = path;
|
||||
@ -222,6 +243,19 @@ public ActionResult _SaveAjaxEditing(string id)
|
||||
return RedirectToAction("UnMapped");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult SaveSeasons(List<SeasonEditModel> seasons)
|
||||
{
|
||||
foreach (var season in seasons)
|
||||
{
|
||||
var seasonInDb = _seasonProvider.GetSeason(season.SeasonId);
|
||||
seasonInDb.Monitored = season.Monitored;
|
||||
_seasonProvider.SaveSeason(seasonInDb);
|
||||
}
|
||||
|
||||
return Content("Saved");
|
||||
}
|
||||
|
||||
public ActionResult Details(int seriesId)
|
||||
{
|
||||
var series = _seriesProvider.GetSeries(seriesId);
|
||||
@ -301,5 +335,13 @@ private List<SeriesModel> GetSeriesModels(List<Series> seriesInDb)
|
||||
|
||||
return series;
|
||||
}
|
||||
|
||||
private string GetSeasonString(int seasonNumber)
|
||||
{
|
||||
if (seasonNumber == 0)
|
||||
return "Specials";
|
||||
|
||||
return String.Format("Season# {0}", seasonNumber);
|
||||
}
|
||||
}
|
||||
}
|
@ -44,6 +44,16 @@ public SettingsController(ConfigProvider configProvider, IndexerProvider indexer
|
||||
_diskProvider = diskProvider;
|
||||
}
|
||||
|
||||
public ActionResult Test()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult TestPartial()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Index(string viewName)
|
||||
{
|
||||
if (viewName != null)
|
||||
@ -317,29 +327,6 @@ public JsonResult AutoConfigureSab()
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult AutoCompletePath(string path)
|
||||
{
|
||||
var windowsSep = path.LastIndexOf('\\');
|
||||
|
||||
if (windowsSep > -1)
|
||||
{
|
||||
var start = path.Substring(windowsSep + 1);
|
||||
var dirs = _diskProvider.GetDirectories(path.Substring(0, windowsSep + 1)).Where(d => new DirectoryInfo(d).Name.ToLower().StartsWith(start.ToLower()));
|
||||
return Content(String.Join("\n", dirs));
|
||||
}
|
||||
|
||||
var index = path.LastIndexOf('/');
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
var start = path.Substring(index + 1);
|
||||
var dirs = _diskProvider.GetDirectories(path.Substring(0, index + 1)).Where(d => new DirectoryInfo(d).Name.ToLower().StartsWith(start.ToLower()));
|
||||
return Content(String.Join("\n", dirs));
|
||||
}
|
||||
|
||||
return Content("");
|
||||
}
|
||||
|
||||
public JsonResult JsonAutoCompletePath(string term)
|
||||
{
|
||||
var windowsSep = term.LastIndexOf('\\');
|
||||
|
15
NzbDrone.Web/Models/SeasonEditModel.cs
Normal file
15
NzbDrone.Web/Models/SeasonEditModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace NzbDrone.Web.Models
|
||||
{
|
||||
public class SeasonEditModel
|
||||
{
|
||||
public int SeasonId { get; set; }
|
||||
public int SeasonNumber { get; set; }
|
||||
public string SeasonString { get; set; }
|
||||
public bool Monitored { get; set; }
|
||||
}
|
||||
}
|
@ -240,6 +240,7 @@
|
||||
<Compile Include="Models\MissingEpisodeModel.cs" />
|
||||
<Compile Include="Models\NotificationSettingsModel.cs" />
|
||||
<Compile Include="Models\QualityModel.cs" />
|
||||
<Compile Include="Models\SeasonEditModel.cs" />
|
||||
<Compile Include="Models\SeriesModel.cs" />
|
||||
<Compile Include="Models\SeriesSearchResultModel.cs" />
|
||||
<Compile Include="Models\SettingsModels.cs" />
|
||||
@ -573,7 +574,6 @@
|
||||
<Content Include="Content\Images\Indexers\NzbsOrg.png" />
|
||||
<Content Include="Content\Images\Indexers\NzbsRus.png" />
|
||||
<Content Include="Content\Images\Indexers\Unknown.png" />
|
||||
<Content Include="Content\Images\indicator.gif" />
|
||||
<Content Include="Content\Images\Plus.png" />
|
||||
<Content Include="Content\Images\spin.gif" />
|
||||
<Content Include="Content\Images\ui-bg_diagonals-small_0_aaaaaa_40x40.png" />
|
||||
@ -597,7 +597,6 @@
|
||||
<Content Include="Content\jquery-ui-1.8.8.custom.css" />
|
||||
<Content Include="Content\jquery-ui.css" />
|
||||
<Content Include="Content\jquery-ui.custom.css" />
|
||||
<Content Include="Content\jquery.autocomplete.css" />
|
||||
<Content Include="Content\jquery.jgrowl.css" />
|
||||
<Content Include="Content\notibar.css" />
|
||||
<Content Include="Content\style.css" />
|
||||
@ -639,7 +638,6 @@
|
||||
<Content Include="Scripts\jquery-1.5.2.min.js" />
|
||||
<Content Include="Scripts\jquery-ui-1.8.8.min.js" />
|
||||
<Content Include="Scripts\jquery-ui-1.8.5.custom.min.js" />
|
||||
<Content Include="Scripts\jquery.autocomplete.js" />
|
||||
<Content Include="Scripts\jquery.form.js" />
|
||||
<Content Include="Scripts\jquery.jgrowl.js" />
|
||||
<Content Include="Scripts\jquery-tgc-countdown-1.0.js" />
|
||||
@ -841,6 +839,18 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Series\EditorTemplates\SeriesModel.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Settings\Test.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Settings\TestPartial.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Series\SeasonEditor.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Series\SingleSeason.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -1,4 +1,5 @@
|
||||
@using NzbDrone.Web.Helpers;
|
||||
@using NzbDrone.Web.Models;
|
||||
@model NzbDrone.Web.Models.SeriesModel
|
||||
|
||||
@{
|
||||
|
@ -25,7 +25,8 @@
|
||||
.ClientTemplate("<a href=" +
|
||||
Url.Action("Details", "Series", new {seriesId = "<#= SeriesId #>"}) +
|
||||
"><#= Title #></a>");
|
||||
columns.Bound(o => o.SeasonsCount).Title("Seasons");
|
||||
columns.Bound(o => o.SeasonsCount).Title("Seasons")
|
||||
.ClientTemplate("<a href=# onclick=\"openSeasonEditor(<#= SeriesId #>, \'<#= Title #>\'); return false;\"><#= SeasonsCount #></a>");
|
||||
columns.Bound(o => o.QualityProfileName).Title("Quality");
|
||||
columns.Bound(o => o.Status);
|
||||
columns.Bound(o => o.AirsDayOfWeek);
|
||||
@ -45,10 +46,34 @@
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
var windowElement;
|
||||
|
||||
function grid_edit(args) {
|
||||
$(args.form)
|
||||
.closest(".t-window")
|
||||
.data("tWindow")
|
||||
.center();
|
||||
}
|
||||
|
||||
function openSeasonEditor(seriesId, seriesName) {
|
||||
windowElement = null;
|
||||
windowElement = $.telerik.window.create({
|
||||
title: "<b>Season Editor: " + seriesName + "</b>",
|
||||
contentUrl: '@Url.Action("SeasonEditor", "Series")' + '/?seriesId=' + seriesId,
|
||||
width: 360,
|
||||
height: 400,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
scrollable: true
|
||||
});
|
||||
|
||||
windowElement.data('tWindow').center();
|
||||
}
|
||||
|
||||
function closeSeasonEditor() {
|
||||
$('#form').remove();
|
||||
var window = windowElement.data("tWindow");
|
||||
window.close();
|
||||
}
|
||||
</script>
|
47
NzbDrone.Web/Views/Series/SeasonEditor.cshtml
Normal file
47
NzbDrone.Web/Views/Series/SeasonEditor.cshtml
Normal file
@ -0,0 +1,47 @@
|
||||
@using NzbDrone.Web.Models;
|
||||
@model List<SeasonEditModel>
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<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);
|
||||
closeSeasonEditor();
|
||||
}
|
||||
</script>
|
||||
|
||||
@using (Html.BeginForm("SaveSeasons", "Series", FormMethod.Post, new { id = "form" }))
|
||||
{
|
||||
<div style="vertical-align: middle">
|
||||
@foreach (var season in Model)
|
||||
{
|
||||
Html.RenderAction("GetSingleSeasonView", "Series", season);
|
||||
}
|
||||
</div>
|
||||
|
||||
<div id="buttons" style="padding-top: 20px; position: absolute; bottom: 5;">
|
||||
<button type="submit" class="t-button t-state-default">Save</button>
|
||||
<button type="button" class="t-button t-state-default" onclick="closeSeasonEditor()">Cancel</button>
|
||||
</div>
|
||||
}
|
||||
<div id="result"></div>
|
15
NzbDrone.Web/Views/Series/SingleSeason.cshtml
Normal file
15
NzbDrone.Web/Views/Series/SingleSeason.cshtml
Normal file
@ -0,0 +1,15 @@
|
||||
@using NzbDrone.Web.Helpers;
|
||||
@using NzbDrone.Web.Models;
|
||||
@model SeasonEditModel
|
||||
|
||||
@using (Html.BeginCollectionItem("seasons"))
|
||||
{
|
||||
<fieldset style="display: inline; border-color: lightgrey; width: 26%; margin-bottom: 2px; padding-bottom: 1px; padding-top: 1px;">
|
||||
@Html.DisplayFor(m => m.SeasonString)
|
||||
<span style="float: right;">@Html.CheckBoxFor(m => m.Monitored)</span>
|
||||
|
||||
@Html.HiddenFor(m => m.SeasonId)
|
||||
@Html.HiddenFor(m => m.SeasonNumber)
|
||||
</fieldset>
|
||||
}
|
||||
|
106
NzbDrone.Web/Views/Settings/Test.cshtml
Normal file
106
NzbDrone.Web/Views/Settings/Test.cshtml
Normal file
@ -0,0 +1,106 @@
|
||||
<style type="text/css">
|
||||
|
||||
#feedback-open-button
|
||||
{
|
||||
height: 32px;
|
||||
margin: 2em 0 4em;
|
||||
}
|
||||
|
||||
#feedback-form
|
||||
{
|
||||
padding: 0 1em 1em;
|
||||
}
|
||||
|
||||
#feedback-form label
|
||||
{
|
||||
display: block;
|
||||
line-height: 25px;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
#feedback-form input
|
||||
{
|
||||
width: 370px;
|
||||
}
|
||||
|
||||
.form-actions
|
||||
{
|
||||
padding-top: 1em;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.form-actions button
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
|
||||
.example .t-group
|
||||
{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
padding: 0 1em 1em;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@{ Html.Telerik().Window()
|
||||
.Name("Window")
|
||||
.Title("Submit feedback")
|
||||
.LoadContentFrom("TestPartial", "Settings")
|
||||
.Width(400)
|
||||
.Draggable(true)
|
||||
.Modal(true)
|
||||
.Visible(false)
|
||||
.Render();
|
||||
}
|
||||
|
||||
<button id="feedback-open-button" class="t-button t-state-default">Submit feedback...</button>
|
||||
@if (ViewData["name"] != null || ViewData["email"] != null || ViewData["comment"] != null) {
|
||||
<div class="t-group">
|
||||
<h3>Feedback:</h3>
|
||||
|
||||
<p>
|
||||
Name: @ViewData["name"] <br />
|
||||
E-mail: @ViewData["email"] <br />
|
||||
Comment: @ViewData["comment"]
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
@{ Html.Telerik().ScriptRegistrar()
|
||||
.OnDocumentReady(@<text>
|
||||
// open the initially hidden window when the button is clicked
|
||||
|
||||
</text>); }
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var windowElement;
|
||||
|
||||
$('#feedback-open-button')
|
||||
.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
windowElement = $.telerik.window.create({
|
||||
title: "Season Edition: ",
|
||||
contentUrl: '@Url.Action("SeasonEditor", "Series")' + '/?seriesId=10',
|
||||
width: 400,
|
||||
height: 500,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
scrollable: false
|
||||
});
|
||||
|
||||
windowElement.data('tWindow').center();
|
||||
});
|
||||
// add button hovers
|
||||
$('.t-button').live('mouseenter', $.telerik.buttonHover)
|
||||
.live('mouseleave', $.telerik.buttonLeave);
|
||||
|
||||
function closeWindow() {
|
||||
var window = windowElement.data("tWindow");
|
||||
window.close();
|
||||
}
|
||||
</script>
|
24
NzbDrone.Web/Views/Settings/TestPartial.cshtml
Normal file
24
NzbDrone.Web/Views/Settings/TestPartial.cshtml
Normal file
@ -0,0 +1,24 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
|
||||
@using (Html.BeginForm("SaveDownloads", "Settings", FormMethod.Post, new { id = "feedback-form" }))
|
||||
{
|
||||
<p class="note">This is just an example, sent data will <strong>not</strong> be saved.</p>
|
||||
<label for="name">Name:</label>
|
||||
@Html.TextBox("name")
|
||||
<label for="email">E-mail:</label>
|
||||
@Html.TextBox("email")
|
||||
<label for="comment-value">Comments:</label>
|
||||
@(Html.Telerik().Editor()
|
||||
.Name("comment")
|
||||
.Tools(tools => tools
|
||||
.Clear()
|
||||
.Bold().Italic().Separator()
|
||||
.InsertOrderedList().InsertUnorderedList().Separator()
|
||||
.Indent().Outdent()
|
||||
))
|
||||
<button type="submit" class="t-button t-state-default">Save</button>
|
||||
<button type="button" class="t-button t-state-default" onclick="closeWindow()">Close</button>
|
||||
}
|
Loading…
Reference in New Issue
Block a user