Series/Details grids now use images for ignore/status/search/rename.

pull/6/head
Mark McDowall 13 years ago
parent 4e41791d58
commit 1d1bbd3a23

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

@ -19,7 +19,7 @@ namespace NzbDrone.Web.Controllers
public JsonResult RssSync()
{
_jobProvider.QueueJob(typeof(RssSyncJob));
return new JsonResult { Data = "ok" };
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
public JsonResult SyncEpisodesOnDisk(int seriesId)
@ -27,7 +27,7 @@ namespace NzbDrone.Web.Controllers
//Syncs the episodes on disk for the specified series
_jobProvider.QueueJob(typeof(DiskScanJob), seriesId);
return new JsonResult { Data = "ok" };
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
public JsonResult UpdateInfo(int seriesId)
@ -35,7 +35,7 @@ namespace NzbDrone.Web.Controllers
//Syncs the episodes on disk for the specified series
_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
return new JsonResult { Data = "ok" };
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
public JsonResult RenameSeries(int seriesId)
@ -43,7 +43,7 @@ namespace NzbDrone.Web.Controllers
//Syncs the episodes on disk for the specified series
//_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
return new JsonResult { Data = "ok" };
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
}
}

@ -142,6 +142,8 @@
<Content Include="Content\Images\Missing.png" />
<Content Include="Content\Images\NotAired.png" />
<Content Include="Content\Images\Ready.png" />
<Content Include="Content\Images\Rename.png" />
<Content Include="Content\Images\Search.png" />
<Content Include="Content\Images\success.png" />
<Content Include="Content\jquery.gritter.css" />
<Content Include="Content\Menu.css" />

@ -1,5 +1,9 @@
var notIgnoredImage = '../../Content/Images/notIgnored.png';
var ignoredImage = '../../Content/Images/ignored.png';
var notAiredImage = '../../Content/Images/NotAired.png';
var readyImage = '../../Content/Images/Ready.png';
var downloadingImage = '../../Content/Images/Downloading.png';
var seriesId = 0;
var saveSeasonIgnoreUrl = '../Series/SaveSeasonIgnore';
var saveEpisodeIgnoreUrl = '../Series/SaveEpisodeIgnore';
@ -64,6 +68,8 @@ function toggleChildren(seasonNumber, ignored) {
}
function toggleMaster(seasonNumber) {
//Toggles all master toggles when the childen changes or the grid is loaded
var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber);
var ignoredCount = ignoreEpisodes.filter('.ignored').length;
var masters = $('.ignoreSeason_' + seasonNumber);
@ -82,6 +88,7 @@ function toggleMaster(seasonNumber) {
}
function toggleMasters(seasonNumber, ignored) {
//Toggles the other master(s) to match the one that was just changed
var masters = $('.ignoreSeason_' + seasonNumber);
if (ignored) {
@ -125,6 +132,7 @@ function grid_dataBound(e) {
var seasonNumber = id.replace('seasons_', '');
toggleMaster(seasonNumber);
setMasterStatus(this);
}
//Episode Ignore Saving
@ -184,3 +192,32 @@ function searchSeason(seriesId, seasonNumber) {
}
});
}
//Set master status to match children
function setMasterStatus(grid) {
//Get children of this grid
var masterStatus = $(grid).find('.statusImageMaster');
var statuses = $(grid).find('.statusImage').filter(':not(.statusImageMaster)');
var episodeCount = statuses.length;
//Get missing count
if (statuses.filter('.status-Missing').length == episodeCount) {
//Leave as is (default is missing)
return;
}
if (statuses.filter('.status-NotAired').length == episodeCount) {
masterStatus.attr('src', notAiredImage);
return;
}
if (statuses.filter('.status-Ready').length == episodeCount) {
masterStatus.attr('src', readyImage);
return;
}
if (statuses.filter('.status-Downloading').length == episodeCount) {
masterStatus.attr('src', downloadingImage);
return;
}
}

