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,22 +1,26 @@
'use strict';
define(
[
'backgrid'
], function (Backgrid) {
require(['app', 'backgrid'], function () {
NzbDrone.Release.ApprovalStatusCell = Backgrid.Cell.extend({
className: 'approval-status-cell',
return Backgrid.Cell.extend({
render: function () {
var rejections = this.model.get(this.column.get('name'));
className: 'approval-status-cell',
var result = '';
render: function () {
var rejections = this.model.get(this.column.get('name'));
_.each(rejections, function (reason) {
result += reason + ' ';
});
var result = '';
this.$el.html(result);
this.delegateEvents();
return this;
}
_.each(rejections, function (reason) {
result += reason + ' ';
});
this.$el.html(result);
this.delegateEvents();
return this;
}
});
});
});

View file

@ -1,17 +1,21 @@
'use strict';
define(['app', 'Release/Model', 'backbone.pageable'], function (app, SeriesModel, PagableCollection) {
NzbDrone.Release.Collection = PagableCollection.extend({
url : NzbDrone.Constants.ApiRoot + '/release',
model: NzbDrone.Release.Model,
'use strict';
define(
[
'Release/Model',
'backbone.pageable'
], function (ReleaseModel, PagableCollection) {
return PagableCollection.extend({
url : window.ApiRoot + '/release',
model: ReleaseModel,
mode: 'client',
mode: 'client',
state: {
pageSize: 2000
},
state: {
pageSize: 2000
},
fetchEpisodeReleases: function (episodeId) {
return this.fetch({ data: { episodeId: episodeId }});
}
fetchEpisodeReleases: function (episodeId) {
return this.fetch({ data: { episodeId: episodeId }});
}
});
});
});

View file

@ -1,33 +1,32 @@
'use strict';
define(['app','backgrid'], function () {
NzbDrone.Release.DownloadReportCell = Backgrid.Cell.extend({
define(
[
'backgrid'
], function (Backgrid) {
return Backgrid.Cell.extend({
className: 'download-report-cell',
className: 'download-report-cell',
events: {
'click': '_onClick'
},
events: {
'click': '_onClick'
},
_onClick: function () {
_onClick: function () {
var self = this;
var self = this;
this.$el.html('<i class =\'icon-spinner icon-spin\' />');
this.model.save()
.always(function () {
self.$el.html('<i class =\'icon-download-alt\' />');
});
},
this.$el.html('<i class =\'icon-spinner icon-spin\' />');
this.model.save().always(function () {
self.$el.html('<i class =\'icon-download-alt\' />');
});
},
render: function () {
render: function () {
this.$el.html('<i class =\'icon-download-alt\' />');
return this;
this.$el.html('<i class =\'icon-download-alt\' />');
return this;
}
}
});
});
return NzbDrone.Release.DownloadReportCell;
});

View file

@ -1,17 +1,17 @@
'use strict';
define([
'app',
'Release/Collection',
'Release/ApprovalStatusCell',
'Shared/SpinnerView',
'Shared/Toolbar/ToolbarLayout',
'Cells/EpisodeNumberCell',
'Cells/FileSizeCell',
'Cells/IndexerCell',
'Cells/QualityCell'
],
function () {
NzbDrone.Release.Layout = Backbone.Marionette.Layout.extend({
define(
[
'marionette',
'backgrid',
'Release/Collection',
'Cells/IndexerCell',
'Cells/EpisodeNumberCell',
'Cells/FileSizeCell',
'Cells/QualityCell',
'Release/ApprovalStatusCell',
'Shared/SpinnerView'
], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, SpinnerView) {
return Marionette.Layout.extend({
template: 'Release/LayoutTemplate',
regions: {
@ -19,60 +19,60 @@ define([
toolbar: '#x-toolbar'
},
columns: [
{
name : 'indexer',
label : 'Indexer',
sortable: true,
cell : NzbDrone.Cells.IndexerCell
},
columns:
[
{
name : 'indexer',
label : 'Indexer',
sortable: true,
cell : IndexerCell
},
{
name : 'title',
label : 'Title',
sortable: true,
cell : Backgrid.StringCell
},
{
name : 'episodeNumbers',
episodes: 'episodeNumbers',
label : 'season',
cell : NzbDrone.Cells.EpisodeNumberCell
},
{
name : 'size',
label : 'Size',
sortable: true,
cell : NzbDrone.Cells.FileSizeCell
},
{
name : 'quality',
label : 'Quality',
sortable: true,
cell : NzbDrone.Cells.QualityCell
},
{
name : 'title',
label : 'Title',
sortable: true,
cell : Backgrid.StringCell
},
{
name : 'episodeNumbers',
episodes: 'episodeNumbers',
label : 'season',
cell : EpisodeNumberCell
},
{
name : 'size',
label : 'Size',
sortable: true,
cell : FileSizeCell
},
{
name : 'quality',
label : 'Quality',
sortable: true,
cell : QualityCell
},
{
name : 'rejections',
label: 'decision',
cell : NzbDrone.Release.ApprovalStatusCell
}
],
{
name : 'rejections',
label: 'decision',
cell : ApprovalStatusCell
}
],
showTable: function () {
if (!this.isClosed) {
this.grid.show(new Backgrid.Grid(
{
row : Backgrid.Row,
columns : this.columns,
collection: this.collection,
className : 'table table-hover'
}));
this.grid.show(new Backgrid.Grid({
row : Backgrid.Row,
columns : this.columns,
collection: this.collection,
className : 'table table-hover'
}));
}
},
initialize: function () {
this.collection = new NzbDrone.Release.Collection();
this.collection = new ReleaseCollection();
this.fetchPromise = this.collection.fetch();
},
@ -80,12 +80,11 @@ define([
var self = this;
this.grid.show(new NzbDrone.Shared.SpinnerView());
this.grid.show(new SpinnerView());
this.fetchPromise.done(function () {
self.showTable();
});
//this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
}
});

View file

@ -1,6 +1,6 @@
'use strict';
define(['app'], function () {
NzbDrone.Release.Model = Backbone.Model.extend({
'use strict';
define(['backbone'], function (Backbone) {
return Backbone.Model.extend({
/* mutators: {
seasonNumber: function () {
return this.get('episode').seasonNumber;