mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
removed mutators from series.
This commit is contained in:
parent
50718ae94e
commit
83fe07524a
13 changed files with 97 additions and 80 deletions
|
@ -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();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
{{overview}}
|
||||
</div>
|
||||
<div class="row">
|
||||
{{> QualityProfilePartial qualityProfile}}
|
||||
{{qualityProfile qualityProfileId}}
|
||||
<span class="label label-info">{{network}}</span>
|
||||
<span class="label label-info">{{runtime}} minutes</span>
|
||||
<span class="label label-info">{{path}}</span>
|
||||
|
|
|
@ -29,17 +29,15 @@ define(
|
|||
|
||||
|
||||
saveSeries: function () {
|
||||
//Todo: Get qualityProfile
|
||||
var qualityProfile = this.ui.qualityProfile.val();
|
||||
var qualityProfileText = this.ui.qualityProfile.children('option:selected').text();
|
||||
|
||||
this.model.set({ qualityProfileId: qualityProfile, qualityProfileName: qualityProfileText });
|
||||
var qualityProfileId = this.ui.qualityProfile.val();
|
||||
this.model.set({ qualityProfileId: qualityProfileId});
|
||||
|
||||
this.model.save();
|
||||
this.trigger('saved');
|
||||
App.modalRegion.closeModal();
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.ui.path.autoComplete('/directories');
|
||||
|
|
|
@ -55,9 +55,6 @@ define(
|
|||
}
|
||||
|
||||
return 'primary';
|
||||
},
|
||||
hasAired : function () {
|
||||
return Date.create(this.get('airDate')).isBefore(Date.create());
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<div class="row"> </div>
|
||||
<div class="row">
|
||||
<div class="span8">
|
||||
{{#if isContinuing}}
|
||||
{{#if_eq status compare="continuing"}}
|
||||
{{#if nextAiring}}
|
||||
<span class="label">{{ShortDate nextAiring}}</span>
|
||||
{{/if}}
|
||||
|
@ -37,9 +37,9 @@
|
|||
{{else}}
|
||||
<span class="label label-important">Ended</span>
|
||||
<span class="label label-info">{{seasonCount}} Seasons</span>
|
||||
{{/if}}
|
||||
{{/if_eq}}
|
||||
|
||||
{{> QualityProfilePartial qualityProfile}}
|
||||
{{qualityProfile qualityProfileId}}
|
||||
</div>
|
||||
<div class="span2">
|
||||
<div class="progress">
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<i class="icon-cog x-edit" title="Edit Series"/>
|
||||
<i class="icon-remove x-remove" title="Delete Series"/>
|
||||
</div>
|
||||
{{#unless isContinuing}}
|
||||
{{#unless_eq status compare="continuing"}}
|
||||
<div class="ended-banner">Ended</div>
|
||||
{{/unless}}
|
||||
{{/unless_eq}}
|
||||
<a href="{{route}}">
|
||||
<img class="series-poster" src="{{poster}}" {{defaultImg}}>
|
||||
</a>
|
||||
|
|
|
@ -2,71 +2,13 @@
|
|||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Quality/QualityProfileCollection',
|
||||
|
||||
'underscore'
|
||||
], function (Backbone, QualityProfileCollection,_) {
|
||||
], function (Backbone, _) {
|
||||
return Backbone.Model.extend({
|
||||
|
||||
urlRoot: ApiRoot + '/series',
|
||||
|
||||
mutators: {
|
||||
percentOfEpisodes: function () {
|
||||
var episodeCount = this.get('episodeCount');
|
||||
var episodeFileCount = this.get('episodeFileCount');
|
||||
|
||||
var percent = 100;
|
||||
|
||||
if (episodeCount > 0) {
|
||||
percent = episodeFileCount / episodeCount * 100;
|
||||
}
|
||||
|
||||
return percent;
|
||||
},
|
||||
poster : function () {
|
||||
var poster = _.find(this.get('images'), function (image) {
|
||||
return image.coverType === 'poster';
|
||||
});
|
||||
|
||||
if (poster) {
|
||||
return poster.url;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
fanArt : function () {
|
||||
var poster = _.find(this.get('images'), function (image) {
|
||||
return image.coverType === 'fanart';
|
||||
});
|
||||
|
||||
if (poster) {
|
||||
return poster.url;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
traktUrl : function () {
|
||||
return 'http://trakt.tv/show/' + this.get('titleSlug');
|
||||
},
|
||||
imdbUrl : function () {
|
||||
return 'http://imdb.com/title/' + this.get('imdbId');
|
||||
},
|
||||
isContinuing : function () {
|
||||
return this.get('status') === 'continuing';
|
||||
},
|
||||
route : function () {
|
||||
return '/series/' + this.get('titleSlug');
|
||||
},
|
||||
|
||||
qualityProfile: function () {
|
||||
var profile = QualityProfileCollection.get(this.get('qualityProfileId'));
|
||||
if (profile) {
|
||||
return profile.toJSON();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
|
||||
defaults: {
|
||||
episodeFileCount: 0,
|
||||
episodeCount : 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue