EpisodeAiredAfter added to edit/editor

This commit is contained in:
Mark McDowall 2012-09-19 00:07:19 -07:00
parent 6c78187601
commit 3061219367
13 changed files with 78 additions and 49 deletions

View File

@ -232,6 +232,7 @@ namespace NzbDrone.Core.Providers
series.SeasonFolder = edited.SeasonFolder;
series.BacklogSetting = edited.BacklogSetting;
series.Path = edited.Path;
series.DownloadEpisodesAiredAfter = edited.DownloadEpisodesAiredAfter;
}
_database.UpdateMany(allSeries);

View File

@ -4,7 +4,7 @@
}
.checkboxColumn {
width: 110px;
width: 50px;
text-align: center;
}
@ -13,7 +13,7 @@
text-align: center;
}
table input[type="text"], table select {
table input[type="text"], table input[type="date"], table select {
margin: 2px 2px;
}
@ -37,6 +37,19 @@ th .footer-control-quality {
width: 120px;
}
td .aired-after {
width: 80px;
}
th .footer-control-boolean {
width: 90px;
}
th .footer-control-aired-after {
width: 80px;
}
#stylized, .settingsForm {
overflow: hidden;
}

View File

@ -1,5 +1,4 @@
p, h1, form, button
{
p, h1, form, button {
border: 0;
margin: 0;
padding: 0;
@ -9,21 +8,18 @@
display: none;
}
.spacer
{
.spacer {
clear: both;
height: 1px;
}
.settingsForm
{
.settingsForm {
width: 620px;
padding: 14px;
}
#stylized p
{
#stylized p {
font-size: 11px;
color: #666666;
margin-bottom: 20px;
@ -31,8 +27,7 @@
padding-bottom: 10px;
}
#stylized .labelClass
{
#stylized .labelClass {
display: block;
font-weight: bold;
text-align: right;
@ -41,8 +36,7 @@
margin-bottom: -10px;
}
#stylized .small
{
#stylized .small {
color: #666666;
display: block;
font-size: 11px;
@ -51,8 +45,7 @@
width: 340px;
}
#stylized .inputClass
{
#stylized .inputClass {
float: left;
padding: 2px 2px;
border: solid 1px #aacfe4;
@ -60,19 +53,16 @@
margin: 4px 0 20px 10px;
}
#stylized .selectClass
{
#stylized .selectClass {
width: 206px;
}
#stylized .checkClass
{
#stylized .checkClass {
margin: 12px 0px 20px 10px;
border: none;
}
#stylized button
{
#stylized button {
clear: both;
margin-left: 220px;
margin-bottom: 10px;
@ -85,8 +75,7 @@
}
#saveAjax
{
#saveAjax {
padding-left: 6px;
margin-bottom: -7px;
width: 20px;
@ -94,24 +83,21 @@
display: none;
}
#save_button[disabled="disabled"]
{
#save_button[disabled="disabled"] {
padding: 0px 6px 0px 6px;
border: 2px outset ButtonFace;
color: lightgrey;
cursor: progress;
}
.ui-dialog-buttonset .ui-delete-button
{
.ui-dialog-buttonset .ui-delete-button {
background: url("jQueryUI/images/ui-bg_flat_30_b40404_40x100.png") repeat-x scroll 50% 50% #B40404;
border: 1px solid #FFFFFF;
color: #FFFFFF;
font-weight: normal;
}
.ui-dialog-buttonset .ui-delete-button:active
{
.ui-dialog-buttonset .ui-delete-button:active {
background: url("jQueryUI/images/ui-bg_flat_30_616161_40x100.png") repeat-x scroll 50% 50% #616161;
border: 1px solid #FFFFFF;
color: #FFFFFF;

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web.Mvc;
@ -44,7 +45,7 @@ namespace NzbDrone.Web.Controllers
return View((object)serialized);
}
public ActionResult SingleSeriesEditor(int seriesId)
public ActionResult Edit(int seriesId)
{
var profiles = _qualityProvider.All();
ViewData["SelectList"] = new SelectList(profiles, "QualityProfileId", "Name");
@ -63,7 +64,7 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public EmptyResult SaveSingleSeriesEditor(SeriesModel seriesModel)
public EmptyResult Edit(SeriesModel seriesModel)
{
var series = _seriesProvider.GetSeries(seriesModel.SeriesId);
series.Monitored = seriesModel.Monitored;
@ -72,6 +73,9 @@ namespace NzbDrone.Web.Controllers
series.Path = seriesModel.Path;
series.BacklogSetting = (BacklogSettingType)seriesModel.BacklogSetting;
if (!String.IsNullOrWhiteSpace(seriesModel.DownloadEpisodesAiredAfter))
series.DownloadEpisodesAiredAfter = DateTime.Parse(seriesModel.DownloadEpisodesAiredAfter, null, DateTimeStyles.RoundtripKind);
_seriesProvider.UpdateSeries(series);
return new EmptyResult();
@ -172,7 +176,7 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public JsonResult SaveEditor(List<Series> series)
public JsonResult Editor(List<Series> series)
{
//Save edits
if (series == null || series.Count == 0)
@ -204,7 +208,8 @@ namespace NzbDrone.Web.Controllers
EpisodeFileCount = s.EpisodeFileCount,
NextAiring = s.NextAiring == null ? String.Empty : s.NextAiring.Value.ToBestDateString(),
NextAiringSorter = s.NextAiring == null ? "12/31/9999" : s.NextAiring.Value.ToString("MM/dd/yyyy"),
AirTime = s.AirTimes
AirTime = s.AirTimes,
DownloadEpisodesAiredAfter = s.DownloadEpisodesAiredAfter.HasValue ? s.DownloadEpisodesAiredAfter.Value.ToString("yyyy-MM-dd") : String.Empty
}).ToList();
return series;

View File

@ -28,7 +28,7 @@ namespace NzbDrone.Web.Models
public string Details { get; set; }
public string Network { get; set; }
public string AirTime { get; set; }
public IList<int> Seasons { get; set; }
//View & Edit
@ -52,5 +52,9 @@ namespace NzbDrone.Web.Models
[DisplayName("Backlog Setting")]
[Description("Should NzbDrone search for missing episodes every 30 days?")]
public int BacklogSetting { get; set; }
[DisplayName("Download Episodes Aired After")]
[Description("Should NzbDrone only download episodes a certain date?")]
public string DownloadEpisodesAiredAfter { get; set; }
}
}

View File

@ -534,7 +534,7 @@
<Content Include="Views\Series\Details.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\SingleSeriesEditor.cshtml" />
<Content Include="Views\Series\Edit.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Upcoming\UpcomingEpisode.cshtml" />

View File

@ -45,7 +45,7 @@
});
});
$('.jQuery-dateTime').livequery(function () {
$('.jQuery-datepicker').livequery(function () {
$(this).datepicker({
dateFormat: "yy-mm-dd"
});

View File

@ -1,5 +1,5 @@
var seriesEditorUrl = '../Series/SingleSeriesEditor';
var saveSeriesEditorUrl = '../Series/SaveSingleSeriesEditor';
var seriesEditorUrl = '../Series/Edit';
var saveSeriesEditorUrl = '../Series/Edit';
var seriesDeleteUrl = '../Series/DeleteSeries';
$("#seriesEditor").dialog({

View File

@ -7,7 +7,7 @@
</div>
@Html.DropDownList("newSeriesPath", new SelectList((IList)ViewData["RootDirs"]), new { style = "width: 406px; margin-left: 0px;" })
@Html.DropDownList("qualityList", (SelectList)ViewData["QualityProfiles"], new { @class = "qualitySelector" })
@Html.TextBox("newAiredAfter", "", new { type = "date", @class = "jQuery-dateTime aired-after", title = "Only download episodes that aired after the choosen date" })
@Html.TextBox("newAiredAfter", "", new { type = "date", @class = "jQuery-datepicker aired-after", title = "Only download episodes that aired after the choosen date" })
<button id="saveNewSeries">
Add</button>
</div>

View File

@ -23,7 +23,7 @@ else
{
@Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector masterQualitySelector" })
@Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-dateTime aired-after-master", title = "Skip episodes that aired before the choosen date" })
@Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-datepicker aired-after-master", title = "Skip episodes that aired before the choosen date" })
foreach (var series in Model.ExistingSeries)
{
@ -35,7 +35,7 @@ else
<input class="seriesLookup" type="text" style="width: 400px;" value="@series.Item2" placeholder="Series Title" />
@Html.Hidden("seriesId", series.Item3, new { @class = "seriesId" })
@Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector" })
@Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-dateTime aired-after", title = "Only download episodes that aired after the choosen date" })
@Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-datepicker aired-after", title = "Only download episodes that aired after the choosen date" })
<button class="addExistingButton">
Add</button>
</div>

View File

@ -12,7 +12,7 @@
</style>
<div id="stylized" style="border-color: transparent;">
@using (Html.BeginForm("SaveSingleSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditorForm", name = "SeriesEditorForm", @class = "settingsForm" }))
@using (Html.BeginForm("Edit", "Series", FormMethod.Post, new { id = "SeriesEditorForm", name = "SeriesEditorForm", @class = "settingsForm" }))
{
@Html.HiddenFor(m => m.SeriesId)
@Html.HiddenFor(m => m.Status)
@ -36,5 +36,10 @@
<span class="small">@Html.DescriptionFor(m => m.BacklogSetting)</span>
</label>
@Html.DropDownListFor(m => m.BacklogSetting, (SelectList)ViewData["BacklogSettingSelectList"], new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.DownloadEpisodesAiredAfter)
<span class="small">@Html.DescriptionFor(m => m.DownloadEpisodesAiredAfter)</span>
</label>
@Html.TextBoxFor(m => m.DownloadEpisodesAiredAfter, new { type = "date", @class = "inputClass jQuery-datepicker" })
}
</div>

View File

@ -16,7 +16,7 @@
</ul>
}
@using (Html.BeginForm("SaveEditor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" }))
@using (Html.BeginForm("Editor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" }))
{
<table id="seriesEditorGrid" class="dataTable dataTablesGrid no-details">
<thead>
@ -24,9 +24,10 @@
<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="90px">Monitored</th>
<th width="110px">Season Folder</th>
<th width="110px">Backlog Status</th>
<th width="80px">Aired After</th>
<th width="310px">Path</th>
</tr>
</thead>
@ -46,14 +47,17 @@
@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 })
@Html.DropDownList("masterMonitored", (SelectList)ViewData["BoolSelectList"], new { @class = "footer-control-boolean masterSelector master-monitored", disabled = true })
</th>
<th>
@Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "footer-control masterSelector master-season-folder", disabled = true })
@Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "footer-control-boolean 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>
@Html.TextBox("masterAiredAfter", "" , new { type = "date", @class = "footer-control-aired-after masterSelector master-aired-after jQuery-datepicker", 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
@ -180,6 +184,16 @@
});
});
$(document).on('change', '#masterAiredAfter', function () {
var airedAfter = $(this).val();
var selected = $('.editToggle:checked');
selected.each(function () {
$(this).parent('td').parent('.seriesEditRow').find('.aired-after').val(airedAfter);
});
});
$(document).on('click', '#series-editor-save', function () {
$('#SeriesEditor').submit();
});

View File

@ -21,6 +21,7 @@
<td class="checkboxColumn">@Html.CheckBoxFor(m => m.Monitored, new {@class = "seriesCheckbox monitored"})</td>
<td class="checkboxColumn">@Html.CheckBoxFor(m => m.SeasonFolder, new {@class = "seriesCheckbox seasonFolder"})</td>
<td>@Html.DropDownListFor(m => m.BacklogSetting, new SelectList((List<KeyValuePair<int, string>>)ViewData["BacklogSettingTypes"], "Key", "Value", (int)Model.BacklogSetting), new { @class = "backlogSetting" })</td>
<td>@Html.TextBoxFor(m => m.DownloadEpisodesAiredAfter, new { type = "date", @class = "aired-after jQuery-datepicker" })</td>
<td>@Html.TextBoxFor(m => m.Path, new { @class = "path" })</td>
}
</tr>