Improved season pass styling

This commit is contained in:
Taloth Saldono 2015-05-27 20:28:57 +02:00 committed by Mark McDowall
parent 155c82c199
commit fc572500e4
11 changed files with 68 additions and 34 deletions

View File

@ -8,6 +8,7 @@ namespace NzbDrone.Api.Series
public DateTime? PreviousAiring { get; set; }
public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; }
public decimal PercentOfEpisodes

View File

@ -160,6 +160,7 @@ namespace NzbDrone.Api.Series
private void LinkSeriesStatistics(SeriesResource resource, SeriesStatistics seriesStatistics)
{
resource.TotalEpisodeCount = seriesStatistics.TotalEpisodeCount;
resource.EpisodeCount = seriesStatistics.EpisodeCount;
resource.EpisodeFileCount = seriesStatistics.EpisodeFileCount;
resource.NextAiring = seriesStatistics.NextAiring;

View File

@ -28,6 +28,7 @@ namespace NzbDrone.Api.Series
}
}
public Int32? TotalEpisodeCount { get; set; }
public Int32? EpisodeCount { get; set; }
public Int32? EpisodeFileCount { get; set; }
public Int64? SizeOnDisk { get; set; }

View File

@ -11,6 +11,7 @@ namespace NzbDrone.Core.SeriesStats
public string PreviousAiringString { get; set; }
public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; }
public DateTime? NextAiring

View File

@ -11,6 +11,7 @@ namespace NzbDrone.Core.SeriesStats
public string PreviousAiringString { get; set; }
public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; }
public List<SeasonStatistics> SeasonStatistics { get; set; }

View File

@ -8,7 +8,7 @@ namespace NzbDrone.Core.SeriesStats
public interface ISeriesStatisticsRepository
{
List<SeasonStatistics> SeriesStatistics();
SeasonStatistics SeriesStatistics(Int32 seriesId);
List<SeasonStatistics> SeriesStatistics(Int32 seriesId);
}
public class SeriesStatisticsRepository : ISeriesStatisticsRepository
@ -35,7 +35,7 @@ namespace NzbDrone.Core.SeriesStats
return mapper.Query<SeasonStatistics>(queryText);
}
public SeasonStatistics SeriesStatistics(Int32 seriesId)
public List<SeasonStatistics> SeriesStatistics(Int32 seriesId)
{
var mapper = _database.GetDataMapper();
@ -49,7 +49,7 @@ namespace NzbDrone.Core.SeriesStats
sb.AppendLine(GetGroupByClause());
var queryText = sb.ToString();
return mapper.Find<SeasonStatistics>(queryText);
return mapper.Query<SeasonStatistics>(queryText);
}
private String GetSelectClause()
@ -58,6 +58,7 @@ namespace NzbDrone.Core.SeriesStats
(SELECT
Episodes.SeriesId,
Episodes.SeasonNumber,
SUM(CASE WHEN AirdateUtc <= @currentDate OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS TotalEpisodeCount,
SUM(CASE WHEN (Monitored = 1 AND AirdateUtc <= @currentDate) OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeCount,
SUM(CASE WHEN EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeFileCount,
MIN(CASE WHEN AirDateUtc < @currentDate OR EpisodeFileId > 0 OR Monitored = 0 THEN NULL ELSE AirDateUtc END) AS NextAiringString,

View File

@ -30,9 +30,9 @@ namespace NzbDrone.Core.SeriesStats
{
var stats = _seriesStatisticsRepository.SeriesStatistics(seriesId);
if (stats == null) return new SeriesStatistics();
if (stats == null || stats.Count == 0) return new SeriesStatistics();
return MapSeriesStatistics(new List<SeasonStatistics> { stats });
return MapSeriesStatistics(stats);
}
private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatistics)
@ -43,6 +43,7 @@ namespace NzbDrone.Core.SeriesStats
SeriesId = seasonStatistics.First().SeriesId,
EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk),
NextAiringString = seasonStatistics.OrderBy(s =>
{

View File

@ -72,8 +72,7 @@
.icon-sonarr-spinner {
.fa-icon-content(@fa-var-spinner);
//TODO: Fix icon spin
//.fa-spin
margin: 0px -0.14em;
}
.icon-sonarr-rename {

View File

@ -1,30 +1,29 @@
{{#each seasons}}
<span class="season label label-default">
<span>
{{debug}}
<span class="season">
<span class="label">
<span class="x-season-monitored season-monitored" title="Toggle season monitored status" data-season-number="{{seasonNumber}}">
<i class="x-season-monitored-icon {{#if monitored}}icon-sonarr-monitored{{else}}icon-sonarr-unmonitored{{/if}}"/>
</span>
</span>
{{#if_eq seasonNumber compare="0"}}
<span class="season-number">Specials</span>
{{else}}
<span class="season-number">S{{Pad2 seasonNumber}}</span>
{{/if_eq}}
<!--{{#if_eq statistics.episodeCount compare=0}}-->
<!--{{#if monitored}}-->
<!--<span class="badge badge-primary season-status" title="No aired episodes">&nbsp;</span>-->
<!--{{else}}-->
<!--<span class="badge badge-warning season-status" title="Season is not monitored">&nbsp;</span>-->
<!--{{/if}}-->
<!--{{else}}-->
<!--{{#with statistics}}-->
<!--{{#if_eq percentOfEpisodes compare=100}}-->
<!--<span class="badge badge-success season-status" title="{{episodeFileCount}}/{{episodeCount}} episodes downloaded">{{episodeFileCount}} / {{episodeCount}}</span>-->
<!--{{else}}-->
<!--<span class="badge badge-danger season-status" title="{{episodeFileCount}}/{{episodeCount}} episodes downloaded">{{episodeFileCount}} / {{episodeCount}}</span>-->
<!--{{/if_eq}}-->
<!--{{/with}}-->
<!--{{/if_eq}}-->
</span><span class="label">
{{#with statistics}}
{{#if_eq totalEpisodeCount compare=0}}
<span class="season-status" title="No aired episodes">&nbsp;</span>
{{else}}
{{#if_eq percentOfEpisodes compare=100}}
<span class="season-status" title="{{episodeFileCount}}/{{totalEpisodeCount}} episodes downloaded">{{episodeFileCount}}/{{totalEpisodeCount}}</span>
{{else}}
<span class="season-status" title="{{episodeFileCount}}/{{totalEpisodeCount}} episodes downloaded">{{episodeFileCount}}/{{totalEpisodeCount}}</span>
{{/if_eq}}
{{/if_eq}}
{{else}}
<span class="season-status" title="No aired episodes">&nbsp;</span>
{{/with}}
</span>
</span>
{{/each}}

View File

@ -1,21 +1,49 @@
@import "../Content/badges.less";
@import "../Shared/Styles/clickable.less";
.season {
display : inline-block;
font-size : 14px;
display : inline-block;
margin-bottom : 4px;
background-color: #eee;
border: 1px solid #999;
color: #999;
.label {
.badge-inverse();
display : inline-block;
padding : 4px;
font-size : 14px;
}
.label:first-child {
border-right : 0px;
border-top-right-radius : 0.0em;
border-bottom-right-radius : 0.0em;
color : #777;
background-color : #eee;
}
.label:last-child {
border-left : 0px;
border-top-left-radius : 0.0em;
border-bottom-left-radius : 0.0em;
color : #999;
background-color : #f7f7f7;
}
.season-monitored {
display : inline-block;
width : 16px;
width : 16px;
.clickable();
i {
.clickable();
}
}
.season-number {
font-size : 12px;
}
.season-status {
display : inline-block;
vertical-align : baseline !important;
}
}

View File

@ -127,6 +127,7 @@ module.exports = Marionette.Layout.extend({
var monitored = this.model.get('monitored');
this.ui.monitored.removeAttr('data-idle-icon');
this.ui.monitored.removeClass('fa-spin icon-sonarr-spinner');
if (monitored) {
this.ui.monitored.addClass('icon-sonarr-monitored');