Even more HTML5 data attributes

pull/4/head
Mark McDowall 12 years ago
parent a197316640
commit fef926a417

@ -36,7 +36,7 @@ $(".ignoreEpisode").live("click", function () {
ignored = !ignored; ignored = !ignored;
if (toggle.hasClass('ignoredEpisodesMaster')) { if (toggle.hasClass('ignoredEpisodesMaster')) {
seasonNumber = toggle.attr('class').split(/\s+/)[2].replace('ignoreSeason_', ''); seasonNumber = toggle.attr('data-season');
toggleChildren(seasonNumber, ignored); toggleChildren(seasonNumber, ignored);
toggleMasters(seasonNumber, ignored); toggleMasters(seasonNumber, ignored);
@ -45,13 +45,13 @@ $(".ignoreEpisode").live("click", function () {
else { else {
//Check to see if this is the last one ignored or the first not ignored //Check to see if this is the last one ignored or the first not ignored
var episodeId = toggle.attr('id'); var episodeId = toggle.attr('data-episode-id');
saveEpisodeIgnore(episodeId, ignored); saveEpisodeIgnore(episodeId, ignored);
} }
}); });
function toggleChildren(seasonNumber, ignored) { function toggleChildren(seasonNumber, ignored) {
var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber); var ignoreEpisodes = $('[data-season="' + seasonNumber + '"]');
if (ignored) { if (ignored) {
ignoreEpisodes.each(function (index) { ignoreEpisodes.each(function (index) {
@ -100,7 +100,7 @@ function toggleCellColour(toggle, ignored) {
toggle.parent('td').removeClass('episodeIgnored'); toggle.parent('td').removeClass('episodeIgnored');
//check to see if episode is missing //check to see if episode is missing
if (toggle.parent('td').children('.statusImage').hasClass('status-Missing')) if (toggle.parent('td').children('.statusImage').attr('data-status') === 'Missing')
toggle.parent('td').addClass('episodeMissing'); toggle.parent('td').addClass('episodeMissing');
} }
} }

@ -87,11 +87,11 @@
<div class="seasonToggleTopGroup"> <div class="seasonToggleTopGroup">
@foreach (var season in Model.Seasons.OrderBy(s => s.SeasonNumber)) @foreach (var season in Model.Seasons.OrderBy(s => s.SeasonNumber))
{ {
var ignoreSeason = "ignoreSeason_" + season.SeasonNumber;
<div class="seasonToggleTop"> <div class="seasonToggleTop">
<img src='../../Content/Images/@(season.Ignored ? "ignored" : "notIgnored").png' <img src="../../Content/Images/@(season.Ignored ? "ignored" : "notIgnored").png"
class='ignoredEpisodesMaster ignoreEpisode @ignoreSeason@(season.Ignored ? " ignored" : " ") gridAction' class="ignoredEpisodesMaster ignoreEpisode @(season.Ignored ? " ignored" : " ") gridAction"
title='Click to toggle season ignore status' /> title="Click to toggle season ignore status"
data-season="@season.SeasonNumber"/>
<a href="@string.Format("#SeasonSection_{0}", season.SeasonNumber)" class="seasonToggleLabel">@(season.SeasonNumber == 0 ? "Specials" : "Season " + season.SeasonNumber)</a> <a href="@string.Format("#SeasonSection_{0}", season.SeasonNumber)" class="seasonToggleLabel">@(season.SeasonNumber == 0 ? "Specials" : "Season " + season.SeasonNumber)</a>
</div> </div>
} }

@ -1,4 +1,3 @@
@using NzbDrone.Web.Helpers @using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.EpisodeModel @model NzbDrone.Web.Models.EpisodeModel
@ -24,10 +23,10 @@
@*Commands Column*@ @*Commands Column*@
<td class="@cellColourClass"> <td class="@cellColourClass">
<img src='../../Content/Images/@(Model.Ignored ? "ignored" : "notIgnored").png' class='ignoreEpisode ignoreEpisode_@(Model.SeasonNumber)@(Model.Ignored ? " ignored" : " ") gridAction' id='@Model.EpisodeId' title='Click to toggle episode ignore status' /> <img src='../../Content/Images/@(Model.Ignored ? "ignored" : "notIgnored").png' class="ignoreEpisode @(Model.Ignored ? " ignored" : " ") gridAction" title="Click to toggle episode ignore status" data-season="@Model.SeasonNumber" data-episode-id="@Model.EpisodeId" />
@Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for episode", @class = "gridAction" }, "Search", "Episode", new { episodeId = Model.EpisodeId }, null, null) @Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for episode", @class = "gridAction" }, "Search", "Episode", new { episodeId = Model.EpisodeId }, null, null)
<img src='../../Content/Images/changequality.png' class='changeQuality gridAction' title='Click to change the quality of the episode file' data-changetype="episode"/> <img src="../../Content/Images/changequality.png" class="changeQuality gridAction" title="Click to change the quality of the episode file" data-changetype="episode"/>
<img src='../../Content/Images/@(Model.Status).png' alt='@Model.Status' title='@Model.Status' class='gridImage status-@Model.Status statusImage' /> <img src="../../Content/Images/@(Model.Status).png" alt="@Model.Status" title="@Model.Status" class="gridImage statusImage" data-status="@Model.Status" />
</td> </td>
</tr> </tr>
<tr class="detail-row@(ViewData["AltRow"] == null || !(bool)ViewData["AltRow"] ? "" : " alt-row")"> <tr class="detail-row@(ViewData["AltRow"] == null || !(bool)ViewData["AltRow"] ? "" : " alt-row")">

@ -22,9 +22,9 @@
@*Commands Column*@ @*Commands Column*@
<th> <th>
<img src='../../Content/Images/@(Model.Ignored ? "ignored" : "notIgnored").png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_@(Model.SeasonNumber)@(Model.Ignored ? " ignored" : " ") gridAction' title='Click to toggle season ignore status' /> <img src="../../Content/Images/@(Model.Ignored ? "ignored" : "notIgnored").png" class="ignoredEpisodesMaster ignoreEpisode @(Model.Ignored ? " ignored" : " ") gridAction" title="Click to toggle season ignore status" data-season="@Model.SeasonNumber"/>
@Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for all episodes in this season", @class = "gridAction" }, "SearchSeason", "Episode", new { SeriesId = Model.SeriesId, SeasonNumber = Model.SeasonNumber }, null, null) @Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for all episodes in this season", @class = "gridAction" }, "SearchSeason", "Episode", new { SeriesId = Model.SeriesId, SeasonNumber = Model.SeasonNumber }, null, null)
<img src='../../Content/Images/changequality.png' class='changeQuality gridAction' title='Click to change the quality of all episode files in this season' data-changetype="season"/> <img src="../../Content/Images/changequality.png" class="changeQuality gridAction" title="Click to change the quality of all episode files in this season" data-changetype="season"/>
@Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename all episodes in this season", @class = "gridAction" }, "RenameSeason", "Episode", new { SeriesId = Model.SeriesId, SeasonNumber = Model.SeasonNumber }, null, null) @Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename all episodes in this season", @class = "gridAction" }, "RenameSeason", "Episode", new { SeriesId = Model.SeriesId, SeasonNumber = Model.SeasonNumber }, null, null)
</th> </th>
</tr> </tr>

Loading…
Cancel
Save