1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

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 @@ public class SeasonStatisticsResource
public DateTime? PreviousAiring { get; set; } public DateTime? PreviousAiring { get; set; }
public int EpisodeFileCount { get; set; } public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; } public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; } public long SizeOnDisk { get; set; }
public decimal PercentOfEpisodes public decimal PercentOfEpisodes

View File

@ -160,6 +160,7 @@ private void LinkSeriesStatistics(List<SeriesResource> resources, List<SeriesSta
private void LinkSeriesStatistics(SeriesResource resource, SeriesStatistics seriesStatistics) private void LinkSeriesStatistics(SeriesResource resource, SeriesStatistics seriesStatistics)
{ {
resource.TotalEpisodeCount = seriesStatistics.TotalEpisodeCount;
resource.EpisodeCount = seriesStatistics.EpisodeCount; resource.EpisodeCount = seriesStatistics.EpisodeCount;
resource.EpisodeFileCount = seriesStatistics.EpisodeFileCount; resource.EpisodeFileCount = seriesStatistics.EpisodeFileCount;
resource.NextAiring = seriesStatistics.NextAiring; resource.NextAiring = seriesStatistics.NextAiring;

View File

@ -28,6 +28,7 @@ public Int32 SeasonCount
} }
} }
public Int32? TotalEpisodeCount { get; set; }
public Int32? EpisodeCount { get; set; } public Int32? EpisodeCount { get; set; }
public Int32? EpisodeFileCount { get; set; } public Int32? EpisodeFileCount { get; set; }
public Int64? SizeOnDisk { get; set; } public Int64? SizeOnDisk { get; set; }

View File

@ -11,6 +11,7 @@ public class SeasonStatistics : ResultSet
public string PreviousAiringString { get; set; } public string PreviousAiringString { get; set; }
public int EpisodeFileCount { get; set; } public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; } public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; } public long SizeOnDisk { get; set; }
public DateTime? NextAiring public DateTime? NextAiring

View File

@ -11,6 +11,7 @@ public class SeriesStatistics : ResultSet
public string PreviousAiringString { get; set; } public string PreviousAiringString { get; set; }
public int EpisodeFileCount { get; set; } public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; } public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; } public long SizeOnDisk { get; set; }
public List<SeasonStatistics> SeasonStatistics { get; set; } public List<SeasonStatistics> SeasonStatistics { get; set; }

View File

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

View File

@ -30,9 +30,9 @@ public SeriesStatistics SeriesStatistics(int seriesId)
{ {
var stats = _seriesStatisticsRepository.SeriesStatistics(seriesId); 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) private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatistics)
@ -43,6 +43,7 @@ private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatis
SeriesId = seasonStatistics.First().SeriesId, SeriesId = seasonStatistics.First().SeriesId,
EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount), EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount), EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk), SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk),
NextAiringString = seasonStatistics.OrderBy(s => NextAiringString = seasonStatistics.OrderBy(s =>
{ {

View File

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

View File

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

View File

@ -1,21 +1,49 @@
@import "../Content/badges.less";
@import "../Shared/Styles/clickable.less"; @import "../Shared/Styles/clickable.less";
.season { .season {
display : inline-block; display : inline-block;
font-size : 14px;
margin-bottom : 4px; margin-bottom : 4px;
background-color: #eee;
border: 1px solid #999; .label {
color: #999; .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 { .season-monitored {
display : inline-block; width : 16px;
width : 16px;
.clickable(); i {
.clickable();
}
} }
.season-number { .season-number {
font-size : 12px; 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'); var monitored = this.model.get('monitored');
this.ui.monitored.removeAttr('data-idle-icon'); this.ui.monitored.removeAttr('data-idle-icon');
this.ui.monitored.removeClass('fa-spin icon-sonarr-spinner');
if (monitored) { if (monitored) {
this.ui.monitored.addClass('icon-sonarr-monitored'); this.ui.monitored.addClass('icon-sonarr-monitored');