Mass edit is now Series Editor.

Renamed Opps to Oops.
Fixed broken SeriesEditor.
This commit is contained in:
Mark McDowall 2012-02-23 14:31:50 -08:00
parent eddafaca93
commit 0ff60bde92
15 changed files with 225 additions and 224 deletions

View File

@ -768,7 +768,7 @@ namespace NzbDrone.Core.Test.ProviderTests
fakeSeries[0].SeasonFolder = newSeasonFolder;
//Act
Mocker.Resolve<SeriesProvider>().UpdateFromMassEdit(fakeSeries);
Mocker.Resolve<SeriesProvider>().UpdateFromSeriesEditor(fakeSeries);
//Assert
var result = Db.Fetch<Series>();
@ -805,7 +805,7 @@ namespace NzbDrone.Core.Test.ProviderTests
fakeSeries[0].SeasonFolder = newSeasonFolder;
//Act
Mocker.Resolve<SeriesProvider>().UpdateFromMassEdit(fakeSeries);
Mocker.Resolve<SeriesProvider>().UpdateFromSeriesEditor(fakeSeries);
//Assert
var result = Db.Fetch<Series>();

View File

@ -204,7 +204,7 @@ namespace NzbDrone.Core.Providers
return series;
}
public virtual void UpdateFromMassEdit(IList<Series> editedSeries)
public virtual void UpdateFromSeriesEditor(IList<Series> editedSeries)
{
var allSeries = GetAllSeries();

View File

@ -72,7 +72,7 @@ namespace NzbDrone.Web.Controllers
if (_smtpProvider.SendTestEmail(server, port, ssl, username, password, fromAddress, toAddresses))
JsonNotificationResult.Info("Successfull", "Test email sent.");
return JsonNotificationResult.Opps("Couldn't send Email, please check your settings");
return JsonNotificationResult.Oops("Couldn't send Email, please check your settings");
}
public JsonResult GetTwitterAuthorization()
@ -80,7 +80,7 @@ namespace NzbDrone.Web.Controllers
var result = _twitterProvider.GetAuthorization();
if (result == null)
JsonNotificationResult.Opps("Couldn't get Twitter Authorization");
JsonNotificationResult.Oops("Couldn't get Twitter Authorization");
return new JsonResult { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
@ -90,7 +90,7 @@ namespace NzbDrone.Web.Controllers
var result = _twitterProvider.GetAndSaveAccessToken(token, verifier);
if (!result)
JsonNotificationResult.Opps("Couldn't verify Twitter Authorization");
JsonNotificationResult.Oops("Couldn't verify Twitter Authorization");
return JsonNotificationResult.Info("Good News!", "Successfully verified Twitter Authorization.");
@ -111,7 +111,7 @@ namespace NzbDrone.Web.Controllers
}
catch(Exception ex)
{
return JsonNotificationResult.Opps("Couldn't register and test Growl");
return JsonNotificationResult.Oops("Couldn't register and test Growl");
}
}

View File

@ -47,7 +47,7 @@ namespace NzbDrone.Web.Controllers
return View((object)serialized);
}
public ActionResult SeriesEditor(int seriesId)
public ActionResult SingleSeriesEditor(int seriesId)
{
var profiles = _qualityProvider.All();
ViewData["SelectList"] = new SelectList(profiles, "QualityProfileId", "Name");
@ -66,7 +66,7 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public EmptyResult SaveSeriesEditor(SeriesModel seriesModel)
public EmptyResult SaveSingleSeriesEditor(SeriesModel seriesModel)
{
var series = _seriesProvider.GetSeries(seriesModel.SeriesId);
series.Monitored = seriesModel.Monitored;
@ -133,7 +133,7 @@ namespace NzbDrone.Web.Controllers
return View(model);
}
public ActionResult MassEdit()
public ActionResult SeriesEditor()
{
var profiles = _qualityProvider.All();
ViewData["QualityProfiles"] = profiles;
@ -170,13 +170,13 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public JsonResult SaveMassEdit(List<Series> series)
public JsonResult SaveSeriesEditor(List<Series> series)
{
//Save edits
if (series == null || series.Count == 0)
return JsonNotificationResult.Opps("Invalid post data");
return JsonNotificationResult.Oops("Invalid post data");
_seriesProvider.UpdateFromMassEdit(series);
_seriesProvider.UpdateFromSeriesEditor(series);
return JsonNotificationResult.Info("Series Mass Edit Saved");
}

View File

@ -279,7 +279,7 @@ namespace NzbDrone.Web.Controllers
public JsonResult DeleteQualityProfile(int profileId)
{
if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0)
return JsonNotificationResult.Opps("Profile is still in use.");
return JsonNotificationResult.Oops("Profile is still in use.");
_qualityProvider.Delete(profileId);
@ -410,7 +410,7 @@ namespace NzbDrone.Web.Controllers
return GetSuccessResult();
}
return JsonNotificationResult.Opps("Invalid Data");
return JsonNotificationResult.Oops("Invalid Data");
}
[HttpPost]
@ -613,7 +613,7 @@ namespace NzbDrone.Web.Controllers
private JsonResult GetInvalidModelResult()
{
return JsonNotificationResult.Opps("Invalid post data");
return JsonNotificationResult.Oops("Invalid post data");
}
private SelectList GetProwlPrioritySelectList()

