mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-17 21:26:22 -04:00
Moved source code under src folder - massive change
This commit is contained in:
40
src/UI/Cells/ApprovalStatusCell.js
Normal file
40
src/UI/Cells/ApprovalStatusCell.js
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backgrid',
|
||||
'marionette',
|
||||
'bootstrap'
|
||||
], function (Backgrid, Marionette) {
|
||||
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
className: 'approval-status-cell',
|
||||
template : 'Cells/ApprovalStatusCellTemplate',
|
||||
|
||||
|
||||
render: function () {
|
||||
|
||||
var rejections = this.model.get(this.column.get('name'));
|
||||
|
||||
if (rejections.length === 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.templateFunction = Marionette.TemplateCache.get(this.template);
|
||||
|
||||
var html = this.templateFunction(rejections);
|
||||
this.$el.html('<i class="icon-exclamation-sign"/>');
|
||||
|
||||
this.$el.popover({
|
||||
content : html,
|
||||
html : true,
|
||||
trigger : 'hover',
|
||||
title : 'Release Rejected',
|
||||
placement: 'left',
|
||||
container: this.$el
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
5
src/UI/Cells/ApprovalStatusCellTemplate.html
Normal file
5
src/UI/Cells/ApprovalStatusCellTemplate.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
{{#each this}}
|
||||
<li>{{this}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
70
src/UI/Cells/Edit/QualityCellEditor.js
Normal file
70
src/UI/Cells/Edit/QualityCellEditor.js
Normal file
@@ -0,0 +1,70 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backgrid',
|
||||
'Settings/Quality/Profile/QualityProfileSchemaCollection',
|
||||
'Series/EpisodeFileModel'
|
||||
], function (Backgrid, QualityProfileSchemaCollection, EpisodeFileModel) {
|
||||
return Backgrid.CellEditor.extend({
|
||||
|
||||
className: 'quality-cell-editor',
|
||||
template : 'Cells/Edit/QualityCellEditorTemplate',
|
||||
tagName : 'select',
|
||||
|
||||
events: {
|
||||
'change': 'save',
|
||||
'blur': 'close',
|
||||
'keydown': 'close'
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var self = this;
|
||||
|
||||
var qualityProfileSchemaCollection = new QualityProfileSchemaCollection();
|
||||
var promise = qualityProfileSchemaCollection.fetch();
|
||||
|
||||
promise.done(function () {
|
||||
var templateName = self.template;
|
||||
self.schema = qualityProfileSchemaCollection.first();
|
||||
|
||||
var selected = _.find(self.schema.get('available'), { 'id': self.model.get(self.column.get("name")).quality.id });
|
||||
|
||||
if (selected) {
|
||||
selected.selected = true;
|
||||
}
|
||||
|
||||
self.templateFunction = Marionette.TemplateCache.get(templateName);
|
||||
var data = self.schema.toJSON();
|
||||
var html = self.templateFunction(data);
|
||||
self.$el.html(html);
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
save: function (e) {
|
||||
var model = this.model;
|
||||
var column = this.column;
|
||||
var selected = parseInt(this.$el.val());
|
||||
|
||||
var quality = _.find(this.schema.get('available'), { 'id': selected });
|
||||
|
||||
var newQuality = {
|
||||
proper: false,
|
||||
quality: quality
|
||||
};
|
||||
|
||||
model.set(column.get("name"), newQuality);
|
||||
model.save();
|
||||
model.trigger("backgrid:edited", model, column, new Backgrid.Command(e));
|
||||
},
|
||||
|
||||
close: function (e) {
|
||||
var model = this.model;
|
||||
var column = this.column;
|
||||
var command = new Backgrid.Command(e);
|
||||
|
||||
model.trigger("backgrid:edited", model, column, command);
|
||||
}
|
||||
});
|
||||
});
|
||||
7
src/UI/Cells/Edit/QualityCellEditorTemplate.html
Normal file
7
src/UI/Cells/Edit/QualityCellEditorTemplate.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{#each available}}
|
||||
{{#if selected}}
|
||||
<option value="{{id}}" selected="selected">{{name}}</option>
|
||||
{{else}}
|
||||
<option value="{{id}}">{{name}}</option>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
54
src/UI/Cells/EpisodeActionsCell.js
Normal file
54
src/UI/Cells/EpisodeActionsCell.js
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Cells/NzbDroneCell',
|
||||
'Commands/CommandController'
|
||||
], function (App, NzbDroneCell, CommandController) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'episode-actions-cell',
|
||||
template : 'Cells/EpisodeActionsCellTemplate',
|
||||
|
||||
ui: {
|
||||
automaticSearch: '.x-automatic-search-icon'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-automatic-search': '_automaticSearch',
|
||||
'click .x-manual-search' : '_manualSearch'
|
||||
},
|
||||
|
||||
render: function () {
|
||||
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);
|
||||
|
||||
CommandController.bindToCommand({
|
||||
element: this.$(this.ui.automaticSearch),
|
||||
command: {
|
||||
name : 'episodeSearch',
|
||||
episodeId: this.model.get('id')
|
||||
}
|
||||
});
|
||||
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
},
|
||||
|
||||
_automaticSearch: function () {
|
||||
CommandController.Execute('episodeSearch', {
|
||||
name : 'episodeSearch',
|
||||
episodeId: this.model.get('id')
|
||||
});
|
||||
},
|
||||
|
||||
_manualSearch: function () {
|
||||
App.vent.trigger(App.Commands.ShowEpisodeDetails, { episode: this.cellValue, hideSeriesLink: true, openingTab: 'search' });
|
||||
}
|
||||
});
|
||||
});
|
||||
10
src/UI/Cells/EpisodeActionsCellTemplate.html
Normal file
10
src/UI/Cells/EpisodeActionsCellTemplate.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-mini x-automatic-search x-automatic-search-icon" title="Automatic Search" data-container="body"><i class="icon-search"></i></button>
|
||||
<button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="x-automatic-search">Automatic Search</li>
|
||||
<li class="x-manual-search">Manual Search</li>
|
||||
</ul>
|
||||
</div>
|
||||
66
src/UI/Cells/EpisodeNumberCell.js
Normal file
66
src/UI/Cells/EpisodeNumberCell.js
Normal file
@@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'Cells/NzbDroneCell',
|
||||
'Shared/FormatHelpers'
|
||||
], function (NzbDroneCell, FormatHelpers) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'episode-number-cell',
|
||||
|
||||
render: function () {
|
||||
|
||||
this.$el.empty();
|
||||
|
||||
var airDateField = this.column.get('airDateUtc') || 'airDateUtc';
|
||||
var seasonField = this.column.get('seasonNumber') || 'seasonNumber';
|
||||
var episodeField = this.column.get('episodes') || 'episodeNumber';
|
||||
|
||||
if (this.model) {
|
||||
var result = 'Unknown';
|
||||
|
||||
var airDate = this.model.get(airDateField);
|
||||
var seasonNumber = this.model.get(seasonField);
|
||||
var episodes = this.model.get(episodeField);
|
||||
|
||||
if (this.cellValue) {
|
||||
if (!seasonNumber) {
|
||||
seasonNumber = this.cellValue.get(seasonField);
|
||||
}
|
||||
|
||||
if (!episodes) {
|
||||
episodes = this.cellValue.get(episodeField);
|
||||
}
|
||||
|
||||
if (!airDate) {
|
||||
this.model.get(airDateField);
|
||||
}
|
||||
}
|
||||
|
||||
if (episodes) {
|
||||
|
||||
var paddedEpisodes;
|
||||
|
||||
if (episodes.constructor === Array) {
|
||||
paddedEpisodes = _.map(episodes,function (episodeNumber) {
|
||||
return FormatHelpers.pad(episodeNumber, 2);
|
||||
}).join();
|
||||
}
|
||||
else {
|
||||
paddedEpisodes = FormatHelpers.pad(episodes, 2);
|
||||
}
|
||||
|
||||
result = '{0}x{1}'.format(seasonNumber, paddedEpisodes);
|
||||
}
|
||||
else if (airDate) {
|
||||
result = new Date(airDate).toLocaleDateString();
|
||||
}
|
||||
|
||||
this.$el.html(result);
|
||||
}
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
33
src/UI/Cells/EpisodeProgressCell.js
Normal file
33
src/UI/Cells/EpisodeProgressCell.js
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Cells/NzbDroneCell'
|
||||
], function (Marionette, NzbDroneCell) {
|
||||
return NzbDroneCell.extend({
|
||||
className: 'episode-progress-cell',
|
||||
template : 'Cells/EpisodeProgressCellTemplate',
|
||||
|
||||
render: function () {
|
||||
|
||||
var episodeCount = this.model.get('episodeCount');
|
||||
var episodeFileCount = this.model.get('episodeFileCount');
|
||||
|
||||
var percent = 100;
|
||||
|
||||
if (episodeCount > 0) {
|
||||
percent = episodeFileCount / episodeCount * 100;
|
||||
}
|
||||
|
||||
this.model.set('percentOfEpisodes', percent);
|
||||
|
||||
this.templateFunction = Marionette.TemplateCache.get(this.template);
|
||||
var data = this.model.toJSON();
|
||||
var html = this.templateFunction(data);
|
||||
this.$el.html(html);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
1
src/UI/Cells/EpisodeProgressCellTemplate.html
Normal file
1
src/UI/Cells/EpisodeProgressCellTemplate.html
Normal file
@@ -0,0 +1 @@
|
||||
{{> EpisodeProgressPartial }}
|
||||
88
src/UI/Cells/EpisodeStatusCell.js
Normal file
88
src/UI/Cells/EpisodeStatusCell.js
Normal file
@@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'underscore',
|
||||
'Cells/NzbDroneCell',
|
||||
'History/Queue/QueueCollection',
|
||||
'moment',
|
||||
'Shared/FormatHelpers'
|
||||
], function (App, _, NzbDroneCell, QueueCollection, Moment, FormatHelpers) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'episode-status-cell',
|
||||
|
||||
render: function () {
|
||||
this.listenTo(QueueCollection, 'sync', this._renderCell);
|
||||
|
||||
this._renderCell();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_renderCell: function () {
|
||||
this.$el.empty();
|
||||
|
||||
if (this.model) {
|
||||
|
||||
var icon;
|
||||
var tooltip;
|
||||
|
||||
var hasAired = Moment(this.model.get('airDateUtc')).isBefore(Moment());
|
||||
var hasFile = this.model.get('hasFile');
|
||||
|
||||
if (hasFile) {
|
||||
var episodeFile = App.request(App.Reqres.GetEpisodeFileById, this.model.get('episodeFileId'));
|
||||
|
||||
this.listenTo(episodeFile, 'change', this._refresh);
|
||||
|
||||
var quality = episodeFile.get('quality');
|
||||
var size = FormatHelpers.bytes(episodeFile.get('size'));
|
||||
var title = 'Episode downloaded';
|
||||
|
||||
if (quality.proper) {
|
||||
title += ' [PROPER] - {0}'.format(size);
|
||||
this.$el.html('<span class="badge badge-info" title="{0}">{1}</span>'.format(title, quality.quality.name));
|
||||
}
|
||||
|
||||
else {
|
||||
title += ' - {0}'.format(size);
|
||||
this.$el.html('<span class="badge badge-inverse" title="{0}">{1}</span>'.format(title, quality.quality.name));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
else {
|
||||
var model = this.model;
|
||||
|
||||
var downloading = _.find(QueueCollection.models, function (queueModel) {
|
||||
return queueModel.get('episode').id === model.get('id');
|
||||
});
|
||||
|
||||
if (downloading || this.model.get('downloading')) {
|
||||
icon = 'icon-nd-downloading';
|
||||
tooltip = 'Episode is downloading';
|
||||
}
|
||||
|
||||
else if (!this.model.get('airDateUtc')) {
|
||||
icon = 'icon-nd-tba';
|
||||
tooltip = 'TBA';
|
||||
}
|
||||
|
||||
else if (hasAired) {
|
||||
icon = 'icon-nd-missing';
|
||||
tooltip = 'Episode missing from disk';
|
||||
}
|
||||
else {
|
||||
icon = 'icon-nd-not-aired';
|
||||
tooltip = 'Episode has not aired';
|
||||
}
|
||||
}
|
||||
|
||||
this.$el.html('<i class="{0}" title="{1}"/>'.format(icon, tooltip));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
33
src/UI/Cells/EpisodeTitleCell.js
Normal file
33
src/UI/Cells/EpisodeTitleCell.js
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Cells/NzbDroneCell'
|
||||
], function (App, NzbDroneCell) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'episode-title-cell',
|
||||
|
||||
events: {
|
||||
'click': '_showDetails'
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var title = this.cellValue.get('title');
|
||||
|
||||
if (!title || title === '') {
|
||||
title = 'TBA';
|
||||
}
|
||||
|
||||
this.$el.html(title);
|
||||
return this;
|
||||
},
|
||||
|
||||
_showDetails: function () {
|
||||
var hideSeriesLink = this.column.get('hideSeriesLink');
|
||||
|
||||
App.vent.trigger(App.Commands.ShowEpisodeDetails, { episode: this.cellValue, hideSeriesLink: hideSeriesLink });
|
||||
}
|
||||
});
|
||||
});
|
||||
19
src/UI/Cells/FileSizeCell.js
Normal file
19
src/UI/Cells/FileSizeCell.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'backgrid',
|
||||
'Shared/FormatHelpers'
|
||||
], function (Backgrid, FormatHelpers) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
className: 'file-size-cell',
|
||||
|
||||
render: function () {
|
||||
var size = this.model.get(this.column.get('name'));
|
||||
this.$el.html(FormatHelpers.bytes(size));
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
69
src/UI/Cells/Header/QualityHeaderCell.js
Normal file
69
src/UI/Cells/Header/QualityHeaderCell.js
Normal file
@@ -0,0 +1,69 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'backgrid',
|
||||
'Shared/Grid/HeaderCell'
|
||||
], function (Backgrid, NzbDroneHeaderCell) {
|
||||
|
||||
Backgrid.QualityHeaderCell = NzbDroneHeaderCell.extend({
|
||||
events: {
|
||||
'click': 'onClick'
|
||||
},
|
||||
|
||||
onClick: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var self = this;
|
||||
var columnName = this.column.get('name');
|
||||
|
||||
if (this.column.get('sortable')) {
|
||||
if (this.direction() === 'ascending') {
|
||||
this.sort(columnName, 'descending', function (left, right) {
|
||||
var leftVal = left.get(columnName);
|
||||
var rightVal = right.get(columnName);
|
||||
|
||||
return self._comparator(leftVal, rightVal);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.sort(columnName, 'ascending', function (left, right) {
|
||||
var leftVal = left.get(columnName);
|
||||
var rightVal = right.get(columnName);
|
||||
|
||||
return self._comparator(rightVal, leftVal);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_comparator: function (leftVal, rightVal) {
|
||||
var leftWeight = leftVal.quality.weight;
|
||||
var rightWeight = rightVal.quality.weight;
|
||||
|
||||
if (!leftWeight && !rightWeight) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!leftWeight) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!rightWeight) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (leftWeight === rightWeight) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (leftWeight > rightWeight) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
return Backgrid.QualityHeaderCell;
|
||||
});
|
||||
16
src/UI/Cells/IndexerCell.js
Normal file
16
src/UI/Cells/IndexerCell.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
class : 'indexer-cell',
|
||||
|
||||
render: function () {
|
||||
var indexer = this.model.get(this.column.get('name'));
|
||||
this.$el.html(indexer);
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
62
src/UI/Cells/NzbDroneCell.js
Normal file
62
src/UI/Cells/NzbDroneCell.js
Normal file
@@ -0,0 +1,62 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
_originalInit: Backgrid.Cell.prototype.initialize,
|
||||
|
||||
initialize: function () {
|
||||
this._originalInit.apply(this, arguments);
|
||||
this.cellValue = this._getValue();
|
||||
|
||||
this.listenTo(this.model, 'change', this._refresh);
|
||||
|
||||
if (this._onEdit) {
|
||||
this.listenTo(this.model, "backgrid:edit", function (model, column, cell, editor) {
|
||||
if (column.get("name") == this.column.get("name")) {
|
||||
this._onEdit(model, column, cell, editor);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_refresh: function () {
|
||||
this.cellValue = this._getValue();
|
||||
this.render();
|
||||
},
|
||||
|
||||
_getValue: function () {
|
||||
|
||||
var cellValue = this.column.get('cellValue');
|
||||
|
||||
if (cellValue) {
|
||||
if (cellValue === 'this') {
|
||||
return this.model;
|
||||
}
|
||||
}
|
||||
|
||||
var name = this.column.get('name');
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
13
src/UI/Cells/QualityCell.js
Normal file
13
src/UI/Cells/QualityCell.js
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Cells/TemplatedCell',
|
||||
'Cells/Edit/QualityCellEditor'
|
||||
], function (TemplatedCell, QualityCellEditor) {
|
||||
return TemplatedCell.extend({
|
||||
|
||||
className: 'quality-cell',
|
||||
template : 'Cells/QualityCellTemplate',
|
||||
editor : QualityCellEditor
|
||||
});
|
||||
});
|
||||
5
src/UI/Cells/QualityCellTemplate.html
Normal file
5
src/UI/Cells/QualityCellTemplate.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{#if proper}}
|
||||
<span class="badge badge-info" title="PROPER">{{quality.name}}</span>
|
||||
{{else}}
|
||||
<span class="badge badge-inverse">{{quality.name}}</span>
|
||||
{{/if}}
|
||||
24
src/UI/Cells/QualityProfileCell.js
Normal file
24
src/UI/Cells/QualityProfileCell.js
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backgrid',
|
||||
'Quality/QualityProfileCollection'
|
||||
], function (Backgrid, QualityProfileCollection) {
|
||||
return Backgrid.Cell.extend({
|
||||
className: 'quality-profile-cell',
|
||||
|
||||
render: function () {
|
||||
|
||||
this.$el.empty();
|
||||
var qualityProfileId = this.model.get(this.column.get('name'));
|
||||
|
||||
var profile = _.findWhere(QualityProfileCollection.models, { id: qualityProfileId });
|
||||
|
||||
if (profile) {
|
||||
this.$el.html(profile.get('name'));
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
23
src/UI/Cells/RelativeDateCell.js
Normal file
23
src/UI/Cells/RelativeDateCell.js
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Cells/NzbDroneCell',
|
||||
'moment',
|
||||
'Shared/FormatHelpers'
|
||||
], function (NzbDroneCell, Moment, FormatHelpers) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'relative-date-cell',
|
||||
|
||||
render: function () {
|
||||
|
||||
var date = this.model.get(this.column.get('name'));
|
||||
|
||||
if (date) {
|
||||
this.$el.html("<span title='" + Moment(date).format('LLLL') + "' >" + FormatHelpers.dateHelper(date) + "</span");
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
37
src/UI/Cells/SeriesActionsCell.js
Normal file
37
src/UI/Cells/SeriesActionsCell.js
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Cells/NzbDroneCell'
|
||||
], function (App, NzbDroneCell) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'series-actions-cell',
|
||||
|
||||
events: {
|
||||
'click .x-edit-series' : '_editSeries',
|
||||
'click .x-remove-series': '_removeSeries'
|
||||
},
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
|
||||
this.$el.html(
|
||||
'<i class="icon-cog x-edit-series" title="" data-original-title="Edit Series"></i> ' +
|
||||
'<i class="icon-remove x-remove-series" title="" data-original-title="Delete Series"></i>'
|
||||
);
|
||||
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
},
|
||||
|
||||
_editSeries: function () {
|
||||
App.vent.trigger(App.Commands.EditSeriesCommand, {series:this.model});
|
||||
},
|
||||
|
||||
_removeSeries: function () {
|
||||
App.vent.trigger(App.Commands.DeleteSeriesCommand, {series:this.model});
|
||||
}
|
||||
});
|
||||
});
|
||||
32
src/UI/Cells/SeriesStatusCell.js
Normal file
32
src/UI/Cells/SeriesStatusCell.js
Normal file
@@ -0,0 +1,32 @@
|
||||
'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 (status === 'ended') {
|
||||
this.$el.html('<i class="icon-stop grid-icon" title="Ended"></i>');
|
||||
this.model.set('statusWeight', 3);
|
||||
}
|
||||
|
||||
else if (!monitored) {
|
||||
this.$el.html('<i class="icon-pause grid-icon" title="Not Monitored"></i>');
|
||||
this.model.set('statusWeight', 2);
|
||||
}
|
||||
|
||||
else {
|
||||
this.$el.html('<i class="icon-play grid-icon" title="Continuing"></i>');
|
||||
this.model.set('statusWeight', 1);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
12
src/UI/Cells/SeriesTitleCell.js
Normal file
12
src/UI/Cells/SeriesTitleCell.js
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Cells/TemplatedCell'
|
||||
], function (TemplatedCell) {
|
||||
return TemplatedCell.extend({
|
||||
|
||||
className: 'series-title',
|
||||
template : 'Cells/SeriesTitleTemplate'
|
||||
|
||||
});
|
||||
});
|
||||
1
src/UI/Cells/SeriesTitleTemplate.html
Normal file
1
src/UI/Cells/SeriesTitleTemplate.html
Normal file
@@ -0,0 +1 @@
|
||||
<a href="{{route}}">{{title}}</a>
|
||||
23
src/UI/Cells/TemplatedCell.js
Normal file
23
src/UI/Cells/TemplatedCell.js
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Cells/NzbDroneCell'
|
||||
], function (Marionette, NzbDroneCell) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
render: function () {
|
||||
|
||||
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);
|
||||
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
53
src/UI/Cells/ToggleCell.js
Normal file
53
src/UI/Cells/ToggleCell.js
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
|
||||
className: 'toggle-cell',
|
||||
|
||||
events: {
|
||||
'click': '_onClick'
|
||||
},
|
||||
|
||||
_onClick: function () {
|
||||
|
||||
var self = this;
|
||||
|
||||
this.$el.tooltip('hide');
|
||||
|
||||
var name = this.column.get('name');
|
||||
this.model.set(name, !this.model.get(name));
|
||||
|
||||
this.$('i').addClass('icon-spinner icon-spin');
|
||||
|
||||
this.model.save().always(function () {
|
||||
self.render();
|
||||
});
|
||||
},
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
this.$el.html('<i />');
|
||||
|
||||
var name = this.column.get('name');
|
||||
|
||||
if (this.model.get(name)) {
|
||||
this.$('i').addClass(this.column.get('trueClass'));
|
||||
}
|
||||
else {
|
||||
this.$('i').addClass(this.column.get('falseClass'));
|
||||
}
|
||||
|
||||
var tooltip = this.column.get('tooltip');
|
||||
|
||||
if (tooltip) {
|
||||
this.$('i').attr('title', tooltip);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
99
src/UI/Cells/cells.less
Normal file
99
src/UI/Cells/cells.less
Normal file
@@ -0,0 +1,99 @@
|
||||
@import "../Content/Bootstrap/mixins";
|
||||
@import "../Content/Bootstrap/variables";
|
||||
@import "../Content/Bootstrap/buttons";
|
||||
@import "../Shared/Styles/clickable";
|
||||
|
||||
.episode-title-cell {
|
||||
.btn-link;
|
||||
}
|
||||
|
||||
.air-date-cell {
|
||||
width : 120px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.relative-date-cell {
|
||||
width : 150px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.history-event-type-cell {
|
||||
width : 10px;
|
||||
}
|
||||
|
||||
.download-report-cell {
|
||||
.clickable();
|
||||
|
||||
i {
|
||||
.clickable();
|
||||
}
|
||||
}
|
||||
|
||||
.toggle-cell{
|
||||
.clickable();
|
||||
}
|
||||
|
||||
.approval-status-cell {
|
||||
widows : 10px;
|
||||
.popover {
|
||||
max-width : 400px;
|
||||
}
|
||||
|
||||
i {
|
||||
color : @red;
|
||||
}
|
||||
}
|
||||
|
||||
td.episode-status-cell, td.quality-cell {
|
||||
text-align: center;
|
||||
width: 80px;
|
||||
|
||||
.badge {
|
||||
font-size: 9px;
|
||||
}
|
||||
}
|
||||
|
||||
.history-details-cell {
|
||||
.clickable();
|
||||
width: 10px;
|
||||
|
||||
i {
|
||||
.clickable();
|
||||
}
|
||||
}
|
||||
|
||||
.nzb-title-cell {
|
||||
max-width: 600px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.episode-actions-cell {
|
||||
width: 50px;
|
||||
|
||||
li {
|
||||
.clickable();
|
||||
|
||||
display: block;
|
||||
padding: 3px 20px;
|
||||
clear: both;
|
||||
font-weight: normal;
|
||||
line-height: 20px;
|
||||
color: rgb(51, 51, 51);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
li:hover {
|
||||
text-decoration: none;
|
||||
color: rgb(255, 255, 255);
|
||||
background-color: rgb(0, 129, 194);
|
||||
}
|
||||
}
|
||||
|
||||
.series-actions-cell {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.timeleft-cell {
|
||||
cursor: default;
|
||||
width: 80px;
|
||||
}
|
||||
Reference in New Issue
Block a user