1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Updated index page for movies.

This commit is contained in:
Leonardo Galli 2017-01-05 23:03:34 +01:00
parent 17d7083412
commit be95311471
14 changed files with 276 additions and 47 deletions

View File

@ -25,4 +25,4 @@ module.exports = NzbDroneCell.extend({
return this;
}
});
});

View File

@ -0,0 +1,16 @@
var TemplatedCell = require('./TemplatedCell');
module.exports = TemplatedCell.extend({
className : 'in-cinemas-cell',
render : function() {
var monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
var cinemasDate = new Date(this.model.get("inCinemas"));
var year = cinemasDate.getFullYear();
var month = monthNames[cinemasDate.getMonth()];
this.$el.html(month + " " + year); //Hack, but somehow handlebar helper does not work.
return this;
}
});

View File

@ -0,0 +1,45 @@
var vent = require('vent');
var NzbDroneCell = require('./NzbDroneCell');
var CommandController = require('../Commands/CommandController');
module.exports = NzbDroneCell.extend({
className : 'series-actions-cell',
ui : {
refresh : '.x-refresh'
},
events : {
'click .x-edit' : '_editSeries',
'click .x-refresh' : '_refreshSeries'
},
render : function() {
this.$el.empty();
this.$el.html('<i class="icon-sonarr-refresh x-refresh hidden-xs" title="" data-original-title="Update movie info and scan disk"></i> ' +
'<i class="icon-sonarr-edit x-edit" title="" data-original-title="Edit Movie"></i>');
CommandController.bindToCommand({
element : this.$el.find('.x-refresh'),
command : {
name : 'refreshMovie',
movieId : this.model.get('id')
}
});
this.delegateEvents();
return this;
},
_editSeries : function() {
vent.trigger(vent.Commands.EditSeriesCommand, { series : this.model });
},
_refreshSeries : function() {
CommandController.Execute('refreshMovie', {
name : 'refreshMovie',
movieId : this.model.id
});
}
});

View File

@ -0,0 +1,6 @@
var TemplatedCell = require('./TemplatedCell');
module.exports = TemplatedCell.extend({
className : 'movie-links-cell',
template : 'Cells/MovieLinksTemplate'
});

View File