View File

@ -163,7 +163,7 @@ namespace NzbDrone.Web.Controllers
public JsonResult RunJob(string typeName)
{
if (!_jobProvider.QueueJob(typeName))
return JsonNotificationResult.Opps("Invalid Job Name");
return JsonNotificationResult.Oops("Invalid Job Name");
return JsonNotificationResult.Info("Job Queued");
}

View File

@ -11,7 +11,7 @@ namespace NzbDrone.Web.Filters
public void OnException(ExceptionContext filterContext)
{
filterContext.Result = JsonNotificationResult.Opps(filterContext.Exception.Message);
filterContext.Result = JsonNotificationResult.Oops(filterContext.Exception.Message);
filterContext.ExceptionHandled = true;
logger.FatalException(filterContext.RequestContext.HttpContext.Request.RawUrl, filterContext.Exception);
}

View File

@ -29,9 +29,9 @@ namespace NzbDrone.Web.Models
return GetJsonResult(NotificationType.Error, title, text);
}
public static JsonResult Opps(string text)
public static JsonResult Oops(string text)
{
return GetJsonResult(NotificationType.Error, "Opps!", text);
return GetJsonResult(NotificationType.Error, "Oops!", text);
}

View File

@ -472,10 +472,10 @@
<Content Include="Views\Settings\Misc.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\MassEdit.cshtml" />
<Content Include="Views\Series\SeriesEditor.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\SeriesItem.cshtml" />
<Content Include="Views\Series\SeriesEditorItem.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\DownloadClient.cshtml" />
@ -493,7 +493,7 @@
<Content Include="Views\Series\Details.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\SeriesEditor.cshtml" />
<Content Include="Views\Series\SingleSeriesEditor.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Upcoming\UpcomingEpisode.cshtml" />

View File

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

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("Mass Edit", "MassEdit", "Series")</li>
<li>@Html.ActionLink("Series Editor", "SeriesEditor", "Series")</li>
</ul>
}

View File

@ -1,155 +0,0 @@
@using NzbDrone.Web.Helpers
@model IEnumerable<NzbDrone.Core.Repository.Series>
@{ViewBag.Title = "NzbDrone";}
@section HeaderContent
{
@Html.IncludeCss("Settings.css")
<style>
.checkboxColumn {
width: 95px;
text-align: center;
}
.masterControls {
margin-top: 10px;
overflow: hidden;
}
.buttons {
width: 600px;
text-align: center;
}
table input[type="text"], table select {
margin: 2px 2px;
}
td .path {
width: 300px;
}
td .backlogSetting {
width: 90px;
}
</style>
}
@using (Html.BeginForm("SaveMassEdit", "Series", FormMethod.Post, new { id = "MassEdit", name = "MassEdit" }))
{
<table class="dataTable dataTablesGrid no-details">
<thead>
<th width="14px">@Html.CheckBox("editToggleMaster", false, new { @class = "editToggleMaster" })</th>
<th>Title</th>
<th width="210px">Quality</th>
<th class="checkboxColumn">Monitored</th>
<th class="checkboxColumn">Season Folder</th>
<th width="100px">Backlog Status</th>
<th width="310px">Path</th>
</thead>
<tbody>
@foreach (var series in Model)
{
Html.RenderPartial("SeriesItem", series);
}
</tbody>
</table>
<div class="masterControls">
<div id="stylized" style="border-color: transparent;">
<div class="settingsForm">
<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" })
<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" })
<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" })
<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" })
</div>
</div>
</div>
<div class="buttons">
<button id="updateSelected" title="Update the selected series with the settings above">Update Selected</button>
<button type="submit" class="save_button" disabled="disabled" title="Commit the settings from your series above to the database">
Save Changes</button>
</div>
}
@section Scripts
{
<script type="text/javascript">
$(document).ready(function() {
$('#missingGrid').removeClass('hidden-grid');
oTable = $('.dataTablesGrid').dataTable({
"bShowAll": false,
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false
});
});
$('.editToggleMaster').live('change', function () {
var toggle = $(this).prop('checked');
$('.editToggle').each(function () {
$(this).prop('checked', toggle);
});
});
$('#updateSelected').live('click', function () {
//Find selected values
var profileId = $('#masterQualitySelector').val();
var monitored = $('#masterMonitored').val();
var seasonFolder = $('#masterSeasonFolder').val();
var backlogStatus = $('#masterBacklogSetting').val();
var selected = $('.editToggle:checked');
selected.each(function() {
if (profileId != -10) {
$(this).parent('td').parent('.seriesEditRow').find('.quality').val(profileId);
}
if (monitored != -10) {
var monitoredBool = true;
if (monitored != 1)
monitoredBool = false;
$(this).parent('td').parent('.seriesEditRow').find('.monitored').prop('checked', monitoredBool);
}
if (seasonFolder != -10) {
var seasonFolderBool = true;
if (seasonFolder != 1)
seasonFolderBool = false;
$(this).parent('td').parent('.seriesEditRow').find('.seasonFolder').prop('checked', seasonFolderBool);
}
if (backlogStatus != -10) {
$(this).parent('td').parent('.seriesEditRow').find('.backlogSetting').val(backlogStatus);
}
});
});
//Update all checked rows
</script>
}

View File

@ -1,40 +1,155 @@
@using NzbDrone.Web.Helpers;
@model NzbDrone.Web.Models.SeriesModel
@{
Layout = null;
}
@using NzbDrone.Web.Helpers
@model IEnumerable<NzbDrone.Core.Repository.Series>
@{ViewBag.Title = "NzbDrone";}
@section HeaderContent
{
@Html.IncludeCss("Settings.css")
<style>
.settingsForm
{
overflow: auto;
.checkboxColumn {
width: 95px;
text-align: center;
}
.masterControls {
margin-top: 10px;
overflow: hidden;
}
.buttons {
width: 600px;
text-align: center;
}
table input[type="text"], table select {
margin: 2px 2px;
}
td .path {
width: 300px;
}
td .backlogSetting {
width: 90px;
}
</style>
<div id="stylized" style="border-color: transparent;">
@using (Html.BeginForm("SaveSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditorForm", name = "SeriesEditorForm", @class = "settingsForm" }))
{
@Html.HiddenFor(m => m.SeriesId)
@Html.HiddenFor(m => m.Status)
<label class="labelClass">@Html.LabelFor(m => m.Monitored)
<span class="small">@Html.DescriptionFor(m => m.Monitored)</span>
</label>
@Html.CheckBoxFor(m => m.Monitored, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.SeasonFolder)
<span class="small">@Html.DescriptionFor(m => m.SeasonFolder)</span>
</label>
@Html.CheckBoxFor(m => m.SeasonFolder, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.QualityProfileId)
<span class="small">@Html.DescriptionFor(m => m.QualityProfileId)</span>
</label>
@Html.DropDownListFor(m => m.QualityProfileId, (SelectList)ViewData["SelectList"], new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.Path)
<span class="small">@Html.DescriptionFor(m => m.Path)</span>
</label>
@Html.TextBoxFor(m => m.Path, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.BacklogSetting)
<span class="small">@Html.DescriptionFor(m => m.BacklogSetting)</span>
</label>
@Html.DropDownListFor(m => m.BacklogSetting, (SelectList)ViewData["BacklogSettingSelectList"], new { @class = "inputClass" })
}
@using (Html.BeginForm("SaveSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" }))
{
<table id ="seriesEditorGrid" class="dataTable dataTablesGrid no-details">
<thead>
<th width="14px">@Html.CheckBox("editToggleMaster", false, new { @class = "editToggleMaster" })</th>
<th>Title</th>
<th width="210px">Quality</th>
<th class="checkboxColumn">Monitored</th>
<th class="checkboxColumn">Season Folder</th>
<th width="100px">Backlog Status</th>
<th width="310px">Path</th>
</thead>
<tbody>
@foreach (var series in Model)
{
Html.RenderPartial("SeriesEditorItem", series);
}
</tbody>
</table>
<div class="masterControls">
<div id="stylized" style="border-color: transparent;">
<div class="settingsForm">
<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" })
<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" })
<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" })
<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" })
</div>
</div>
</div>
<div class="buttons">
<button id="updateSelected" title="Update the selected series with the settings above">Update Selected</button>
<button type="submit" class="save_button" disabled="disabled" title="Commit the settings from your series above to the database">
Save Changes</button>
</div>
}
@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
});
});
$('.editToggleMaster').live('change', function () {
var toggle = $(this).prop('checked');
$('.editToggle').each(function () {
$(this).prop('checked', toggle);
});
});
$('#updateSelected').live('click', function () {
//Find selected values
var profileId = $('#masterQualitySelector').val();
var monitored = $('#masterMonitored').val();
var seasonFolder = $('#masterSeasonFolder').val();
var backlogStatus = $('#masterBacklogSetting').val();
var selected = $('.editToggle:checked');
selected.each(function() {
if (profileId != -10) {
$(this).parent('td').parent('.seriesEditRow').find('.quality').val(profileId);
}
if (monitored != -10) {
var monitoredBool = true;
if (monitored != 1)
monitoredBool = false;
$(this).parent('td').parent('.seriesEditRow').find('.monitored').prop('checked', monitoredBool);
}
if (seasonFolder != -10) {
var seasonFolderBool = true;
if (seasonFolder != 1)
seasonFolderBool = false;
$(this).parent('td').parent('.seriesEditRow').find('.seasonFolder').prop('checked', seasonFolderBool);
}
if (backlogStatus != -10) {
$(this).parent('td').parent('.seriesEditRow').find('.backlogSetting').val(backlogStatus);
}
});
});
//Update all checked rows
</script>
}

