New series ignore editor on Series/Details.

Styling works, backend saving not yet implemented.
This commit is contained in:
Mark McDowall 2011-08-03 00:26:39 -07:00
parent ec78c5be3e
commit c32346e6ea
8 changed files with 142 additions and 104 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -227,8 +227,6 @@ namespace NzbDrone.Web.Controllers
var episodePath = String.Empty; var episodePath = String.Empty;
var episodeQuality = String.Empty; var episodeQuality = String.Empty;
if (e.EpisodeFile != null) if (e.EpisodeFile != null)
{ {
episodePath = e.EpisodeFile.Path; episodePath = e.EpisodeFile.Path;
@ -252,7 +250,8 @@ namespace NzbDrone.Web.Controllers
Path = episodePath, Path = episodePath,
EpisodeFileId = episodeFileId, EpisodeFileId = episodeFileId,
Status = e.Status.ToString(), Status = e.Status.ToString(),
Quality = episodeQuality Quality = episodeQuality,
Ignored = e.Ignored
}); });
} }

View File

@ -15,5 +15,6 @@ namespace NzbDrone.Web.Models
public String Status { get; set; } public String Status { get; set; }
public string AirDate { get; set; } public string AirDate { get; set; }
public String Quality { get; set; } public String Quality { get; set; }
public bool Ignored { get; set; }
} }
} }

View File

@ -183,6 +183,8 @@
<Content Include="Content\Blueprint\ie.css" /> <Content Include="Content\Blueprint\ie.css" />
<Content Include="Content\Blueprint\screen.css" /> <Content Include="Content\Blueprint\screen.css" />
<Content Include="Content\Blueprint\liquid.css" /> <Content Include="Content\Blueprint\liquid.css" />
<Content Include="Content\Images\ignored.png" />
<Content Include="Content\Images\notIgnored.png" />
<Content Include="Content\Images\x_16.png" /> <Content Include="Content\Images\x_16.png" />
<Content Include="Content\jQueryUI\images\ui-bg_diagonals-thick_30_a32d00_40x40.png" /> <Content Include="Content\jQueryUI\images\ui-bg_diagonals-thick_30_a32d00_40x40.png" />
<Content Include="Content\jQueryUI\images\ui-bg_flat_0_065efe_40x100.png" /> <Content Include="Content\jQueryUI\images\ui-bg_flat_0_065efe_40x100.png" />
@ -250,6 +252,7 @@
<Content Include="favicon.ico" /> <Content Include="favicon.ico" />
<Content Include="Global.asax" /> <Content Include="Global.asax" />
<Content Include="Scripts\AutoComplete.js" /> <Content Include="Scripts\AutoComplete.js" />
<Content Include="Scripts\seriesDetails.js" />
<Content Include="Scripts\Plugins\jquery.livequery.js" /> <Content Include="Scripts\Plugins\jquery.livequery.js" />
<Content Include="Scripts\settingsForm.js" /> <Content Include="Scripts\settingsForm.js" />
<Content Include="Scripts\Plugins\doTimeout.js" /> <Content Include="Scripts\Plugins\doTimeout.js" />

View File

@ -0,0 +1,83 @@
var notIgnoredImage = '../../Content/Images/notIgnored.png';
var ignoredImage = '../../Content/Images/ignored.png';
$(".ignoreEpisode").live("click", function () {
var toggle = $(this);
var ignored = toggle.hasClass('ignored');
if (ignored) {
toggle.removeClass('ignored');
toggle.attr('src', notIgnoredImage);
}
else {
toggle.addClass('ignored');
toggle.attr('src', ignoredImage);
}
if (toggle.hasClass('ignoredEpisodesMaster')) {
var seasonNumber = toggle.attr('id').replace('master_', '');
toggleChildren(seasonNumber, ignored);
}
});
function toggleChildren(seasonNumber, ignored) {
var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber);
if (!ignored) {
ignoreEpisodes.each(function (index) {
$(this).addClass('ignored');
$(this).attr('src', ignoredImage);
});
}
else {
ignoreEpisodes.each(function (index) {
$(this).removeClass('ignored');
$(this).attr('src', notIgnoredImage);
});
}
}
function grid_rowBound(e) {
var dataItem = e.dataItem;
var ignored = dataItem.Ignored;
var episodeId = dataItem.EpisodeId;
var ignoredIcon = $('#' + episodeId);
if (ignored) {
ignoredIcon.attr('src', ignoredImage);
}
else {
ignoredIcon.attr('src', notIgnoredImage);
ignoredIcon.removeClass('ignored');
}
}
function grid_dataBound(e) {
var id = $(this).attr('id');
var seasonNumber = id.replace('seasons_', '');
var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber);
var master = $('#master_' + seasonNumber);
var count = ignoreEpisodes.length;
var ignoredCount = 0;
ignoreEpisodes.each(function (index) {
if ($(this).hasClass('ignored')) {
ignoredCount++;
}
});
if (ignoredCount == count) {
master.attr('src', ignoredImage);
master.addClass('ignored');
}
else {
master.attr('src', notIgnoredImage);
master.removeClass('ignored');
}
}

View File

