Merge pull request #974 from geogolem/MovieEditorFixes
revert some changes -- use FullCollection (maybe just for now)pull/980/head
commit
e742371d15
@ -1,12 +1,12 @@
|
|||||||
/*var movieCollection = require('./MoviesCollection');
|
var movieCollection = require('./MoviesCollection');
|
||||||
|
|
||||||
var fullCollection = movieCollection.clone();
|
var fullCollection = movieCollection.clone();
|
||||||
fullCollection.bindSignalR();
|
fullCollection.bindSignalR();
|
||||||
fullCollection.state.pageSize = 100000;
|
fullCollection.state.pageSize = 100000;
|
||||||
fullCollection.fetch({reset : true});
|
fullCollection.fetch({reset : true});
|
||||||
module.exports = fullCollection;*/
|
module.exports = fullCollection;
|
||||||
|
|
||||||
var movieCollection = require('./MoviesCollectionClient');
|
/*var movieCollection = require('./MoviesCollectionClient');
|
||||||
|
|
||||||
movieCollection.bindSignalR();
|
movieCollection.bindSignalR();
|
||||||
module.exports = movieCollection.fullCollection;
|
module.exports = movieCollection.fullCollection;*/
|
||||||
|
@ -1,487 +1,476 @@
|
|||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var Marionette = require('marionette');
|
var Marionette = require('marionette');
|
||||||
var Backgrid = require('backgrid');
|
var Backgrid = require('backgrid');
|
||||||
var PosterCollectionView = require('./Posters/SeriesPostersCollectionView');
|
var PosterCollectionView = require('./Posters/SeriesPostersCollectionView');
|
||||||
var ListCollectionView = require('./Overview/SeriesOverviewCollectionView');
|
var ListCollectionView = require('./Overview/SeriesOverviewCollectionView');
|
||||||
var EmptyView = require('./EmptyView');
|
var EmptyView = require('./EmptyView');
|
||||||
var MoviesCollection = require('../MoviesCollection');
|
var MoviesCollection = require('../MoviesCollection');
|
||||||
//var FullMovieCollection = require('../FullMovieCollection');
|
|
||||||
//var InCinemasCell = require('../../Cells/InCinemasCell');
|
var FullMovieCollection = require('../FullMovieCollection');
|
||||||
var RelativeDateCell = require('../../Cells/RelativeDateCell');
|
var InCinemasCell = require('../../Cells/InCinemasCell');
|
||||||
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
|
||||||
var TemplatedCell = require('../../Cells/TemplatedCell');
|
var RelativeDateCell = require('../../Cells/RelativeDateCell');
|
||||||
var ProfileCell = require('../../Cells/ProfileCell');
|
|
||||||
var MovieLinksCell = require('../../Cells/MovieLinksCell');
|
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
||||||
var MovieActionCell = require('../../Cells/MovieActionCell');
|
var TemplatedCell = require('../../Cells/TemplatedCell');
|
||||||
var MovieStatusCell = require('../../Cells/MovieStatusCell');
|
var ProfileCell = require('../../Cells/ProfileCell');
|
||||||
var MovieDownloadStatusCell = require('../../Cells/MovieDownloadStatusCell');
|
var MovieLinksCell = require('../../Cells/MovieLinksCell');
|
||||||
var DownloadedQualityCell = require('../../Cells/DownloadedQualityCell');
|
var MovieActionCell = require('../../Cells/MovieActionCell');
|
||||||
var FooterView = require('./FooterView');
|
var MovieStatusCell = require('../../Cells/MovieStatusCell');
|
||||||
var GridPager = require('../../Shared/Grid/Pager');
|
var MovieDownloadStatusCell = require('../../Cells/MovieDownloadStatusCell');
|
||||||
var FooterModel = require('./FooterModel');
|
var DownloadedQualityCell = require('../../Cells/DownloadedQualityCell');
|
||||||
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
|
var FooterView = require('./FooterView');
|
||||||
require('../../Mixins/backbone.signalr.mixin');
|
var GridPager = require('../../Shared/Grid/Pager');
|
||||||
|
var FooterModel = require('./FooterModel');
|
||||||
var MoviesCollectionClient = require('../MoviesCollectionClient');
|
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
|
||||||
|
require('../../Mixins/backbone.signalr.mixin');
|
||||||
|
|
||||||
//this variable prevents double fetching the FullMovieCollection on first load
|
//var MoviesCollectionClient = require('../MoviesCollectionClient');
|
||||||
//var shownOnce = false;
|
|
||||||
//require('../Globals');
|
|
||||||
window.shownOnce = false;
|
//this variable prevents double fetching the FullMovieCollection on first load
|
||||||
module.exports = Marionette.Layout.extend({
|
//var shownOnce = false;
|
||||||
template : 'Movies/Index/MoviesIndexLayoutTemplate',
|
//require('../Globals');
|
||||||
|
window.shownOnce = false;
|
||||||
regions : {
|
module.exports = Marionette.Layout.extend({
|
||||||
seriesRegion : '#x-series',
|
template : 'Movies/Index/MoviesIndexLayoutTemplate',
|
||||||
toolbar : '#x-toolbar',
|
|
||||||
toolbar2 : '#x-toolbar2',
|
regions : {
|
||||||
footer : '#x-series-footer',
|
seriesRegion : '#x-series',
|
||||||
pager : "#x-movie-pager",
|
toolbar : '#x-toolbar',
|
||||||
pagerTop : "#x-movie-pager-top"
|
toolbar2 : '#x-toolbar2',
|
||||||
},
|
footer : '#x-series-footer',
|
||||||
|
pager : "#x-movie-pager",
|
||||||
columns : [
|
pagerTop : "#x-movie-pager-top"
|
||||||
{
|
},
|
||||||
name : 'status',
|
|
||||||
label : '',
|
columns : [
|
||||||
cell : MovieStatusCell
|
{
|
||||||
},
|
name : 'status',
|
||||||
{
|
label : '',
|
||||||
name : 'title',
|
cell : MovieStatusCell
|
||||||
label : 'Title',
|
},
|
||||||
cell : MovieTitleCell,
|
{
|
||||||
cellValue : 'this',
|
name : 'title',
|
||||||
},
|
label : 'Title',
|
||||||
{
|
cell : MovieTitleCell,
|
||||||
name : 'added',
|
cellValue : 'this',
|
||||||
label : 'Date Added',
|
},
|
||||||
cell : RelativeDateCell
|
{
|
||||||
},
|
name : 'added',
|
||||||
{
|
label : 'Date Added',
|
||||||
name : "downloadedQuality",
|
cell : RelativeDateCell
|
||||||
label : "Downloaded",
|
},
|
||||||
cell : DownloadedQualityCell,
|
{
|
||||||
sortable : true
|
name : "downloadedQuality",
|
||||||
},
|
label : "Downloaded",
|
||||||
{
|
cell : DownloadedQualityCell,
|
||||||
name : 'profileId',
|
sortable : true
|
||||||
label : 'Profile',
|
},
|
||||||
cell : ProfileCell
|
{
|
||||||
},
|
name : 'profileId',
|
||||||
{
|
label : 'Profile',
|
||||||
name : 'inCinemas',
|
cell : ProfileCell
|
||||||
label : 'In Cinemas',
|
},
|
||||||
cell : RelativeDateCell
|
{
|
||||||
},
|
name : 'inCinemas',
|
||||||
{
|
label : 'In Cinemas',
|
||||||
name : 'this',
|
cell : RelativeDateCell
|
||||||
label : 'Links',
|
},
|
||||||
cell : MovieLinksCell,
|
{
|
||||||
className : "movie-links-cell",
|
name : 'this',
|
||||||
sortable : false,
|
label : 'Links',
|
||||||
},
|
cell : MovieLinksCell,
|
||||||
{
|
className : "movie-links-cell",
|
||||||
name : "this",
|
sortable : false,
|
||||||
label : "Status",
|
},
|
||||||
cell : MovieDownloadStatusCell,
|
{
|
||||||
sortable : false,
|
name : "this",
|
||||||
sortValue : function(m, k) {
|
label : "Status",
|
||||||
if (m.get("downloaded")) {
|
cell : MovieDownloadStatusCell,
|
||||||
return -1;
|
sortable : false,
|
||||||
}
|
sortValue : function(m, k) {
|
||||||
return 0;
|
if (m.get("downloaded")) {
|
||||||
}
|
return -1;
|
||||||
},
|
}
|
||||||
{
|
return 0;
|
||||||
name : 'this',
|
}
|
||||||
label : '',
|
},
|
||||||
sortable : false,
|
{
|
||||||
cell : MovieActionCell
|
name : 'this',
|
||||||
}
|
label : '',
|
||||||
],
|
sortable : false,
|
||||||
|
cell : MovieActionCell
|
||||||
leftSideButtons : {
|
}
|
||||||
type : 'default',
|
],
|
||||||
storeState : false,
|
|
||||||
collapse : true,
|
leftSideButtons : {
|
||||||
items : [
|
type : 'default',
|
||||||
{
|
storeState : false,
|
||||||
title : 'Add Movie',
|
collapse : true,
|
||||||
icon : 'icon-sonarr-add',
|
items : [
|
||||||
route : 'addmovies'
|
{
|
||||||
},
|
title : 'Add Movie',
|
||||||
{
|
icon : 'icon-sonarr-add',
|
||||||
title : 'Movie Editor',
|
route : 'addmovies'
|
||||||
icon : 'icon-sonarr-edit',
|
},
|
||||||
route : 'movieeditor'
|
{
|
||||||
},
|
title : 'Movie Editor',
|
||||||
{
|
icon : 'icon-sonarr-edit',
|
||||||
title : 'RSS Sync',
|
route : 'movieeditor'
|
||||||
icon : 'icon-sonarr-rss',
|
},
|
||||||
command : 'rsssync',
|
{
|
||||||
errorMessage : 'RSS Sync Failed!'
|
title : 'RSS Sync',
|
||||||
},
|
icon : 'icon-sonarr-rss',
|
||||||
{
|
command : 'rsssync',
|
||||||
title : 'Update Library',
|
errorMessage : 'RSS Sync Failed!'
|
||||||
icon : 'icon-sonarr-refresh',
|
},
|
||||||
command : 'refreshmovie',
|
{
|
||||||
successMessage : 'Library was updated!',
|
title : 'Update Library',
|
||||||
errorMessage : 'Library update failed!'
|
icon : 'icon-sonarr-refresh',
|
||||||
}
|
command : 'refreshmovie',
|
||||||
]
|
successMessage : 'Library was updated!',
|
||||||
},
|
errorMessage : 'Library update failed!'
|
||||||
|
}
|
||||||
initialize : function() {
|
]
|
||||||
//this variable prevents us from showing the list before seriesCollection has been fetched the first time
|
},
|
||||||
this.renderedOnce = false;
|
|
||||||
this.seriesCollection = MoviesCollection;//.clone();
|
initialize : function() {
|
||||||
this.seriesCollection.bindSignalR();
|
//this variable prevents us from showing the list before seriesCollection has been fetched the first time
|
||||||
|
this.seriesCollection = MoviesCollection;//.clone();
|
||||||
|
this.seriesCollection.bindSignalR();
|
||||||
|
|
||||||
/*var selected = MoviesCollectionClient.fullCollection.where( { saved : true });
|
this.listenTo(FullMovieCollection, 'sync', function() {
|
||||||
|
this._showFooter();
|
||||||
_.each(selected, function(model) {
|
});
|
||||||
model.set('saved', false);
|
|
||||||
});*/
|
this.listenTo(this.seriesCollection, 'sync', function(model, collection, options) {
|
||||||
|
this._renderView();
|
||||||
|
//MoviesCollectionClient.fetch();
|
||||||
|
});
|
||||||
//if (window.shownOnce) {
|
this.listenTo(this.seriesCollection, "change", function(model) {
|
||||||
// FullMovieCollection.fetch({reset : true});
|
if (model.get('saved')) {
|
||||||
//}
|
model.set('saved', false);
|
||||||
|
this.seriesCollection.fetch();
|
||||||
this.listenTo(MoviesCollectionClient, 'sync', function(eventName) {
|
//FullMovieCollection.fetch({reset : true });
|
||||||
this._showFooter();
|
//this._showFooter();
|
||||||
window.shownOnce = true;
|
var m = FullMovieCollection.findWhere( { tmdbId : model.get('tmdbId') });
|
||||||
});
|
m.set('monitored', model.get('monitored'));
|
||||||
|
m.set('minimumAvailability', model.get('minimumAvailability'));
|
||||||
this.listenTo(this.seriesCollection, 'sync', function(model, collection, options) {
|
m.set( {profileId : model.get('profileId') } );
|
||||||
this._renderView();
|
|
||||||
//MoviesCollectionClient.fetch();
|
this._showFooter();
|
||||||
this.renderedOnce = true;
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.listenTo(this.seriesCollection, "change", function(model) {
|
|
||||||
if (model.get('saved')) {
|
this.listenTo(this.seriesCollection, 'remove', function(model, collection, options) {
|
||||||
model.set('saved', false);
|
if (model.get('deleted')) {
|
||||||
this.seriesCollection.fetch();
|
this.seriesCollection.fetch(); //need to do this so that the page shows a full page and the 'total records' number is updated
|
||||||
//FullMovieCollection.fetch({reset : true });
|
//FullMovieCollection.fetch({reset : true}); //need to do this to update the footer
|
||||||
//this._showFooter();
|
FullMovieCollection.remove(model);
|
||||||
var m = MoviesCollectionClient.fullCollection.findWhere( { tmdbId : model.get('tmdbId') });
|
this._showFooter();
|
||||||
m.set('monitored', model.get('monitored'));
|
}
|
||||||
m.set('minimumAvailability', model.get('minimumAvailability'));
|
|
||||||
m.set( {profileId : model.get('profileId') } );
|
});
|
||||||
|
|
||||||
|
this.sortingOptions = {
|
||||||
this._showFooter();
|
type : 'sorting',
|
||||||
}
|
storeState : false,
|
||||||
});
|
viewCollection : this.seriesCollection,
|
||||||
|
callback : this._sort,
|
||||||
|
items : [
|
||||||
this.listenTo(this.seriesCollection, 'remove', function(model, collection, options) {
|
{
|
||||||
if (model.get('deleted')) {
|
title : 'Title',
|
||||||
this.seriesCollection.fetch(); //need to do this so that the page shows a full page and the 'total records' number is updated
|
name : 'title'
|
||||||
//FullMovieCollection.fetch({reset : true}); //need to do this to update the footer
|
},
|
||||||
MoviesCollectionClient.fullCollection.remove(model);
|
{
|
||||||
this._showFooter();
|
title: 'Downloaded',
|
||||||
}
|
name: 'downloadedQuality'
|
||||||
|
},
|
||||||
});
|
{
|
||||||
|
title : 'Profile',
|
||||||
this.sortingOptions = {
|
name : 'profileId'
|
||||||
type : 'sorting',
|
},
|
||||||
storeState : false,
|
{
|
||||||
viewCollection : this.seriesCollection,
|
title : 'In Cinemas',
|
||||||
callback : this._sort,
|
name : 'inCinemas'
|
||||||
items : [
|
},
|
||||||
{
|
/*{
|
||||||
title : 'Title',
|
title : "Status",
|
||||||
name : 'title'
|
name : "status",
|
||||||
},
|
}*/
|
||||||
{
|
]
|
||||||
title: 'Downloaded',
|
};
|
||||||
name: 'downloadedQuality'
|
|
||||||
},
|
this.filteringOptions = {
|
||||||
{
|
type : 'radio',
|
||||||
title : 'Profile',
|
storeState : true,
|
||||||
name : 'profileId'
|
menuKey : 'series.filterMode',
|
||||||
},
|
defaultAction : 'all',
|
||||||
{
|
items : [
|
||||||
title : 'In Cinemas',
|
{
|
||||||
name : 'inCinemas'
|
key : 'all',
|
||||||
},
|
title : '',
|
||||||
/*{
|
tooltip : 'All',
|
||||||
title : "Status",
|
icon : 'icon-sonarr-all',
|
||||||
name : "status",
|
callback : this._setFilter
|
||||||
}*/
|
},
|
||||||
]
|
{
|
||||||
};
|
key : 'monitored',
|
||||||
|
title : '',
|
||||||
this.filteringOptions = {
|
tooltip : 'Monitored Only',
|
||||||
type : 'radio',
|
icon : 'icon-sonarr-monitored',
|
||||||
storeState : true,
|
callback : this._setFilter
|
||||||
menuKey : 'series.filterMode',
|
},
|
||||||
defaultAction : 'all',
|
{
|
||||||
items : [
|
key : 'missing',
|
||||||
{
|
title : '',
|
||||||
key : 'all',
|
tooltip : 'Missing Only',
|
||||||
title : '',
|
icon : 'icon-sonarr-missing',
|
||||||
tooltip : 'All',
|
callback : this._setFilter
|
||||||
icon : 'icon-sonarr-all',
|
},
|
||||||
callback : this._setFilter
|
{
|
||||||
},
|
key : 'released',
|
||||||
{
|
title : '',
|
||||||
key : 'monitored',
|
tooltip : 'Released',
|
||||||
title : '',
|
icon : 'icon-sonarr-movie-released',
|
||||||
tooltip : 'Monitored Only',
|
callback : this._setFilter
|
||||||
icon : 'icon-sonarr-monitored',
|
},
|
||||||
callback : this._setFilter
|
{
|
||||||
},
|
key : 'announced',
|
||||||
{
|
title : '',
|
||||||
key : 'missing',
|
tooltip : 'Announced',
|
||||||
title : '',
|
icon : 'icon-sonarr-movie-announced',
|
||||||
tooltip : 'Missing Only',
|
callback : this._setFilter
|
||||||
icon : 'icon-sonarr-missing',
|
},
|
||||||
callback : this._setFilter
|
{
|
||||||
},
|
key : 'cinemas',
|
||||||
{
|
title : '',
|
||||||
key : 'released',
|
tooltip : 'In Cinemas',
|
||||||
title : '',
|
icon : 'icon-sonarr-movie-cinemas',
|
||||||
tooltip : 'Released',
|
callback : this._setFilter
|
||||||
icon : 'icon-sonarr-movie-released',
|
}
|
||||||
callback : this._setFilter
|
]
|
||||||
},
|
};
|
||||||
{
|
|
||||||
key : 'announced',
|
this.viewButtons = {
|
||||||
title : '',
|
type : 'radio',
|
||||||
tooltip : 'Announced',
|
storeState : true,
|
||||||
icon : 'icon-sonarr-movie-announced',
|
menuKey : 'seriesViewMode',
|
||||||
callback : this._setFilter
|
defaultAction : 'listView',
|
||||||
},
|
items : [
|
||||||
{
|
{
|
||||||
key : 'cinemas',
|
key : 'posterView',
|
||||||
title : '',
|
title : '',
|
||||||
tooltip : 'In Cinemas',
|
tooltip : 'Posters',
|
||||||
icon : 'icon-sonarr-movie-cinemas',
|
icon : 'icon-sonarr-view-poster',
|
||||||
callback : this._setFilter
|
callback : this._showPosters
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
};
|
key : 'listView',
|
||||||
|
title : '',
|
||||||
this.viewButtons = {
|
tooltip : 'Overview List',
|
||||||
type : 'radio',
|
icon : 'icon-sonarr-view-list',
|
||||||
storeState : true,
|
callback : this._showList
|
||||||
menuKey : 'seriesViewMode',
|
},
|
||||||
defaultAction : 'listView',
|
{
|
||||||
items : [
|
key : 'tableView',
|
||||||
{
|
title : '',
|
||||||
key : 'posterView',
|
tooltip : 'Table',
|
||||||
title : '',
|
icon : 'icon-sonarr-view-table',
|
||||||
tooltip : 'Posters',
|
callback : this._showTable
|
||||||
icon : 'icon-sonarr-view-poster',
|
}
|
||||||
callback : this._showPosters
|
]
|
||||||
},
|
};
|
||||||
{
|
},
|
||||||
key : 'listView',
|
|
||||||
title : '',
|
onShow : function() {
|
||||||
tooltip : 'Overview List',
|
this._showToolbar();
|
||||||
icon : 'icon-sonarr-view-list',
|
this._fetchCollection();
|
||||||
callback : this._showList
|
if (window.shownOnce) {
|
||||||
},
|
this._showFooter();
|
||||||
{
|
}
|
||||||
key : 'tableView',
|
window.shownOnce = true;
|
||||||
title : '',
|
},
|
||||||
tooltip : 'Table',
|
|
||||||
icon : 'icon-sonarr-view-table',
|
_showTable : function() {
|
||||||
callback : this._showTable
|
this.currentView = new Backgrid.Grid({
|
||||||
}
|
collection : this.seriesCollection,
|
||||||
]
|
columns : this.columns,
|
||||||
};
|
className : 'table table-hover'
|
||||||
},
|
});
|
||||||
|
|
||||||
onShow : function() {
|
this._showPager();
|
||||||
this._showToolbar();
|
this._renderView();
|
||||||
//if (window.shownOnce) {
|
},
|
||||||
this._showFooter();
|
|
||||||
//}
|
_showList : function() {
|
||||||
//this._fetchCollection();
|
//this.current = "list";
|
||||||
},
|
this.currentView = new ListCollectionView({
|
||||||
|
collection : this.seriesCollection
|
||||||
_showTable : function() {
|
});
|
||||||
this.currentView = new Backgrid.Grid({
|
|
||||||
collection : this.seriesCollection,
|
this._renderView();
|
||||||
columns : this.columns,
|
},
|
||||||
className : 'table table-hover'
|
|
||||||
});
|
_showPosters : function() {
|
||||||
|
this.currentView = new PosterCollectionView({
|
||||||
//this._showPager();
|
collection : this.seriesCollection
|
||||||
if (this.renderedOnce) {
|
});
|
||||||
this._renderView();
|
|
||||||
}
|
this._renderView();
|
||||||
},
|
},
|
||||||
|
|
||||||
_showList : function() {
|
_sort : function() {
|
||||||
//this.current = "list";
|
console.warn("Sorting");
|
||||||
this.currentView = new ListCollectionView({
|
},
|
||||||
collection : this.seriesCollection
|
|
||||||
});
|
_renderView : function() {
|
||||||
|
if (MoviesCollection.length === 0) {
|
||||||
this._renderView();
|
this.seriesRegion.show(new EmptyView());
|
||||||
},
|
|
||||||
|
this.toolbar.close();
|
||||||
_showPosters : function() {
|
this.toolbar2.close();
|
||||||
this.currentView = new PosterCollectionView({
|
} else {
|
||||||
collection : this.seriesCollection
|
this.renderedOnce = true;
|
||||||
});
|
this.seriesRegion.show(this.currentView);
|
||||||
|
this.listenTo(this.currentView.collection, 'sync', function(eventName){
|
||||||
this._renderView();
|
this._showPager();
|
||||||
},
|
});
|
||||||
|
this._showToolbar();
|
||||||
_sort : function() {
|
}
|
||||||
console.warn("Sorting");
|
},
|
||||||
},
|
|
||||||
|
_fetchCollection : function() {
|
||||||
_renderView : function() {
|
this.seriesCollection.fetch();
|
||||||
if (MoviesCollection.length === 0) {
|
},
|
||||||
this.seriesRegion.show(new EmptyView());
|
|
||||||
|
_setFilter : function(buttonContext) {
|
||||||
this.toolbar.close();
|
var mode = buttonContext.model.get('key');
|
||||||
this.toolbar2.close();
|
this.seriesCollection.setFilterMode(mode);
|
||||||
} else {
|
},
|
||||||
|
|
||||||
this.seriesRegion.show(this.currentView);
|
_showToolbar : function() {
|
||||||
this._showToolbar();
|
if (this.toolbar.currentView) {
|
||||||
this._showPager();
|
return;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
this.toolbar2.show(new ToolbarLayout({
|
||||||
_setFilter : function(buttonContext) {
|
right : [
|
||||||
var mode = buttonContext.model.get('key');
|
this.filteringOptions
|
||||||
this.seriesCollection.setFilterMode(mode);
|
],
|
||||||
},
|
context : this
|
||||||
|
}));
|
||||||
_showToolbar : function() {
|
|
||||||
if (this.toolbar.currentView) {
|
this.toolbar.show(new ToolbarLayout({
|
||||||
return;
|
right : [
|
||||||
}
|
this.sortingOptions,
|
||||||
|
this.viewButtons
|
||||||
this.toolbar2.show(new ToolbarLayout({
|
],
|
||||||
right : [
|
left : [
|
||||||
this.filteringOptions
|
this.leftSideButtons
|
||||||
],
|
],
|
||||||
context : this
|
context : this
|
||||||
}));
|
}));
|
||||||
|
},
|
||||||
this.toolbar.show(new ToolbarLayout({
|
|
||||||
right : [
|
_showPager : function() {
|
||||||
this.sortingOptions,
|
var pager = new GridPager({
|
||||||
this.viewButtons
|
columns : this.columns,
|
||||||
],
|
collection : this.seriesCollection,
|
||||||
left : [
|
});
|
||||||
this.leftSideButtons
|
var pagerTop = new GridPager({
|
||||||
],
|
columns : this.columns,
|
||||||
context : this
|
collection : this.seriesCollection,
|
||||||
}));
|
});
|
||||||
},
|
this.pager.show(pager);
|
||||||
|
this.pagerTop.show(pagerTop);
|
||||||
_showPager : function() {
|
},
|
||||||
var pager = new GridPager({
|
|
||||||
columns : this.columns,
|
_showFooter : function() {
|
||||||
collection : this.seriesCollection,
|
var footerModel = new FooterModel();
|
||||||
});
|
var movies = FullMovieCollection.models.length;
|
||||||
var pagerTop = new GridPager({
|
//instead of all the counters could do something like this with different query in the where...
|
||||||
columns : this.columns,
|
//var releasedMovies = FullMovieCollection.where({ 'released' : this.model.get('released') });
|
||||||
collection : this.seriesCollection,
|
// releasedMovies.length
|
||||||
});
|
|
||||||
this.pager.show(pager);
|
var announced = 0;
|
||||||
this.pagerTop.show(pagerTop);
|
var incinemas = 0;
|
||||||
},
|
var released = 0;
|
||||||
|
|
||||||
_showFooter : function() {
|
var monitored = 0;
|
||||||
var footerModel = new FooterModel();
|
|
||||||
var movies = MoviesCollectionClient.fullCollection.models.length;
|
var downloaded =0;
|
||||||
//instead of all the counters could do something like this with different query in the where...
|
var missingMonitored=0;
|
||||||
//var releasedMovies = FullMovieCollection.where({ 'released' : this.model.get('released') });
|
var missingNotMonitored=0;
|
||||||
// releasedMovies.length
|
var missingMonitoredNotAvailable=0;
|
||||||
|
var missingMonitoredAvailable=0;
|
||||||
var announced = 0;
|
|
||||||
var incinemas = 0;
|
var downloadedMonitored=0;
|
||||||
var released = 0;
|
var downloadedNotMonitored=0;
|
||||||
|
|
||||||
var monitored = 0;
|
_.each(FullMovieCollection.models, function(model) {
|
||||||
|
|
||||||
var downloaded =0;
|
if (model.get('status').toLowerCase() === 'released') {
|
||||||
var missingMonitored=0;
|
released++;
|
||||||
var missingNotMonitored=0;
|
}
|
||||||
var missingMonitoredNotAvailable=0;
|
else if (model.get('status').toLowerCase() === 'incinemas') {
|
||||||
var missingMonitoredAvailable=0;
|
incinemas++;
|
||||||
|
}
|
||||||
var downloadedMonitored=0;
|
else if (model.get('status').toLowerCase() === 'announced') {
|
||||||
var downloadedNotMonitored=0;
|
announced++;
|
||||||
|
}
|
||||||
_.each(MoviesCollectionClient.fullCollection.models, function(model) {
|
|
||||||
|
if (model.get('monitored')) {
|
||||||
if (model.get('status').toLowerCase() === 'released') {
|
monitored++;
|
||||||
released++;
|
if (model.get('downloaded')) {
|
||||||
}
|
downloadedMonitored++;
|
||||||
else if (model.get('status').toLowerCase() === 'incinemas') {
|
}
|
||||||
incinemas++;
|
}
|
||||||
}
|
else { //not monitored
|
||||||
else if (model.get('status').toLowerCase() === 'announced') {
|
if (model.get('downloaded')) {
|
||||||
announced++;
|
downloadedNotMonitored++;
|
||||||
}
|
}
|
||||||
|
else { //missing
|
||||||
if (model.get('monitored')) {
|
missingNotMonitored++;
|
||||||
monitored++;
|
}
|
||||||
if (model.get('downloaded')) {
|
}
|
||||||
downloadedMonitored++;
|
|
||||||
}
|
if (model.get('downloaded')) {
|
||||||
}
|
downloaded++;
|
||||||
else { //not monitored
|
}
|
||||||
if (model.get('downloaded')) {
|
else { //missing
|
||||||
downloadedNotMonitored++;
|
if (!model.get('isAvailable')) {
|
||||||
}
|
if (model.get('monitored')) {
|
||||||
else { //missing
|
missingMonitoredNotAvailable++;
|
||||||
missingNotMonitored++;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (model.get('monitored')) {
|
||||||
if (model.get('downloaded')) {
|
missingMonitored++;
|
||||||
downloaded++;
|
if (model.get('isAvailable')) {
|
||||||
}
|
missingMonitoredAvailable++;
|
||||||
else { //missing
|
}
|
||||||
if (!model.get('isAvailable')) {
|
}
|
||||||
if (model.get('monitored')) {
|
}
|
||||||
missingMonitoredNotAvailable++;
|
});
|
||||||
}
|
|
||||||
}
|
footerModel.set({
|
||||||
|
movies : movies,
|
||||||
if (model.get('monitored')) {
|
announced : announced,
|
||||||
missingMonitored++;
|
incinemas : incinemas,
|
||||||
if (model.get('isAvailable')) {
|
released : released,
|
||||||
missingMonitoredAvailable++;
|
monitored : monitored,
|
||||||
}
|
downloaded : downloaded,
|
||||||
}
|
downloadedMonitored : downloadedMonitored,
|
||||||
}
|
downloadedNotMonitored : downloadedNotMonitored,
|
||||||
});
|
missingMonitored : missingMonitored,
|
||||||
|
missingMonitoredAvailable : missingMonitoredAvailable,
|
||||||
footerModel.set({
|
missingMonitoredNotAvailable : missingMonitoredNotAvailable,
|
||||||
movies : movies,
|
missingNotMonitored : missingNotMonitored
|
||||||
announced : announced,
|
});
|
||||||
incinemas : incinemas,
|
|
||||||
released : released,
|
this.footer.show(new FooterView({ model : footerModel }));
|
||||||
monitored : monitored,
|
}
|
||||||
downloaded : downloaded,
|
});
|
||||||
downloadedMonitored : downloadedMonitored,
|
|
||||||
downloadedNotMonitored : downloadedNotMonitored,
|
|
||||||
missingMonitored : missingMonitored,
|
|
||||||
missingMonitoredAvailable : missingMonitoredAvailable,
|
|
||||||
missingMonitoredNotAvailable : missingMonitoredNotAvailable,
|
|
||||||
missingNotMonitored : missingNotMonitored
|
|
||||||
});
|
|
||||||
|
|
||||||
this.footer.show(new FooterView({ model : footerModel }));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
var movieCollection = require('./MoviesCollection');
|
var movieCollection = require('./MoviesCollection');
|
||||||
|
|
||||||
var GCCollection = movieCollection.clone();
|
var ClientCollection = movieCollection.clone();
|
||||||
GCCollection.bindSignalR();
|
ClientCollection.bindSignalR();
|
||||||
GCCollection.switchMode('client'); //state.pageSize = 100000;
|
ClientCollection.switchMode('client'); //state.pageSize = 100000;
|
||||||
//CCollection.fetch();
|
module.exports = ClientCollection;
|
||||||
module.exports = GCCollection;
|
|
||||||
|
Loading…
Reference in new issue