@ -0,0 +1,11 @@
<span class="series-info-links">
<!--<a href="{{traktUrl}}" class="label label-info">Trakt</a>-->
{{#if website}}
<a href="{{homepage}}" class="label label-info">Homepage</a>
{{/if}}
<a href="{{tmdbUrl}}" class="label label-info">The Movie DB</a>
{{#if imdbId}}
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
{{/if}}
</span>

View File

@ -0,0 +1,46 @@
var NzbDroneCell = require('./NzbDroneCell');
module.exports = NzbDroneCell.extend({
className : 'movie-status-cell',
render : function() {
this.$el.empty();
var monitored = this.model.get('monitored');
var status = this.model.get('status');
var inCinemas = this.model.get("inCinemas");
var date = new Date(inCinemas);
var timeSince = new Date().getTime() - date.getTime();
var numOfMonths = timeSince / 1000 / 60 / 60 / 24 / 30;
if (status === 'released') {
this.$el.html('<i class="icon-sonarr-movie-released grid-icon" title="Released"></i>');
this._setStatusWeight(3);
}
if (numOfMonths > 3) {
this.$el.html('<i class="icon-sonarr-movie-released grid-icon" title="Released"></i>');//TODO: Update for PreDB.me
this._setStatusWeight(2);
}
if (numOfMonths < 3) {
this.$el.html('<i class="icon-sonarr-movie-cinemas grid-icon" title="In Cinemas"></i>');
this._setStatusWeight(2);
}
if (status === "announced") {
this.$el.html('<i class="icon-sonarr-movie-announced grid-icon" title="Announced"></i>');
this._setStatusWeight(1);
}
else if (!monitored) {
this.$el.html('<i class="icon-sonarr-series-unmonitored grid-icon" title="Not Monitored"></i>');
this._setStatusWeight(0);
}
return this;
},
_setStatusWeight : function(weight) {
this.model.set('statusWeight', weight, { silent : true });
}
});

View File

@ -0,0 +1,6 @@
var TemplatedCell = require('./TemplatedCell');
module.exports = TemplatedCell.extend({
className : 'series-title-cell',
template : 'Cells/SeriesTitleTemplate',
});

View File

@ -18,4 +18,4 @@ module.exports = NzbDroneCell.extend({
this.delegateEvents();
return this;
}
});
});

View File

@ -207,6 +207,18 @@
.fa-icon-content(@fa-var-bookmark-o);
}
.icon-sonarr-movie-announced {
.fa-icon-content(@fa-var-bullhorn);
}
.icon-sonarr-movie-released {
.fa-icon-content(@fa-var-file-video-o);
}
.icon-sonarr-movie-cinemas {
.fa-icon-content(@fa-var-ticket);
}
.icon-sonarr-log-info {
.fa-icon-content(@fa-var-info-circle);
.fa-icon-color(dodgerblue);

View File

@ -66,6 +66,65 @@ Handlebars.registerHelper('alternativeTitlesString', function() {
return titles.slice(0,titles.length-1).join(", ") + " and " + titles[titles.length-1];
});
Handlebars.registerHelper('GetStatus', function() {
var monitored = this.monitored;
var status = this.status;
var inCinemas = this.inCinemas;
var date = new Date(inCinemas);
var timeSince = new Date().getTime() - date.getTime();
var numOfMonths = timeSince / 1000 / 60 / 60 / 24 / 30;
if (status === 'released') {
return new Handlebars.SafeString('<i class="icon-sonarr-movie-released grid-icon" title=""></i>&nbsp;Released');
}
if (numOfMonths > 3) {
return new Handlebars.SafeString('<i class="icon-sonarr-movie-released grid-icon" title=""></i>&nbsp;Released');//TODO: Update for PreDB.me
}
if (numOfMonths < 3) {
return new Handlebars.SafeString('<i class="icon-sonarr-movie-cinemas grid-icon" title=""></i>&nbsp;In Cinemas');
}
if (status === "announced") {
return new Handlebars.SafeString('<i class="icon-sonarr-movie-announced grid-icon" title=""></i>&nbsp;Announced');
}
else if (!monitored) {
return new Handlebars.SafeString('<i class="icon-sonarr-series-unmonitored grid-icon" title=""></i>&nbsp;Not Monitored');
}
})
Handlebars.registerHelper('GetBannerStatus', function() {
var monitored = this.monitored;
var status = this.status;
var inCinemas = this.inCinemas;
var date = new Date(inCinemas);
var timeSince = new Date().getTime() - date.getTime();
var numOfMonths = timeSince / 1000 / 60 / 60 / 24 / 30;
if (status === 'released') {
return new Handlebars.SafeString('<div class="released-banner"><i class="icon-sonarr-movie-released grid-icon" title=""></i>&nbsp;Released</div>');
}
if (numOfMonths > 3) {
return new Handlebars.SafeString('<div class="released-banner"><i class="icon-sonarr-movie-released grid-icon" title=""></i>&nbsp;Released</div>');//TODO: Update for PreDB.me
}
if (numOfMonths < 3) {
return new Handlebars.SafeString('<div class="cinemas-banner"><i class="icon-sonarr-movie-cinemas grid-icon" title=""></i>&nbsp;In Cinemas</div>');
}
if (status === "announced") {
return new Handlebars.SafeString('<div class="announced-banner"><i class="icon-sonarr-movie-announced grid-icon" title=""></i>&nbsp;Announced</div>');
}
else if (!monitored) {
return new Handlebars.SafeString('<div class="announced-banner"><i class="icon-sonarr-series-unmonitored grid-icon" title=""></i>&nbsp;Not Monitored</div>');
}
})
Handlebars.registerHelper('inCinemas', function() {
var monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"

View File

@ -5,13 +5,13 @@ var PosterCollectionView = require('./Posters/SeriesPostersCollectionView');
var ListCollectionView = require('./Overview/SeriesOverviewCollectionView');
var EmptyView = require('./EmptyView');
var MoviesCollection = require('../MoviesCollection');
var RelativeDateCell = require('../../Cells/RelativeDateCell');
var SeriesTitleCell = require('../../Cells/SeriesTitleCell');
var InCinemasCell = require('../../Cells/InCinemasCell');
var MovieTitleCell = require('../../Cells/MovieTitleCell2');
var TemplatedCell = require('../../Cells/TemplatedCell');
var ProfileCell = require('../../Cells/ProfileCell');
var EpisodeProgressCell = require('../../Cells/EpisodeProgressCell');
var SeriesActionsCell = require('../../Cells/SeriesActionsCell');
var SeriesStatusCell = require('../../Cells/SeriesStatusCell');
var MovieLinksCell = require('../../Cells/MovieLinksCell');
var MovieActionCell = require('../../Cells/MovieActionCell');
var MovieStatusCell = require('../../Cells/MovieStatusCell');
var FooterView = require('./FooterView');
var FooterModel = require('./FooterModel');
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
@ -31,46 +31,36 @@ module.exports = Marionette.Layout.extend({
{
name : 'statusWeight',
label : '',
cell : SeriesStatusCell
cell : MovieStatusCell
},
{
name : 'title',
label : 'Title',
cell : SeriesTitleCell,
cell : MovieTitleCell,
cellValue : 'this',
sortValue : 'sortTitle'
},
{
name : 'seasonCount',
label : 'Seasons',
cell : 'integer'
},
{
name : 'profileId',
label : 'Profile',
cell : ProfileCell
},
{
name : 'network',
label : 'Network',
cell : 'string'
name : 'inCinemas',
label : 'In Cinemas',
cell : InCinemasCell
},
{
name : 'nextAiring',
label : 'Next Airing',
cell : RelativeDateCell
},
{
name : 'percentOfEpisodes',
label : 'Episodes',
cell : EpisodeProgressCell,
className : 'episode-progress-cell'
name : 'this',
label : 'Links',
cell : MovieLinksCell,
className : "movie-links-cell"
},
{
name : 'this',
label : '',
sortable : false,
cell : SeriesActionsCell
cell : MovieActionCell
}
],

View File

@ -34,21 +34,25 @@
</div>
</div>
<div class="row">
<div class="col-md-10 col-xs-8">
{{#if_eq status compare="ended"}}
<span class="label label-danger">Ended</span>
{{/if_eq}}
<div class="col-md-8 col-xs-8">
<span class="label label-default">{{GetStatus}}</span>
{{#if nextAiring}}
<span class="label label-default">{{RelativeDate nextAiring}}</span>
{{/if}}
{{seasonCountHelper}}
<span class="label label-default">{{inCinemas}}</span>
{{profile profileId}}
</div>
<div class="col-md-2 col-xs-4">
{{> EpisodeProgressPartial }}
<div class="col-md-4 col-xs-4">
<span class="movie-info-links">
<!--<a href="{{traktUrl}}" class="label label-info">Trakt</a>-->
{{#if website}}
<a href="{{homepage}}" class="label label-info">Homepage</a>
{{/if}}
<a href="{{tmdbUrl}}" class="label label-info">The Movie DB</a>
{{#if imdbId}}
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
{{/if}}
</span>
</div>
</div>
</div>

View File

@ -5,9 +5,7 @@
<i class="icon-sonarr-refresh x-refresh" title="Refresh Movie"/>
<i class="icon-sonarr-edit x-edit" title="Edit Movie"/>
</div>
{{#unless_eq status compare="released"}}
<div class="ended-banner">Released</div>
{{/unless_eq}}
{{GetBannerStatus}}
<a href="{{route}}">
{{poster}}
<div class="center title">{{title}}</div>
@ -20,11 +18,15 @@
<div class="center">
<div class="labels">
{{> EpisodeProgressPartial }}
{{#if nextAiring}}
<span class="label label-default">{{RelativeDate nextAiring}}</span>
{{/if}}
{{#if website}}
<a href="{{homepage}}" class="label label-info">Homepage</a>
{{/if}}
<a href="{{tmdbUrl}}" class="label label-info">The Movie DB</a>
{{#if imdbId}}
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
{{/if}}
</div>
</div>
</div>

View File

@ -120,7 +120,7 @@
.card;
.clickable;
margin-bottom : 20px;
height : 315px;
height : 324px;
.center {
display : block;
@ -200,7 +200,39 @@
font-weight: 100;
}
.ended-banner {
.announced-banner {
color : #eeeeee;
background-color : #777;
.box-shadow(2px 2px 20px #888888);
-moz-transform-origin : 50% 50%;
-webkit-transform-origin : 50% 50%;
position : absolute;
width : 320px;
top : 200px;
left : -122px;
text-align : center;
.opacity(0.9);
.transform(rotate(45deg));
}
.released-banner {
color : #eeeeee;
background-color : #5cb85c;
.box-shadow(2px 2px 20px #888888);
-moz-transform-origin : 50% 50%;
-webkit-transform-origin : 50% 50%;
position : absolute;
width : 320px;
top : 200px;
left : -122px;
text-align : center;
.opacity(0.9);
.transform(rotate(45deg));
}
.cinemas-banner {
color : #eeeeee;
background-color : #b94a48;
.box-shadow(2px 2px 20px #888888);