@ -4,6 +4,26 @@
@section TitleContent{ @section TitleContent{
@Model.Title @Model.Title
} }
<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;
}
</style>
@section ActionMenu{ @section ActionMenu{
@{Html.Telerik().Menu().Name("SeriesMenu").Items(items => @{Html.Telerik().Menu().Name("SeriesMenu").Items(items =>
{ {
@ -50,11 +70,11 @@
.TableHtmlAttributes(new { @class = "Grid" }) .TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns => .Columns(columns =>
{ {
columns.Bound(o => o.EpisodeId) columns.Bound(o => o.Ignored)
.Title("<img src='../../Content/Images/ignored.png' class='ignoredEpisodesMaster ignoreEpisode' id='master_" + season + "' />")
.ClientTemplate( .ClientTemplate(
"<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />") "<img src='../../Content/Images/ignored.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' />")
.Title("") .Width(20)
.Width(1)
.HtmlAttributes(new { style = "text-align:center" }); .HtmlAttributes(new { style = "text-align:center" });
columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode");
@ -68,7 +88,7 @@
"<a href='#Rename' onClick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\">Rename</a>"); "<a href='#Rename' onClick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\">Rename</a>");
}) })
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>")) .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false))
.Footer(true) .Footer(true)
.DataBinding( .DataBinding(
d => d =>
@ -78,12 +98,16 @@
c => c =>
c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season }) c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season })
.ButtonType(GridButtonType.Text)) .ButtonType(GridButtonType.Text))
.ClientEvents(clientEvents =>
{
clientEvents.OnRowDataBound("grid_rowBound");
clientEvents.OnDataBound("grid_dataBound");
})
.Render();} .Render();}
</div> </div>
} }
@if (Model.Seasons.Any(s => s == 0)) @if (Model.Seasons.Any(s => s == 0))
{ {
<br /> <br />
<h3> <h3>
Specials</h3> Specials</h3>
@ -92,11 +116,11 @@
.TableHtmlAttributes(new { @class = "Grid" }) .TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns => .Columns(columns =>
{ {
columns.Bound(o => o.EpisodeId) columns.Bound(o => o.Ignored)
.Title("<img src='../../Content/Images/ignored.png' class='ignoredEpisodesMaster ignoreEpisode' id='master_0' />")
.ClientTemplate( .ClientTemplate(
"<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />") "<img src='../../Content/Images/ignored.png' class='ignoreEpisode ignoreEpisode_0 ignored' id='<#= EpisodeId #>' />")
.Title("") .Width(20)
.Width(1)
.HtmlAttributes(new { style = "text-align:center" }); .HtmlAttributes(new { style = "text-align:center" });
columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode");
@ -106,7 +130,7 @@
columns.Bound(c => c.Status).Width(10); columns.Bound(c => c.Status).Width(10);
}) })
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>")) .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false))
.Footer(true) .Footer(true)
.DataBinding( .DataBinding(
d => d =>
@ -135,5 +159,7 @@
}); });
} }
</script> </script>
} }

View File

@ -1,94 +1,20 @@
<style> <div id="image" value="5">
/*body{ <img src='../../Content/Images/watched.png' class='ignoreEpisode watched' value='5' />
font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
p, h1, form, button{border:0; margin:0; padding:0;}*/
.spacer{clear:both; height:1px;}
/* ----------- My Form ----------- */
.myform{
margin:0 auto;
width:400px;
padding:14px;
}
/* ----------- stylized ----------- */
#stylized{
border:solid 2px #b7ddf2;
background:#ebf4fb;
}
#stylized h1 {
font-size:14px;
font-weight:bold;
margin-bottom:8px;
}
#stylized p{
font-size:11px;
color:#666666;
margin-bottom:20px;
border-bottom:solid 1px #b7ddf2;
padding-bottom:10px;
}
#stylized label{
display:block;
font-weight:bold;
text-align:right;
width:140px;
float:left;
}
#stylized .small{
color:#666666;
display:block;
font-size:11px;
font-weight:normal;
text-align:right;
width:140px;
}
#stylized input{
float:left;
font-size:12px;
padding:4px 2px;
border:solid 1px #aacfe4;
width:200px;
margin:2px 0 20px 10px;
}
#stylized button{
clear:both;
margin-left:150px;
width:125px;
height:31px;
background:#666666 url(img/button.png) no-repeat;
text-align:center;
line-height:31px;
color:#FFFFFF;
font-size:11px;
font-weight:bold;
}
</style>
<div id="stylized" class="myform">
<form id="form" name="form" method="post">
<fieldset>
<h1>Sign-up form</h1>
<p>This is the basic look of my form without table</p>
<label>Name
<span class="small">Add your name</span>
</label>
<input type="text" name="name" id="name" />
<label>Email
<span class="small">Add a valid address</span>
</label>
<input type="text" name="email" id="email" />
<label>Password
<span class="small">Min. size 6 chars</span>
</label>
<input type="text" name="password" id="password" />
<button type="submit">Sign-up</button>
<div class="spacer"></div>
</fieldset>
</form>
</div> </div>
<script type="text/javascript">
$(".ignoreEpisode").live("click", function () {
var toggle = $(this);
if (toggle.hasClass('watched')) {
toggle.removeClass('watched');
toggle.attr('src', '../../Content/Images/unwatched.png');
}
else {
toggle.addClass('watched');
toggle.attr('src', '../../Content/Images/watched.png');
}
});
</script>