removed NzbDrone. namespace, everything is done using require.

This commit is contained in:
Keivan Beigi 2013-06-24 16:41:59 -07:00
commit b0bd3f34f1
121 changed files with 2570 additions and 2587 deletions

View file

@ -1,8 +1,9 @@
'use strict';
define(['app'], function () {
NzbDrone.Series.Index.EmptySeriesCollectionView = Backbone.Marionette.CompositeView.extend({
template: 'Series/Index/EmptySeriesIndexTemplate'
'use strict';
define(
[
'marionette'
], function (Marionette) {
return Marionette.CompositeView.extend({
template: 'Series/Index/EmptySeriesIndexTemplate'
});
});
return NzbDrone.Series.Index.EmptySeriesCollectionView;
});

View file

@ -1,10 +1,11 @@
'use strict';
'use strict';
define(['app'], function () {
define(
[
'marionette'
], function (Marionette) {
NzbDrone.Series.Index.EmptyView = Backbone.Marionette.CompositeView.extend({
template: 'Series/Index/EmptyTemplate'
return Marionette.CompositeView.extend({
template: 'Series/Index/EmptyTemplate'
});
});
return NzbDrone.Series.Index.EmptyView;
});

View file

@ -1,12 +1,14 @@
'use strict';
'use strict';
define(['app', 'Series/Index/List/ItemView', 'Config'], function () {
define(
[
'marionette',
'Series/Index/List/ItemView'
], function (Marionette, ListItemView) {
NzbDrone.Series.Index.List.CollectionView = Backbone.Marionette.CompositeView.extend({
itemView : NzbDrone.Series.Index.List.ItemView,
itemViewContainer : '#x-series-list',
template : 'Series/Index/List/CollectionTemplate'
return Marionette.CompositeView.extend({
itemView : ListItemView,
itemViewContainer: '#x-series-list',
template : 'Series/Index/List/CollectionTemplate'
});
});
return NzbDrone.Series.Index.List.CollectionView;
});

View file

@ -1,36 +1,33 @@
'use strict';
'use strict';
define([
'app',
'Quality/QualityProfileCollection',
'Series/SeriesCollection',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView',
'Shared/FormatHelpers'
define(
[
'app',
'marionette',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView'
], function () {
NzbDrone.Series.Index.List.ItemView = Backbone.Marionette.ItemView.extend({
template: 'Series/Index/List/ItemTemplate',
], function (App, Marionette, EditSeriesView, DeleteSeriesView) {
return Marionette.ItemView.extend({
template: 'Series/Index/List/ItemTemplate',
ui: {
'progressbar': '.progress .bar'
},
ui: {
'progressbar': '.progress .bar'
},
events: {
'click .x-edit' : 'editSeries',
'click .x-remove': 'removeSeries'
},
events: {
'click .x-edit' : 'editSeries',
'click .x-remove': 'removeSeries'
},
editSeries: function () {
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
NzbDrone.modalRegion.show(view);
},
editSeries: function () {
var view = new EditSeriesView({ model: this.model});
App.modalRegion.show(view);
},
removeSeries: function () {
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
NzbDrone.modalRegion.show(view);
}
removeSeries: function () {
var view = new DeleteSeriesView({ model: this.model });
App.modalRegion.show(view);
}
});
});
return NzbDrone.Series.Index.List.ItemView;
});

View file

@ -1,12 +1,14 @@
'use strict';
'use strict';
define(['app', 'Series/Index/Posters/ItemView', 'Config'], function () {
define(
[
'marionette',
'Series/Index/Posters/ItemView'
], function (Marionette, PosterItemView) {
NzbDrone.Series.Index.Posters.CollectionView = Backbone.Marionette.CompositeView.extend({
itemView : NzbDrone.Series.Index.Posters.ItemView,
itemViewContainer : '#x-series-posters',
template : 'Series/Index/Posters/CollectionTemplate'
return Marionette.CompositeView.extend({
itemView : PosterItemView,
itemViewContainer: '#x-series-posters',
template : 'Series/Index/Posters/CollectionTemplate'
});
});
return NzbDrone.Series.Index.Posters.CollectionView;
});

View file

@ -1,45 +1,44 @@
'use strict';
'use strict';
define([
'app',
'Series/SeriesCollection',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView'
define(
[
'app',
'marionette',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView'
], function () {
], function (App, Marionette, EditSeriesView, DeleteSeriesView) {
NzbDrone.Series.Index.Posters.ItemView = Backbone.Marionette.ItemView.extend({
tagName : 'li',
template: 'Series/Index/Posters/ItemTemplate',
return Marionette.ItemView.extend({
tagName : 'li',
template: 'Series/Index/Posters/ItemTemplate',
ui: {
'progressbar': '.progress .bar',
'controls': '.series-controls'
},
ui: {
'progressbar': '.progress .bar',
'controls' : '.series-controls'
},
events: {
'click .x-edit' : 'editSeries',
'click .x-remove': 'removeSeries',
'mouseenter .x-series-poster': 'posterHoverAction',
'mouseleave .x-series-poster': 'posterHoverAction'
},
events: {
'click .x-edit' : 'editSeries',
'click .x-remove' : 'removeSeries',
'mouseenter .x-series-poster': 'posterHoverAction',
'mouseleave .x-series-poster': 'posterHoverAction'
},
editSeries: function () {
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
NzbDrone.modalRegion.show(view);
},
editSeries: function () {
var view = new EditSeriesView({ model: this.model});
App.modalRegion.show(view);
},
removeSeries: function () {
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
NzbDrone.modalRegion.show(view);
},
removeSeries: function () {
var view = new DeleteSeriesView({ model: this.model });
App.modalRegion.show(view);
},
posterHoverAction: function () {
this.ui.controls.slideToggle();
}
posterHoverAction: function () {
this.ui.controls.slideToggle();
}
});
});
return NzbDrone.Series.Index.Posters.ItemView;
});

View file

@ -1,33 +1,22 @@
'use strict';
define([
'app',
'Series/Index/List/CollectionView',
'Series/Index/Posters/CollectionView',
'Series/Index/EmptyView',
'Series/SeriesCollection',
'Cells/AirDateCell',
'Cells/SeriesTitleCell',
'Cells/SeriesStatusCell',
'Cells/TemplatedCell',
'Shared/Toolbar/ToolbarLayout',
'Config',
'Shared/LoadingView'
],
function (
App,
ListCollectionView,
PosterCollectionView,
EmptyView,
SeriesCollection,
AirDateCell,
SeriesTitleCell,
SeriesStatusCell,
TemplatedCell,
ToolbarLayout,
Config,
LoadingView)
{
NzbDrone.Series.Index.SeriesIndexLayout = Backbone.Marionette.Layout.extend({
define(
[
'marionette',
'Series/Index/Posters/CollectionView',
'Series/Index/List/CollectionView',
'Series/Index/EmptyView',
'Series/SeriesCollection',
'Cells/AirDateCell',
'Cells/SeriesTitleCell',
'Cells/TemplatedCell',
'Series/Index/Table/SeriesStatusCell',
'Series/Index/Table/Row',
'Shared/Toolbar/ToolbarLayout',
'Config',
'Shared/LoadingView'
], function (Marionette, PosterCollectionView, ListCollectionView, EmptyView, SeriesCollection, AirDateCell, SeriesTitleCell, TemplatedCell, SeriesStatusCell, SeriesIndexRow,
ToolbarLayout, Config, LoadingView) {
return Marionette.Layout.extend({
template: 'Series/Index/SeriesIndexLayoutTemplate',
regions: {
@ -35,87 +24,88 @@ define([
toolbar: '#x-toolbar'
},
columns: [
{
name : 'status',
label: '',
cell : SeriesStatusCell
},
{
name : 'this',
label: 'Title',
cell : SeriesTitleCell
},
{
name : 'seasonCount',
label: 'Seasons',
cell : 'integer'
},
{
name : 'quality',
label: 'Quality',
cell : 'integer'
},
{
name : 'network',
label: 'Network',
cell : 'string'
},
{
name : 'nextAiring',
label: 'Next Airing',
cell : AirDateCell
},
{
name : 'this',
label : 'Episodes',
sortable: false,
template: 'Series/EpisodeProgressTemplate',
cell : TemplatedCell
},
{
name : 'this',
label : '',
sortable: false,
template: 'Series/Index/Table/ControlsColumnTemplate',
cell : TemplatedCell
}
],
columns:
[
{
name : 'status',
label: '',
cell : SeriesStatusCell
},
{
name : 'this',
label: 'Title',
cell : SeriesTitleCell
},
{
name : 'seasonCount',
label: 'Seasons',
cell : 'integer'
},
{
name : 'quality',
label: 'Quality',
cell : 'integer'
},
{
name : 'network',
label: 'Network',
cell : 'string'
},
{
name : 'nextAiring',
label: 'Next Airing',
cell : AirDateCell
},
{
name : 'this',
label : 'Episodes',
sortable: false,
template: 'Series/EpisodeProgressTemplate',
cell : TemplatedCell
},
{
name : 'this',
label : '',
sortable: false,
template: 'Series/Index/Table/ControlsColumnTemplate',
cell : TemplatedCell
}
],
leftSideButtons: {
type : 'default',
storeState: false,
items : [
{
title: 'Add Series',
icon : 'icon-plus',
route: 'series/add'
},
{
title : 'RSS Sync',
icon : 'icon-rss',
command : 'rsssync',
successMessage: 'RSS Sync Completed',
errorMessage : 'RSS Sync Failed!'
},
{
title : 'Update Library',
icon : 'icon-refresh',
command : 'refreshseries',
successMessage: 'Library was updated!',
errorMessage : 'Library update failed!'
}
]
items :
[
{
title: 'Add Series',
icon : 'icon-plus',
route: 'series/add'
},
{
title : 'RSS Sync',
icon : 'icon-rss',
command : 'rsssync',
successMessage: 'RSS Sync Completed',
errorMessage : 'RSS Sync Failed!'
},
{
title : 'Update Library',
icon : 'icon-refresh',
command : 'refreshseries',
successMessage: 'Library was updated!',
errorMessage : 'Library update failed!'
}
]
},
_showTable: function () {
var view = new Backgrid.Grid(
{
row : NzbDrone.Series.Index.Table.Row,
columns : this.columns,
collection: this.seriesCollection,
className : 'table table-hover'
});
var view = new Backgrid.Grid({
row : SeriesIndexRow,
columns : this.columns,
collection: this.seriesCollection,
className : 'table table-hover'
});
this._fetchCollection(view);
},
@ -140,16 +130,15 @@ define([
if (this.seriesCollection.models.length === 0) {
this.series.show(new LoadingView());
this.seriesCollection.fetch()
.done(function () {
if (self.seriesCollection.models.length === 0) {
self._showEmpty();
}
else {
view.collection = self.seriesCollection;
self.series.show(view);
}
});
this.seriesCollection.fetch().done(function () {
if (self.seriesCollection.models.length === 0) {
self._showEmpty();
}
else {
view.collection = self.seriesCollection;
self.series.show(view);
}
});
}
else {
@ -170,35 +159,40 @@ define([
storeState : true,
menuKey : 'seriesViewMode',
defaultAction: 'listView',
items : [
{
key : 'tableView',
title : '',
icon : 'icon-table',
callback: this._showTable
},
{
key : 'listView',
title : '',
icon : 'icon-list',
callback: this._showList
},
{
key : 'posterView',
title : '',
icon : 'icon-picture',
callback: this._showPosters
}
]
items :
[
{
key : 'tableView',
title : '',
icon : 'icon-table',
callback: this._showTable
},
{
key : 'listView',
title : '',
icon : 'icon-list',
callback: this._showList
},
{
key : 'posterView',
title : '',
icon : 'icon-picture',
callback: this._showPosters
}
]
};
this.toolbar.show(new ToolbarLayout({
right : [ viewButtons],
left : [ this.leftSideButtons],
right :
[
viewButtons
],
left :
[
this.leftSideButtons
],
context: this
}));
}
});
return NzbDrone.Series.Index.SeriesIndexLayou;
});

View file

@ -1,22 +1,26 @@
'use strict';
define(['app','backgrid'], function () {
NzbDrone.Series.Index.Table.Row = Backgrid.Row.extend({
events: {
'click .x-edit' : 'editSeries',
'click .x-remove': 'removeSeries'
},
define(
[
'app',
'backgrid',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView'
], function (App, Backgrid, EditSeriesView, DeleteSeriesView) {
return Backgrid.Row.extend({
events: {
'click .x-edit' : 'editSeries',
'click .x-remove': 'removeSeries'
},
editSeries: function () {
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
NzbDrone.modalRegion.show(view);
},
editSeries: function () {
var view = new EditSeriesView({ model: this.model});
App.modalRegion.show(view);
},
removeSeries: function () {
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
NzbDrone.modalRegion.show(view);
}
removeSeries: function () {
var view = new DeleteSeriesView({ model: this.model });
App.modalRegion.show(view);
}
});
});
return NzbDrone.Series.Table.Row;
});

View file

@ -0,0 +1,28 @@
'use strict';
define(
[
'backgrid'
], function (Backgrid) {
return Backgrid.Cell.extend({
className: 'series-status-cell',
render: function () {
this.$el.empty();
var monitored = this.model.get('monitored');
var status = this.model.get('status');
if (!monitored) {
this.$el.html('<i class="icon-pause grid-icon" title="Not Monitored"></i>');
}
else if (status === 'continuing') {
this.$el.html('<i class="icon-play grid-icon" title="Continuing"></i>');
}
else {
this.$el.html('<i class="icon-stop grid-icon" title="Ended"></i>');
}
return this;
}
});
});