@ -8,21 +8,6 @@
<script src="../../Scripts/seriesDetails.js" type="text/javascript"></script>
<style>
.ignoreEpisode
{
width: 18px;
height: 18px;
padding-bottom: -6px;
}
.ignoredEpisodesMaster
{
width: 18px;
height: 18px;
padding-left: 18px;
padding-right: -18px;
}
.seasonToggleTopGroup
{
overflow: hidden;
@ -51,12 +36,48 @@
padding-left: 0px;
padding-right: 0px;
margin-bottom: -4px;
border-style: none;
}
.statusImage
.statusImage, .searchImage, .renameImage, .ignoreEpisode, .ignoreEpisodesMaster
{
width: 18px;
height: 18px;
padding: 1px;
margin: 2px;
border-width: 1px;
border-style: dashed;
border-color: lightgray;
}
.searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover
{
background-color: #065EFE;
}
.t-grid td
{
line-height: 0.6em;
}
.t-grid .t-header
{
line-height: 1.8em;
}
.t-grid-header .t-header .t-link
{
padding: 0.3em 0.9em 1.0em 0.6em;
}
.t-grid .t-alt
{
/*background: #E5ECF9;*/
}
.t-grid .t-detail-cell
{
line-height: 1.5em;
}
</style>
@ -96,26 +117,32 @@
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(o => o.Ignored)
.Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_" + season + "' title='Click to toggle season ignore status' />")
.ClientTemplate(
"<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' title='Click to toggle episode ignore status' />")
.Width(20)
.HtmlAttributes(new { style = "text-align:center" });
//columns.Bound(o => o.Ignored)
// .Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_" + season + "' title='Click to toggle season ignore status' />")
// .ClientTemplate(
// "<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' title='Click to toggle episode ignore status' />")
// .Width(20)
// .HtmlAttributes(new { style = "text-align:center" });
columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode");
columns.Bound(c => c.Title).Title("Title");
columns.Bound(c => c.AirDate).Width(0);
columns.Bound(c => c.Quality).Width(0);
columns.Bound(c => c.Status)
.ClientTemplate("<img src='../../Content/Images/<#= Status #>.png' alt='<#= Status #>' title='<#= Status #>' class='statusImage' />")
.Width(20)
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(o => o.EpisodeId).Title("")
.ClientTemplate("<a href=\"../Episode/Season?episodeId=<#= EpisodeId #>\" onclick=\"searchForEpisode('<#= EpisodeId #>'); return false;\">Search</a>"
+ " | " +
"<a href=\"../Episode/Rename?episodeFileId=<#= EpisodeId #>\" onclick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\">Rename</a>"
);
.Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_" + season + "' title='Click to toggle season ignore status' />" +
"<img src='../../Content/Images/Missing.png' alt='Status' title='Season Status' class='statusImage statusImageMaster' />" +
"<a href=\"../Episode/SearchSeason?seriesId=" + @seriesId + "&seasonNumber=" + @season + "\" onclick=\"searchSeason(" + @seriesId + ", "+ @season + "); return false;\"><img src='../../Content/Images/Search.png' alt='Search' title='Search for all episodes in this season' class='searchImage searchImageMaster' /></a>" +
"<a href=\"../Episode/RenameSeason?seriesId=" + @seriesId + "&seasonNumber=" + @season + "\" onclick=\"renameSeason(" + @seriesId + ", " + @season + "); return false;\"><img src='../../Content/Images/Rename.png' alt='Rename' title='Rename all episodes in this season' class=renameImage renameImageMaster' /></a>")
.ClientTemplate("<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' title='Click to toggle episode ignore status' />" +
"<img src='../../Content/Images/<#= Status #>.png' alt='<#= Status #>' title='<#= Status #>' class='statusImage status-<#= Status #>' />" +
"<a href=\"../Episode/Season?episodeId=<#= EpisodeId #>\" onclick=\"searchForEpisode('<#= EpisodeId #>'); return false;\"><img src='../../Content/Images/Search.png' alt='Search' title='Search for episode' class='searchImage' /></a>" +
"<a href=\"../Episode/Rename?episodeFileId=<#= EpisodeId #>\" onclick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\"><img src='../../Content/Images/Rename.png' alt='Rename' title='Rename episode' class='renameImage' />")
.Width(80);
//columns.Bound(o => o.EpisodeId).Title("")
// .ClientTemplate("<a href=\"../Episode/Season?episodeId=<#= EpisodeId #>\" onclick=\"searchForEpisode('<#= EpisodeId #>'); return false;\">Search</a>"
// + " | " +
// "<a href=\"../Episode/Rename?episodeFileId=<#= EpisodeId #>\" onclick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\">Rename</a>"
// );
})
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false))
@ -124,12 +151,12 @@
d =>
d.Ajax().Select("_AjaxSeasonGrid", "Series",
new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", season } }))
.ToolBar(toolbar => toolbar.Template(@<text>
@*.ToolBar(toolbar => toolbar.Template(@<text>
<ul class="sub-menu">
<li><a href="../Episode/SearchSeason?seriesId=@seriesId&seasonNumber=@season" onclick="searchSeason('@seriesId', @season); return false;">Search for Season</a></li>
<li><a href="../Episode/RenameSeason?seriesId=@seriesId&seasonNumber=@season" onclick="renameSeason('@seriesId', @season); return false;">Rename Season</a></li>
</ul>
</text>))
</text>))*@
.ClientEvents(clientEvents =>
{
clientEvents.OnRowDataBound("grid_rowBound");

Loading…
Cancel
Save