@ -1,8 +1,8 @@
var _ = require ( 'underscore' ) ;
var Marionette = require ( 'marionette' ) ;
var Backgrid = require ( 'backgrid' ) ;
var PosterCollectionView = require ( './Posters/ Series PostersCollectionView') ;
var ListCollectionView = require ( './Overview/ Series OverviewCollectionView') ;
var PosterCollectionView = require ( './Posters/ Movie PostersCollectionView') ;
var ListCollectionView = require ( './Overview/ Movie OverviewCollectionView') ;
var EmptyView = require ( './EmptyView' ) ;
var MoviesCollection = require ( '../MoviesCollection' ) ;
@ -37,10 +37,10 @@ module.exports = Marionette.Layout.extend({
template : 'Movies/Index/MoviesIndexLayoutTemplate' ,
regions : {
seriesRegion : '#x-ser ies',
moviesRegion : '#x-mov ies',
toolbar : '#x-toolbar' ,
toolbar2 : '#x-toolbar2' ,
footer : '#x- ser ies-footer',
footer : '#x- mov ies-footer',
pager : "#x-movie-pager" ,
pagerTop : "#x-movie-pager-top"
} ,
@ -112,29 +112,29 @@ module.exports = Marionette.Layout.extend({
items : [
{
title : 'Add Movie' ,
icon : 'icon- son arr-add',
icon : 'icon- rad arr-add',
route : 'addmovies'
} ,
{
title : 'Movie Editor' ,
icon : 'icon- son arr-edit',
icon : 'icon- rad arr-edit',
route : 'movieeditor'
} ,
{
title : 'RSS Sync' ,
icon : 'icon- son arr-rss',
icon : 'icon- rad arr-rss',
command : 'rsssync' ,
errorMessage : 'RSS Sync Failed!'
} ,
{
title : "PreDB Sync" ,
icon : "icon- son arr-refresh",
icon : "icon- rad arr-refresh",
command : "predbsync" ,
errorMessage : "PreDB Sync Failed!"
} ,
{
title : 'Update Library' ,
icon : 'icon- son arr-refresh',
icon : 'icon- rad arr-refresh',
command : 'refreshmovie' ,
successMessage : 'Library was updated!' ,
errorMessage : 'Library update failed!'
@ -143,19 +143,19 @@ module.exports = Marionette.Layout.extend({
} ,
initialize : function ( ) {
//this variable prevents us from showing the list before ser iesCollection has been fetched the first time
this . ser iesCollection = MoviesCollection . clone ( ) ;
//this variable prevents us from showing the list before mov iesCollection has been fetched the first time
this . mov iesCollection = MoviesCollection . clone ( ) ;
//debugger;
this . ser iesCollection. bindSignalR ( ) ;
this . mov iesCollection. bindSignalR ( ) ;
var pageSize = parseInt ( Config . getValue ( "pageSize" ) ) || 10 ;
if ( this . ser iesCollection. state . pageSize !== pageSize ) {
this . ser iesCollection. setPageSize ( pageSize ) ;
if ( this . mov iesCollection. state . pageSize !== pageSize ) {
this . mov iesCollection. setPageSize ( pageSize ) ;
}
//this.listenTo(MoviesCollection, 'sync', function() {
// this. ser iesCollection.fetch();
// this. mov iesCollection.fetch();
//});
this . listenToOnce ( this . ser iesCollection, 'sync' , function ( ) {
this . listenToOnce ( this . mov iesCollection, 'sync' , function ( ) {
this . _showToolbar ( ) ;
//this._fetchCollection();
if ( window . shownOnce ) {
@ -171,14 +171,14 @@ module.exports = Marionette.Layout.extend({
this . _showFooter ( ) ;
} ) ;
/ * t h i s . l i s t e n T o ( t h i s . se r i e s C o l l e c t i o n , ' s y n c ' , f u n c t i o n ( m o d e l , c o l l e c t i o n , o p t i o n s ) {
/ * t h i s . l i s t e n T o ( t h i s . mo v i e s C o l l e c t i o n , ' s y n c ' , f u n c t i o n ( m o d e l , c o l l e c t i o n , o p t i o n s ) {
this . _renderView ( ) ;
//MoviesCollectionClient.fetch();
} ) ; * /
this . listenTo ( this . ser iesCollection, "change" , function ( model ) {
this . listenTo ( this . mov iesCollection, "change" , function ( model ) {
if ( model . get ( 'saved' ) ) {
model . set ( 'saved' , false ) ;
this . ser iesCollection. fetch ( ) ;
this . mov iesCollection. fetch ( ) ;
//FullMovieCollection.fetch({reset : true });
//this._showFooter();
var m = FullMovieCollection . findWhere ( { tmdbId : model . get ( 'tmdbId' ) } ) ;
@ -191,22 +191,22 @@ module.exports = Marionette.Layout.extend({
} ) ;
this . listenTo ( this . ser iesCollection, 'remove' , function ( model , collection , options ) {
this . listenTo ( this . mov iesCollection, 'remove' , function ( model , collection , options ) {
if ( model . get ( 'deleted' ) ) {
this . ser iesCollection. fetch ( ) ; //need to do this so that the page shows a full page and the 'total records' number is updated
this . mov iesCollection. fetch ( ) ; //need to do this so that the page shows a full page and the 'total records' number is updated
//FullMovieCollection.fetch({reset : true}); //need to do this to update the footer
FullMovieCollection . remove ( model ) ;
this . _showFooter ( ) ;
}
} ) ;
//this. ser iesCollection.setPageSize(pageSize);
//this. mov iesCollection.setPageSize(pageSize);
this . sortingOptions = {
type : 'sorting' ,
storeState : false ,
viewCollection : this . ser iesCollection,
viewCollection : this . mov iesCollection,
callback : this . _sort ,
items : [
{
@ -235,56 +235,56 @@ module.exports = Marionette.Layout.extend({
this . filteringOptions = {
type : 'radio' ,
storeState : true ,
menuKey : ' series .filterMode',
menuKey : ' movie .filterMode',
defaultAction : 'all' ,
items : [
{
key : 'all' ,
title : '' ,
tooltip : 'All' ,
icon : 'icon- son arr-all',
icon : 'icon- rad arr-all',
callback : this . _setFilter
} ,
{
key : 'monitored' ,
title : '' ,
tooltip : 'Monitored Only' ,
icon : 'icon- son arr-monitored',
icon : 'icon- rad arr-monitored',
callback : this . _setFilter
} ,
{
key : 'unmonitored' ,
title : '' ,
tooltip : 'UnMonitored Only' ,
icon : 'icon- son arr-unmonitored',
icon : 'icon- rad arr-unmonitored',
callback : this . _setFilter
} ,
{
key : 'missing' ,
title : '' ,
tooltip : 'Missing Only' ,
icon : 'icon- son arr-missing',
icon : 'icon- rad arr-missing',
callback : this . _setFilter
} ,
{
key : 'released' ,
title : '' ,
tooltip : 'Released' ,
icon : 'icon- son arr-movie-released',
icon : 'icon- rad arr-movie-released',
callback : this . _setFilter
} ,
{
key : 'announced' ,
title : '' ,
tooltip : 'Announced' ,
icon : 'icon- son arr-movie-announced',
icon : 'icon- rad arr-movie-announced',
callback : this . _setFilter
} ,
{
key : 'cinemas' ,
title : '' ,
tooltip : 'In Cinemas' ,
icon : 'icon- son arr-movie-cinemas',
icon : 'icon- rad arr-movie-cinemas',
callback : this . _setFilter
}
]
@ -293,28 +293,28 @@ module.exports = Marionette.Layout.extend({
this . viewButtons = {
type : 'radio' ,
storeState : true ,
menuKey : ' ser iesViewMode',
menuKey : ' mov iesViewMode',
defaultAction : 'listView' ,
items : [
{
key : 'posterView' ,
title : '' ,
tooltip : 'Posters' ,
icon : 'icon- son arr-view-poster',
icon : 'icon- rad arr-view-poster',
callback : this . _showPosters
} ,
{
key : 'listView' ,
title : '' ,
tooltip : 'Overview List' ,
icon : 'icon- son arr-view-list',
icon : 'icon- rad arr-view-list',
callback : this . _showList
} ,
{
key : 'tableView' ,
title : '' ,
tooltip : 'Table' ,
icon : 'icon- son arr-view-table',
icon : 'icon- rad arr-view-table',
callback : this . _showTable
}
]
@ -328,7 +328,7 @@ module.exports = Marionette.Layout.extend({
} ,
onShow : function ( ) {
/ * t h i s . l i s t e n T o O n c e ( t h i s . se r i e s C o l l e c t i o n , ' s y n c ' , f u n c t i o n ( ) {
/ * t h i s . l i s t e n T o O n c e ( t h i s . mo v i e s C o l l e c t i o n , ' s y n c ' , f u n c t i o n ( ) {
this . _showToolbar ( ) ;
//this._fetchCollection();
if ( window . shownOnce ) {
@ -341,7 +341,7 @@ module.exports = Marionette.Layout.extend({
_showTable : function ( ) {
this . currentView = new Backgrid . Grid ( {
collection : this . ser iesCollection,
collection : this . mov iesCollection,
columns : this . columns ,
className : 'table table-hover'
} ) ;
@ -353,7 +353,7 @@ module.exports = Marionette.Layout.extend({
_showList : function ( ) {
//this.current = "list";
this . currentView = new ListCollectionView ( {
collection : this . ser iesCollection
collection : this . mov iesCollection
} ) ;
this . _renderView ( ) ;
@ -361,7 +361,7 @@ module.exports = Marionette.Layout.extend({
_showPosters : function ( ) {
this . currentView = new PosterCollectionView ( {
collection : this . ser iesCollection
collection : this . mov iesCollection
} ) ;
this . _renderView ( ) ;
@ -373,13 +373,13 @@ module.exports = Marionette.Layout.extend({
_renderView : function ( ) {
if ( MoviesCollection . length === 0 ) {
this . ser iesRegion. show ( new EmptyView ( ) ) ;
this . mov iesRegion. show ( new EmptyView ( ) ) ;
this . toolbar . close ( ) ;
this . toolbar2 . close ( ) ;
} else {
this . renderedOnce = true ;
this . ser iesRegion. show ( this . currentView ) ;
this . mov iesRegion. show ( this . currentView ) ;
this . listenTo ( this . currentView . collection , 'sync' , function ( eventName ) {
this . _showPager ( ) ;
} ) ;
@ -388,12 +388,12 @@ module.exports = Marionette.Layout.extend({
} ,
_fetchCollection : function ( ) {
this . ser iesCollection. fetch ( ) ;
this . mov iesCollection. fetch ( ) ;
} ,
_setFilter : function ( buttonContext ) {
var mode = buttonContext . model . get ( 'key' ) ;
this . ser iesCollection. setFilterMode ( mode ) ;
this . mov iesCollection. setFilterMode ( mode ) ;
} ,
_showToolbar : function ( ) {
@ -424,11 +424,11 @@ module.exports = Marionette.Layout.extend({
_showPager : function ( ) {
var pager = new GridPager ( {
columns : this . columns ,
collection : this . ser iesCollection,
collection : this . mov iesCollection,
} ) ;
var pagerTop = new GridPager ( {
columns : this . columns ,
collection : this . ser iesCollection,
collection : this . mov iesCollection,
} ) ;
this . pager . show ( pager ) ;
this . pagerTop . show ( pagerTop ) ;
@ -503,18 +503,18 @@ module.exports = Marionette.Layout.extend({
} ) ;
footerModel . set ( {
movies : movies ,
announced : announced ,
incinemas : incinemas ,
released : released ,
monitored : monitored ,
downloaded : downloaded ,
downloadedMonitored : downloadedMonitored ,
downloadedNotMonitored : downloadedNotMonitored ,
missingMonitored : missingMonitored ,
missingMonitoredAvailable : missingMonitoredAvailable ,
missingMonitoredNotAvailable : missingMonitoredNotAvailable ,
missingNotMonitored : missingNotMonitored
movies : movies ,
announced : announced ,
incinemas : incinemas ,
released : released ,
monitored : monitored ,
downloaded : downloaded ,
downloadedMonitored : downloadedMonitored ,
downloadedNotMonitored : downloadedNotMonitored ,
missingMonitored : missingMonitored ,
missingMonitoredAvailable : missingMonitoredAvailable ,
missingMonitoredNotAvailable : missingMonitoredNotAvailable ,
missingNotMonitored : missingNotMonitored
} ) ;
this . footer . show ( new FooterView ( { model : footerModel } ) ) ;