diff --git a/UI/Cells/EpisodeStatusCell.js b/UI/Cells/EpisodeStatusCell.js index 889594717..f2db6ac5d 100644 --- a/UI/Cells/EpisodeStatusCell.js +++ b/UI/Cells/EpisodeStatusCell.js @@ -16,7 +16,9 @@ define( var icon; var tooltip; - if (this.model.get('episodeFile')) { + var hasAired = Date.create(this.model.get('airDate')).isBefore(Date.create()); + + if (hasAired) { icon = 'icon-ok'; tooltip = 'Episode downloaded'; } diff --git a/UI/Handlebars/Helpers/EpisodeNumber.js b/UI/Handlebars/Helpers/Episode.js similarity index 100% rename from UI/Handlebars/Helpers/EpisodeNumber.js rename to UI/Handlebars/Helpers/Episode.js diff --git a/UI/Handlebars/Helpers/Quality.js b/UI/Handlebars/Helpers/Quality.js new file mode 100644 index 000000000..6c13398a3 --- /dev/null +++ b/UI/Handlebars/Helpers/Quality.js @@ -0,0 +1,21 @@ +'use strict'; +define( + [ + 'handlebars', + 'Quality/QualityProfileCollection', + 'underscore' + ], function (Handlebars, QualityProfileCollection, _) { + + Handlebars.registerHelper('qualityProfile', function (profileId) { + + var profile = QualityProfileCollection.get(profileId); + + if (profile) { + return new Handlebars.SafeString('' + profile.get("name") + ''); + } + + return undefined; + + }); + + }); diff --git a/UI/Handlebars/Helpers/Series.js b/UI/Handlebars/Helpers/Series.js new file mode 100644 index 000000000..a47253091 --- /dev/null +++ b/UI/Handlebars/Helpers/Series.js @@ -0,0 +1,44 @@ +'use strict'; +define( + [ + 'handlebars', + 'underscore' + ], function (Handlebars, _) { + Handlebars.registerHelper('poster', function () { + + var poster = _.where(this.images, {coverType: 'poster'}); + + if (poster[0]) { + return poster[0].url; + } + + return undefined; + }); + + Handlebars.registerHelper('traktUrl', function () { + return 'http://trakt.tv/show/' + this.titleSlug; + }); + + Handlebars.registerHelper('imdbUrl', function () { + return 'http://imdb.com/title/' + this.imdbId; + }); + + Handlebars.registerHelper('route', function () { + return '/series/' + this.titleSlug; + }); + + + Handlebars.registerHelper('percentOfEpisodes', function () { + var episodeCount = this.episodeCount; + var episodeFileCount = this.episodeFileCount; + + var percent = 100; + + if (episodeCount > 0) { + percent = episodeFileCount / episodeCount * 100; + } + + return percent; + }); + + }); diff --git a/UI/Handlebars/backbone.marionette.templates.js b/UI/Handlebars/backbone.marionette.templates.js index 697d51d9a..d51fa431e 100644 --- a/UI/Handlebars/backbone.marionette.templates.js +++ b/UI/Handlebars/backbone.marionette.templates.js @@ -6,7 +6,9 @@ define( 'Handlebars/Helpers/DateTime', 'Handlebars/Helpers/Html', 'Handlebars/Helpers/Numbers', - 'Handlebars/Helpers/EpisodeNumber', + 'Handlebars/Helpers/Episode', + 'Handlebars/Helpers/Series', + 'Handlebars/Helpers/Quality', 'Handlebars/Debug' ], function (Templates) { return function () { diff --git a/UI/Quality/QualityProfilePartial.html b/UI/Quality/QualityProfilePartial.html deleted file mode 100644 index 5f622ffad..000000000 --- a/UI/Quality/QualityProfilePartial.html +++ /dev/null @@ -1 +0,0 @@ -{{name}} diff --git a/UI/Series/Details/SeriesDetailsLayout.js b/UI/Series/Details/SeriesDetailsLayout.js index 5ea61d48c..be1f69579 100644 --- a/UI/Series/Details/SeriesDetailsLayout.js +++ b/UI/Series/Details/SeriesDetailsLayout.js @@ -44,8 +44,10 @@ define( onShow: function () { var self = this; - if (this.model.has('fanArt')) { - $.backstretch(this.model.get('fanArt')); + var fanArt = this._getFanArt(); + + if (fanArt) { + $.backstretch(fanArt); } else { $('body').removeClass('backdrop'); @@ -67,6 +69,16 @@ define( this._setMonitoredState(); }, + _getFanArt: function () { + var fanArt = _.where(this.model.get('images'), {coverType: 'fanart'}); + + if(fanArt && fanArt[0]){ + return fanArt[0].url; + } + + return undefined; + }, + onClose: function () { $('.backstretch').remove(); $('body').removeClass('backdrop'); @@ -81,7 +93,7 @@ define( var promise = this.model.save(); - promise.always(function (){ + promise.always(function () { self._setMonitoredState(); }); }, diff --git a/UI/Series/Details/SeriesDetailsTemplate.html b/UI/Series/Details/SeriesDetailsTemplate.html index a506716e3..87a79b6f8 100644 --- a/UI/Series/Details/SeriesDetailsTemplate.html +++ b/UI/Series/Details/SeriesDetailsTemplate.html @@ -14,7 +14,7 @@ {{overview}}