mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
removed NzbDrone. namespace, everything is done using require.
This commit is contained in:
parent
ef62af75df
commit
b0bd3f34f1
121 changed files with 2570 additions and 2587 deletions
|
@ -1,15 +1,19 @@
|
|||
'use strict';
|
||||
define(['app', 'Shared/FormatHelpers', 'Cells/NzbDroneCell'], function () {
|
||||
return NzbDrone.Cells.NzbDroneCell.extend({
|
||||
className: 'air-date-cell',
|
||||
define(
|
||||
[
|
||||
'backgrid',
|
||||
'Shared/FormatHelpers'
|
||||
], function (Backgrid, FormatHelpers) {
|
||||
return Backgrid.Cell.extend({
|
||||
className: 'air-date-cell',
|
||||
|
||||
render: function () {
|
||||
render: function () {
|
||||
|
||||
this.$el.empty();
|
||||
var airDate = this.model.get(this.column.get('name'));
|
||||
this.$el.html(NzbDrone.Shared.FormatHelpers.DateHelper(airDate));
|
||||
return this;
|
||||
this.$el.empty();
|
||||
var airDate = this.model.get(this.column.get('name'));
|
||||
this.$el.html(FormatHelpers.DateHelper(airDate));
|
||||
return this;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,49 +1,52 @@
|
|||
'use strict';
|
||||
|
||||
define(['app', 'Cells/NzbDroneCell'], function () {
|
||||
return NzbDrone.Cells.NzbDroneCell.extend({
|
||||
define(
|
||||
[
|
||||
'Cells/NzbDroneCell'
|
||||
], function (NzbDroneCell) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'episode-number-cell',
|
||||
className: 'episode-number-cell',
|
||||
|
||||
render: function () {
|
||||
render: function () {
|
||||
|
||||
this.$el.empty();
|
||||
this.$el.empty();
|
||||
|
||||
var airDateField = this.column.get('airDate') || 'airDate';
|
||||
var seasonField = this.column.get('seasonNumber') || 'seasonNumber';
|
||||
var episodeField = this.column.get('episodes') || 'episodeNumber';
|
||||
var airDateField = this.column.get('airDate') || 'airDate';
|
||||
var seasonField = this.column.get('seasonNumber') || 'seasonNumber';
|
||||
var episodeField = this.column.get('episodes') || 'episodeNumber';
|
||||
|
||||
if (this.cellValue) {
|
||||
if (this.cellValue) {
|
||||
|
||||
var airDate = this.cellValue.get(airDateField);
|
||||
var seasonNumber = this.cellValue.get(seasonField);
|
||||
var episodes = this.cellValue.get(episodeField);
|
||||
var airDate = this.cellValue.get(airDateField);
|
||||
var seasonNumber = this.cellValue.get(seasonField);
|
||||
var episodes = this.cellValue.get(episodeField);
|
||||
|
||||
var result = 'Unknown';
|
||||
var result = 'Unknown';
|
||||
|
||||
if (episodes) {
|
||||
if (episodes) {
|
||||
|
||||
var paddedEpisodes;
|
||||
var paddedEpisodes;
|
||||
|
||||
if (episodes.constructor === Array) {
|
||||
paddedEpisodes = _.map(episodes,function (episodeNumber) {
|
||||
return episodeNumber.pad(2);
|
||||
}).join();
|
||||
if (episodes.constructor === Array) {
|
||||
paddedEpisodes = _.map(episodes,function (episodeNumber) {
|
||||
return episodeNumber.pad(2);
|
||||
}).join();
|
||||
}
|
||||
else {
|
||||
paddedEpisodes = episodes.pad(2);
|
||||
}
|
||||
|
||||
result = 'S{0}-E{1}'.format(seasonNumber.pad(2), paddedEpisodes);
|
||||
}
|
||||
else {
|
||||
paddedEpisodes = episodes.pad(2);
|
||||
else if (airDate) {
|
||||
result = new Date(airDate).toLocaleDateString();
|
||||
}
|
||||
|
||||
result = 'S{0}-E{1}'.format(seasonNumber.pad(2), paddedEpisodes);
|
||||
this.$el.html(result);
|
||||
}
|
||||
else if (airDate) {
|
||||
result = new Date(airDate).toLocaleDateString();
|
||||
}
|
||||
|
||||
this.$el.html(result);
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,34 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
define(['app','cells/nzbdronecell' ], function () {
|
||||
return NzbDrone.Cells.NzbDroneCell.extend({
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
className: 'episode-status-cell',
|
||||
className: 'episode-status-cell',
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
|
||||
if (this.model) {
|
||||
if (this.model) {
|
||||
|
||||
var icon;
|
||||
var icon;
|
||||
|
||||
if (this.model.get('episodeFile')) {
|
||||
icon = 'icon-ok';
|
||||
if (this.model.get('episodeFile')) {
|
||||
icon = 'icon-ok';
|
||||
|
||||
}
|
||||
else {
|
||||
if (this.model.get('hasAired')) {
|
||||
icon = 'icon-warning-sign';
|
||||
}
|
||||
else {
|
||||
icon = 'icon-time';
|
||||
if (this.model.get('hasAired')) {
|
||||
icon = 'icon-warning-sign';
|
||||
}
|
||||
else {
|
||||
icon = 'icon-time';
|
||||
}
|
||||
}
|
||||
|
||||
this.$el.html('<i class="{0}"/>'.format(icon));
|
||||
}
|
||||
|
||||
this.$el.html('<i class="{0}"/>'.format(icon));
|
||||
return this;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
define(['app', 'Cells/NzbDroneCell'], function () {
|
||||
return NzbDrone.Cells.NzbDroneCell.extend({
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Cells/NzbDroneCell',
|
||||
'Episode/Layout'
|
||||
], function (App, NzbDroneCell, EpisodeLayout) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'episode-title-cell',
|
||||
className: 'episode-title-cell',
|
||||
|
||||
events: {
|
||||
'click': 'showDetails'
|
||||
},
|
||||
events: {
|
||||
'click': 'showDetails'
|
||||
},
|
||||
|
||||
showDetails: function () {
|
||||
var view = new NzbDrone.Episode.Layout({ model: this.cellValue });
|
||||
NzbDrone.modalRegion.show(view);
|
||||
},
|
||||
showDetails: function () {
|
||||
var view = new EpisodeLayout({ model: this.cellValue });
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
render: function () {
|
||||
this.$el.html(this.cellValue.get('title'));
|
||||
return this;
|
||||
}
|
||||
render: function () {
|
||||
this.$el.html(this.cellValue.get('title'));
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
define(['app', 'Shared/FormatHelpers','backgrid'], function () {
|
||||
NzbDrone.Cells.FileSizeCell = Backgrid.Cell.extend({
|
||||
define(
|
||||
[
|
||||
'backgrid',
|
||||
'Shared/FormatHelpers'
|
||||
], function (Backgrid, FormatHelpers) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
className: 'file-size-cell',
|
||||
className: 'file-size-cell',
|
||||
|
||||
render: function () {
|
||||
var size = this.model.get(this.column.get('name'));
|
||||
this.$el.html(NzbDrone.Shared.FormatHelpers.FileSizeHelper(size));
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
render: function () {
|
||||
var size = this.model.get(this.column.get('name'));
|
||||
this.$el.html(FormatHelpers.FileSizeHelper(size));
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
'use strict';
|
||||
define(['app','backgrid'], function () {
|
||||
NzbDrone.Cells.IndexerCell = Backgrid.Cell.extend({
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
class : 'indexer-cell',
|
||||
class : 'indexer-cell',
|
||||
|
||||
render: function () {
|
||||
var indexer = this.model.get(this.column.get('name'));
|
||||
this.$el.html(indexer);
|
||||
return this;
|
||||
}
|
||||
render: function () {
|
||||
var indexer = this.model.get(this.column.get('name'));
|
||||
this.$el.html(indexer);
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,44 +1,47 @@
|
|||
'use strict';
|
||||
|
||||
define(['app','backgrid'], function () {
|
||||
NzbDrone.Cells.NzbDroneCell = Backgrid.Cell.extend({
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
_originalInit: Backgrid.Cell.prototype.initialize,
|
||||
_originalInit: Backgrid.Cell.prototype.initialize,
|
||||
|
||||
|
||||
initialize: function () {
|
||||
this._originalInit.apply(this, arguments);
|
||||
this.cellValue = this._getValue();
|
||||
initialize: function () {
|
||||
this._originalInit.apply(this, arguments);
|
||||
this.cellValue = this._getValue();
|
||||
|
||||
this.listenTo(this.model, 'change', this._refresh);
|
||||
},
|
||||
this.listenTo(this.model, 'change', this._refresh);
|
||||
},
|
||||
|
||||
_refresh: function () {
|
||||
this.cellValue = this._getValue();
|
||||
this.render();
|
||||
},
|
||||
_refresh: function () {
|
||||
this.cellValue = this._getValue();
|
||||
this.render();
|
||||
},
|
||||
|
||||
_getValue: function () {
|
||||
_getValue: function () {
|
||||
|
||||
var name = this.column.get('name');
|
||||
var name = this.column.get('name');
|
||||
|
||||
if (name === 'this') {
|
||||
return this.model;
|
||||
if (name === 'this') {
|
||||
return this.model;
|
||||
}
|
||||
|
||||
var value = this.model.get(name);
|
||||
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//if not a model
|
||||
if (!value.get && typeof value === 'object') {
|
||||
value = new Backbone.Model(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var value = this.model.get(name);
|
||||
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//if not a model
|
||||
if (!value.get && typeof value === 'object') {
|
||||
value = new Backbone.Model(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
'use strict';
|
||||
define(['app', 'Cells/TemplatedCell'], function (App, TemplatedCell) {
|
||||
return TemplatedCell.extend({
|
||||
define(
|
||||
[
|
||||
'Cells/TemplatedCell'
|
||||
], function (TemplatedCell) {
|
||||
return TemplatedCell.extend({
|
||||
|
||||
className: 'quality-cell',
|
||||
template : 'Cells/QualityTemplate'
|
||||
className: 'quality-cell',
|
||||
template : 'Cells/QualityTemplate'
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
'use strict';
|
||||
define(['app','Cells/NzbDroneCell'], function () {
|
||||
return NzbDrone.Cells.NzbDroneCell.extend({
|
||||
define(
|
||||
[
|
||||
'Cells/NzbDroneCell'
|
||||
], function (NzbDroneCell) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className : 'relative-date-cell',
|
||||
className: 'relative-date-cell',
|
||||
|
||||
render: function () {
|
||||
render: function () {
|
||||
|
||||
var date = this.model.get(this.column.get('name'));
|
||||
this.$el.html(Date.create(date).relative());
|
||||
var date = this.model.get(this.column.get('name'));
|
||||
this.$el.html(Date.create(date).relative());
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
'use strict';
|
||||
define(['app','cells/nzbdronecell'], function () {
|
||||
return NzbDrone.Cells.NzbDroneCell.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;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,9 +1,12 @@
|
|||
'use strict';
|
||||
define(['app', 'Cells/TemplatedCell'], function (App, TemplatedCell) {
|
||||
return TemplatedCell.extend({
|
||||
define(
|
||||
[
|
||||
'Cells/TemplatedCell'
|
||||
], function (TemplatedCell) {
|
||||
return TemplatedCell.extend({
|
||||
|
||||
className: 'series-title',
|
||||
template : 'Cells/SeriesTitleTemplate'
|
||||
className: 'series-title',
|
||||
template : 'Cells/SeriesTitleTemplate'
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
define(['app','Cells/NzbDroneCell'], function () {
|
||||
return NzbDrone.Cells.NzbDroneCell.extend({
|
||||
render: function () {
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Cells/NzbDroneCell'
|
||||
], function (Marionette, NzbDroneCell) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
var templateName = this.column.get('template') || this.template;
|
||||
|
||||
this.templateFunction = Marionette.TemplateCache.get(templateName);
|
||||
var data = this.cellValue.toJSON();
|
||||
var html = this.templateFunction(data);
|
||||
this.$el.html(html);
|
||||
render: function () {
|
||||
|
||||
return this;
|
||||
}
|
||||
var templateName = this.column.get('template') || this.template;
|
||||
|
||||
this.templateFunction = Marionette.TemplateCache.get(templateName);
|
||||
var data = this.cellValue.toJSON();
|
||||
var html = this.templateFunction(data);
|
||||
this.$el.html(html);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,39 +1,42 @@
|
|||
'use strict';
|
||||
|
||||
define(['app', 'Episode/Layout'], function () {
|
||||
return Backgrid.Cell.extend({
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
className: 'toggle-cell clickable',
|
||||
className: 'toggle-cell clickable',
|
||||
|
||||
events: {
|
||||
'click': '_onClick'
|
||||
},
|
||||
events: {
|
||||
'click': '_onClick'
|
||||
},
|
||||
|
||||
|
||||
_onClick: function () {
|
||||
var name = this.column.get('name');
|
||||
this.model.set(name, !this.model.get(name));
|
||||
this.render();
|
||||
_onClick: function () {
|
||||
var name = this.column.get('name');
|
||||
this.model.set(name, !this.model.get(name));
|
||||
this.render();
|
||||
|
||||
this.model.save();
|
||||
},
|
||||
this.model.save();
|
||||
},
|
||||
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
|
||||
|
||||
this.$el.html('<i />');
|
||||
this.$el.html('<i />');
|
||||
|
||||
var name = this.column.get('name');
|
||||
var name = this.column.get('name');
|
||||
|
||||
if (this.model.get(name)) {
|
||||
this.$('i').addClass(this.column.get('trueClass'));
|
||||
if (this.model.get(name)) {
|
||||
this.$('i').addClass(this.column.get('trueClass'));
|
||||
}
|
||||
else {
|
||||
this.$('i').addClass(this.column.get('falseClass'));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
else {
|
||||
this.$('i').addClass(this.column.get('falseClass'));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue