Episode count on posters and coloured bars

This commit is contained in:
Mark McDowall 2013-07-25 20:25:56 -07:00
parent 5bfcc511e8
commit 9ba0623987
7 changed files with 78 additions and 17 deletions

26
UI/Cells/AirDateCell.js Normal file
View File

@ -0,0 +1,26 @@
'use strict';
define(
[
'backgrid',
'moment',
'Shared/FormatHelpers'
], function (Backgrid, Moment, FormatHelpers) {
return Backgrid.Cell.extend({
className: 'air-date-cell',
render: function () {
this.$el.empty();
var date = this.model.get(this.column.get('name'));
if (date) {
this.$el.html(FormatHelpers.DateHelper(date));
this.$el.attr('title', Moment(date).format('LLLL'));
}
return this;
}
});
});

View File

@ -15,19 +15,22 @@
width : 125px; width : 125px;
position : relative; position : relative;
margin-bottom : 2px; margin-bottom : 2px;
.progressbar-back-text, .progressbar-front-text {
font-size : 11.844px;
font-weight: bold;
text-align : center;
}
.progressbar-back-text { .progressbar-back-text {
position : absolute; position : absolute;
width : 100%; width : 100%;
height : 100%; height : 100%;
font-size : 12px;
text-align : center;
} }
.progressbar-front-text { .progressbar-front-text {
display : block; display : block;
width : 125px; width : 125px;
font-size : 12px;
text-align : center;
} }
.bar { .bar {
position : absolute; position : absolute;

View File

@ -35,7 +35,6 @@ define(
return '/series/' + this.titleSlug; return '/series/' + this.titleSlug;
}); });
Handlebars.registerHelper('percentOfEpisodes', function () { Handlebars.registerHelper('percentOfEpisodes', function () {
var episodeCount = this.episodeCount; var episodeCount = this.episodeCount;
var episodeFileCount = this.episodeFileCount; var episodeFileCount = this.episodeFileCount;
@ -49,4 +48,18 @@ define(
return percent; return percent;
}); });
Handlebars.registerHelper('seasonCountHelper', function () {
var seasonCount = this.seasonCount;
var continuing = this.status === 'continuing';
if (continuing) {
return new Handlebars.SafeString('<span class="label label-info">Season {0}</span>'.format(seasonCount));
}
if (seasonCount === 1) {
return new Handlebars.SafeString('<span class="label label-info">{0} Season</span>'.format(seasonCount))
}
return new Handlebars.SafeString('<span class="label label-info">{0} Seasons</span>'.format(seasonCount))
});
}); });

View File

@ -0,0 +1,15 @@
{{#if_eq episodeFileCount compare=episodeCount}}
{{#if_eq status compare="continuing"}}
<div class="progress">
{{else}}
<div class="progress progress-success">
{{/if_eq}}
{{else}}
<div class="progress progress-danger">
{{/if_eq}}
<span class="progressbar-back-text">{{episodeFileCount}} / {{episodeCount}}</span>
<div class="bar" style="width:{{percentOfEpisodes}}%"><span class="progressbar-front-text">{{episodeFileCount}} / {{episodeCount}}</span></div>
</div>

View File

@ -33,20 +33,16 @@
{{#if nextAiring}} {{#if nextAiring}}
<span class="label">{{NextAiring nextAiring}}</span> <span class="label">{{NextAiring nextAiring}}</span>
{{/if}} {{/if}}
<span class="label label-info">Season {{seasonCount}}</span>
{{else}} {{else}}
<span class="label label-important">Ended</span> <span class="label label-important">Ended</span>
<span class="label label-info">{{seasonCount}} Seasons</span>
{{/if_eq}} {{/if_eq}}
{{seasonCountHelper}}
{{qualityProfile qualityProfileId}} {{qualityProfile qualityProfileId}}
</div> </div>
<div class="span2"> <div class="span2">
<div class="progress"> {{> EpisodeProgressPartial }}
<span class="progressbar-back-text">{{episodeFileCount}} / {{episodeCount}}</span>
<div class="bar" style="width:{{percentOfEpisodes}}%"><span class="progressbar-front-text">{{episodeFileCount}} / {{episodeCount}}</span></div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -24,10 +24,9 @@
{{#if nextAiring}} {{#if nextAiring}}
<span class="label label-inverse">{{NextAiring nextAiring}}</span> <span class="label label-inverse">{{NextAiring nextAiring}}</span>
{{/if}} {{/if}}
<span class="label label-info">Season {{seasonCount}}</span>
{{else}}
<span class="label label-info">{{seasonCount}} Seasons</span>
{{/if_eq}} {{/if_eq}}
{{seasonCountHelper}}
{{> EpisodeProgressPartial }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -66,13 +66,23 @@
.card; .card;
.clickable; .clickable;
margin-bottom : 20px; margin-bottom : 20px;
height : 295px; height : 320px;
.center { .center {
display : block; display : block;
margin-left : auto; margin-left : auto;
margin-right : auto; margin-right : auto;
text-align : center; text-align : center;
.progress {
text-align: left;
left: 0px;
width: 171px;
.progressbar-front-text {
width: 171px;
}
}
} }
.progress { .progress {
@ -146,7 +156,6 @@
width : 168px; width : 168px;
} }
} }
} }
.series-detail-overview { .series-detail-overview {