View File

@ -9,10 +9,11 @@
@*SeriesId, Title, Quality, Monitored, Use Season Folder, Root Directory/Path*, Backlog Toggle*@
<tr class="seriesEditRow">
@using (Html.BeginCollectionItem("series"))
{
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
<tr class="seriesEditRow">
@Html.HiddenFor(m => m.SeriesId)
<td>@Html.CheckBox("editToggle", false, new {@class = "editToggle"})</td>
<td>@Model.Title</td>
@ -21,5 +22,5 @@
<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.Path, new { @class = "path" })</td>
</tr>
}
</tr>

View File

@ -0,0 +1,40 @@
@using NzbDrone.Web.Helpers;
@model NzbDrone.Web.Models.SeriesModel
@{
Layout = null;
}
<style>
.settingsForm
{
overflow: auto;
}
</style>
<div id="stylized" style="border-color: transparent;">
@using (Html.BeginForm("SaveSingleSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditorForm", name = "SeriesEditorForm", @class = "settingsForm" }))
{
@Html.HiddenFor(m => m.SeriesId)
@Html.HiddenFor(m => m.Status)
<label class="labelClass">@Html.LabelFor(m => m.Monitored)
<span class="small">@Html.DescriptionFor(m => m.Monitored)</span>
</label>
@Html.CheckBoxFor(m => m.Monitored, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.SeasonFolder)
<span class="small">@Html.DescriptionFor(m => m.SeasonFolder)</span>
</label>
@Html.CheckBoxFor(m => m.SeasonFolder, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.QualityProfileId)
<span class="small">@Html.DescriptionFor(m => m.QualityProfileId)</span>
</label>
@Html.DropDownListFor(m => m.QualityProfileId, (SelectList)ViewData["SelectList"], new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.Path)
<span class="small">@Html.DescriptionFor(m => m.Path)</span>
</label>
@Html.TextBoxFor(m => m.Path, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.BacklogSetting)
<span class="small">@Html.DescriptionFor(m => m.BacklogSetting)</span>
</label>
@Html.DropDownListFor(m => m.BacklogSetting, (SelectList)ViewData["BacklogSettingSelectList"], new { @class = "inputClass" })
}
</div>