mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-27 22:56:45 -04:00
Moved source code under src folder - massive change
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Release/Model'
|
||||
], function (Backbone, ReleaseModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/release',
|
||||
model: ReleaseModel,
|
||||
|
||||
state: {
|
||||
pageSize: 2000
|
||||
},
|
||||
|
||||
fetchEpisodeReleases: function (episodeId) {
|
||||
return this.fetch({ data: { episodeId: episodeId }});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
className: 'download-report-cell',
|
||||
|
||||
events: {
|
||||
'click': '_onClick'
|
||||
},
|
||||
|
||||
_onClick: function () {
|
||||
|
||||
if (!this.model.get('downloadAllowed'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
this.$el.html('<i class="icon-spinner icon-spin" />');
|
||||
var promise = this.model.save();
|
||||
|
||||
promise.done(function () {
|
||||
self.$el.html('<i class="icon-ok" title="Added to downloaded queue" />');
|
||||
});
|
||||
|
||||
promise.fail(function () {
|
||||
self.$el.html('<i class="icon-download-alt" title="Add to download queue" />');
|
||||
});
|
||||
},
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
|
||||
if (this.model.get('downloadAllowed'))
|
||||
{
|
||||
this.$el.html('<i class="icon-download-alt" title="Add to download queue" />');
|
||||
}
|
||||
|
||||
else {
|
||||
this.className = 'no-download-report-cell';
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'backgrid',
|
||||
'Release/Collection',
|
||||
'Cells/IndexerCell',
|
||||
'Cells/EpisodeNumberCell',
|
||||
'Cells/FileSizeCell',
|
||||
'Cells/QualityCell',
|
||||
'Cells/ApprovalStatusCell',
|
||||
'Shared/LoadingView'
|
||||
], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, LoadingView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Release/LayoutTemplate',
|
||||
|
||||
regions: {
|
||||
grid : '#x-grid',
|
||||
toolbar: '#x-toolbar'
|
||||
},
|
||||
|
||||
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 : EpisodeNumberCell
|
||||
},
|
||||
{
|
||||
name : 'size',
|
||||
label : 'Size',
|
||||
sortable: true,
|
||||
cell : FileSizeCell
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label : 'Quality',
|
||||
sortable: true,
|
||||
cell : QualityCell
|
||||
},
|
||||
|
||||
{
|
||||
name : 'rejections',
|
||||
label: '',
|
||||
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'
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new ReleaseCollection();
|
||||
this.fetchPromise = this.collection.fetch();
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
|
||||
var self = this;
|
||||
|
||||
this.grid.show(new LoadingView());
|
||||
|
||||
this.fetchPromise.done(function () {
|
||||
self.showTable();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
<div id="x-toolbar"/>
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="x-grid"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone'
|
||||
], function (Backbone) {
|
||||
return Backbone.Model.extend({
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user