parent
ef62af75df
commit
b0bd3f34f1
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<file url="PROJECT" libraries="{libraries}" />
|
||||
<file url="PROJECT" libraries="{jQuery-1.9.1}" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="libraries" type="javaScript">
|
||||
<properties>
|
||||
<sourceFilesUrls>
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/bootstrap.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.debug.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/sugar.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.shortcuts.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.pager.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/handlebars.runtime.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.bootstrap.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.modelbinder.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/fullcalendar.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.collectionbinder.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/underscore.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/bootstrap.slider.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.viewswapper.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/require.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.mutators.js" />
|
||||
</sourceFilesUrls>
|
||||
</properties>
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/bootstrapSwitch.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/toastr-1.1.5.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/bootstrap.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.debug.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/sugar.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.shortcuts.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.pager.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/handlebars.runtime.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.bootstrap.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.modelbinder.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.collectionbinder.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/fullcalendar.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/underscore.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/bootstrap.slider.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.viewswapper.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.mutators.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/require.js" />
|
||||
</CLASSES>
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
@ -1,12 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app',
|
||||
'Calendar/UpcomingCollection'
|
||||
|
||||
], function () {
|
||||
NzbDrone.Calendar.UpcomingItemView = Backbone.Marionette.ItemView.extend({
|
||||
template : 'Calendar/UpcomingItemTemplate',
|
||||
tagName : 'div'
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
], function (Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Calendar/UpcomingItemTemplate',
|
||||
tagName : 'div'
|
||||
});
|
||||
});
|
||||
});
|
@ -1,121 +1,121 @@
|
||||
.calendar {
|
||||
th, td {
|
||||
border-color: #eeeeee;
|
||||
border-color : #eeeeee;
|
||||
}
|
||||
|
||||
.primary {
|
||||
border-color: #007ccd;
|
||||
background-color: #007ccd;
|
||||
border-color : #007ccd;
|
||||
background-color : #007ccd;
|
||||
}
|
||||
|
||||
.fc-event-skin {
|
||||
background-color: #007ccd;
|
||||
border: 1px solid #007ccd;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
background-color : #007ccd;
|
||||
border : 1px solid #007ccd;
|
||||
border-radius : 4px;
|
||||
text-align : center;
|
||||
}
|
||||
|
||||
.info {
|
||||
border-color: #14b8d4;
|
||||
background-color: #14b8d4;
|
||||
border-color : #14b8d4;
|
||||
background-color : #14b8d4;
|
||||
}
|
||||
|
||||
.inverse {
|
||||
border-color: #333333;
|
||||
background-color: #333333;
|
||||
border-color : #333333;
|
||||
background-color : #333333;
|
||||
}
|
||||
|
||||
.warning {
|
||||
border-color: #ffa93c;
|
||||
background-color: #ffa93c;
|
||||
border-color : #ffa93c;
|
||||
background-color : #ffa93c;
|
||||
}
|
||||
|
||||
.danger {
|
||||
border-color: #ea494a;
|
||||
background-color: #ea494a;
|
||||
border-color : #ea494a;
|
||||
background-color : #ea494a;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #eeeeee;
|
||||
background-color : #eeeeee;
|
||||
}
|
||||
|
||||
.purple {
|
||||
border-color: #7932ea;
|
||||
background-color: #7932ea;
|
||||
border-color : #7932ea;
|
||||
background-color : #7932ea;
|
||||
}
|
||||
|
||||
.success {
|
||||
border-color: #4cb158;
|
||||
background-color: #4cb158;
|
||||
border-color : #4cb158;
|
||||
background-color : #4cb158;
|
||||
}
|
||||
h2 {
|
||||
font-size: 17.5px;
|
||||
font-size : 17.5px;
|
||||
}
|
||||
}
|
||||
|
||||
.event {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
border-top: 1px solid #eeeeee;
|
||||
padding-top: 10px;
|
||||
display : inline-block;
|
||||
width : 100%;
|
||||
margin-bottom : 10px;
|
||||
border-top : 1px solid #eeeeee;
|
||||
padding-top : 10px;
|
||||
|
||||
.primary {
|
||||
border-color: #007ccd;
|
||||
border-color : #007ccd;
|
||||
}
|
||||
|
||||
.info {
|
||||
border-color: #14b8d4;
|
||||
border-color : #14b8d4;
|
||||
}
|
||||
|
||||
h4 {
|
||||
text-transform: none !important;
|
||||
font-weight: 500;
|
||||
color: #008dcd;
|
||||
margin: 5px 0px;
|
||||
text-transform : none !important;
|
||||
font-weight : 500;
|
||||
color : #008dcd;
|
||||
margin : 5px 0px;
|
||||
}
|
||||
|
||||
.inverse {
|
||||
border-color: #333333;
|
||||
border-color : #333333;
|
||||
}
|
||||
|
||||
.warning {
|
||||
border-color: #ffa93c;
|
||||
border-color : #ffa93c;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #999999;
|
||||
color : #999999;
|
||||
}
|
||||
|
||||
.danger {
|
||||
border-color: #ea494a;
|
||||
border-color : #ea494a;
|
||||
}
|
||||
|
||||
.date {
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
border-left: 4px solid #eeeeee;
|
||||
padding-left: 16px;
|
||||
float: left;
|
||||
margin-right: 20px;
|
||||
text-align : center;
|
||||
display : inline-block;
|
||||
border-left : 4px solid #eeeeee;
|
||||
padding-left : 16px;
|
||||
float : left;
|
||||
margin-right : 20px;
|
||||
|
||||
h4 {
|
||||
line-height: 1em;
|
||||
color: #555555;
|
||||
font-weight: 300;
|
||||
line-height : 1em;
|
||||
color : #555555;
|
||||
font-weight : 300;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: 500;
|
||||
line-height: 0.8em;
|
||||
font-weight : 500;
|
||||
line-height : 0.8em;
|
||||
}
|
||||
}
|
||||
|
||||
.purple {
|
||||
border-color: #7932ea;
|
||||
border-color : #7932ea;
|
||||
}
|
||||
|
||||
.success {
|
||||
border-color: #4cb158;
|
||||
border-color : #4cb158;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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,17 +1,16 @@
|
||||
'use strict';
|
||||
define(['app'], function () {
|
||||
define({
|
||||
Execute: function (name, properties) {
|
||||
var data = { command: name };
|
||||
|
||||
NzbDrone.Commands.Execute = function (name, properties) {
|
||||
var data = { command: name };
|
||||
if (properties) {
|
||||
$.extend(data, properties);
|
||||
}
|
||||
|
||||
if (properties) {
|
||||
$.extend(data, properties);
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
url : window.ApiRoot + '/command',
|
||||
data: JSON.stringify(data)
|
||||
});
|
||||
}
|
||||
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
url : NzbDrone.Constants.ApiRoot + '/command',
|
||||
data: JSON.stringify(data)
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
@ -1,78 +1,85 @@
|
||||
'use strict';
|
||||
define(['app', 'Shared/SpinnerView', 'Episode/Summary/View', 'Episode/Search/Layout', 'Release/Collection'], function () {
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Episode/Summary/View',
|
||||
'Episode/Search/Layout',
|
||||
'Release/Collection',
|
||||
'Shared/SpinnerView'
|
||||
], function (Marionette, SummaryView, SearchLayout, ReleaseCollection, SpinnerView) {
|
||||
|
||||
NzbDrone.Episode.Layout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Episode/LayoutTemplate',
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Episode/LayoutTemplate',
|
||||
|
||||
|
||||
regions: {
|
||||
summary : '#episode-summary',
|
||||
activity: '#episode-activity',
|
||||
search : '#episode-search'
|
||||
},
|
||||
regions: {
|
||||
summary : '#episode-summary',
|
||||
activity: '#episode-activity',
|
||||
search : '#episode-search'
|
||||
},
|
||||
|
||||
ui: {
|
||||
summary : '.x-episode-summary',
|
||||
activity: '.x-episode-activity',
|
||||
search : '.x-episode-search'
|
||||
},
|
||||
ui: {
|
||||
summary : '.x-episode-summary',
|
||||
activity: '.x-episode-activity',
|
||||
search : '.x-episode-search'
|
||||
},
|
||||
|
||||
events: {
|
||||
events: {
|
||||
|
||||
'click .x-episode-summary' : 'showSummary',
|
||||
'click .x-episode-activity': 'showActivity',
|
||||
'click .x-episode-search' : 'showSearch'
|
||||
},
|
||||
'click .x-episode-summary' : 'showSummary',
|
||||
'click .x-episode-activity': 'showActivity',
|
||||
'click .x-episode-search' : 'showSearch'
|
||||
},
|
||||
|
||||
|
||||
onShow: function () {
|
||||
this.showSummary();
|
||||
this._releaseSearchActivated = false;
|
||||
},
|
||||
onShow: function () {
|
||||
this.showSummary();
|
||||
this._releaseSearchActivated = false;
|
||||
},
|
||||
|
||||
|
||||
showSummary: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
showSummary: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
this.ui.summary.tab('show');
|
||||
this.summary.show(new NzbDrone.Episode.Summary.View({model: this.model}));
|
||||
this.ui.summary.tab('show');
|
||||
this.summary.show(new SummaryView({model: this.model}));
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
showActivity: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
showActivity: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
this.ui.activity.tab('show');
|
||||
},
|
||||
this.ui.activity.tab('show');
|
||||
},
|
||||
|
||||
showSearch: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
showSearch: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
if (this._releaseSearchActivated) {
|
||||
return;
|
||||
}
|
||||
if (this._releaseSearchActivated) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var self = this;
|
||||
|
||||
this.ui.search.tab('show');
|
||||
this.search.show(new NzbDrone.Shared.SpinnerView());
|
||||
this.ui.search.tab('show');
|
||||
this.search.show(new SpinnerView());
|
||||
|
||||
var releases = new NzbDrone.Release.Collection();
|
||||
var promise = releases.fetchEpisodeReleases(this.model.id);
|
||||
var releases = new ReleaseCollection();
|
||||
var promise = releases.fetchEpisodeReleases(this.model.id);
|
||||
|
||||
promise.done(function () {
|
||||
if (!self.isClosed) {
|
||||
self.search.show(new NzbDrone.Episode.Search.Layout({collection: releases}));
|
||||
}
|
||||
});
|
||||
}
|
||||
promise.done(function () {
|
||||
if (!self.isClosed) {
|
||||
self.search.show(new SearchLayout({collection: releases}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -1,68 +1,70 @@
|
||||
'use strict';
|
||||
define([
|
||||
'app',
|
||||
'Cells/FileSizeCell',
|
||||
'Cells/QualityCell',
|
||||
'Release/ApprovalStatusCell',
|
||||
'Release/DownloadReportCell'
|
||||
], function () {
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'backgrid',
|
||||
'Cells/FileSizeCell',
|
||||
'Cells/QualityCell',
|
||||
'Release/ApprovalStatusCell',
|
||||
'Release/DownloadReportCell'
|
||||
], function (Marionette, Backgrid, FileSizeCell, QualityCell, ApprovalStatusCell, DownloadReportCell) {
|
||||
|
||||
NzbDrone.Episode.Search.Layout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Episode/Search/LayoutTemplate',
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Episode/Search/LayoutTemplate',
|
||||
|
||||
regions: {
|
||||
grid: '#episode-release-grid'
|
||||
},
|
||||
|
||||
columns: [
|
||||
{
|
||||
name : 'age',
|
||||
label : 'Age',
|
||||
sortable: true,
|
||||
cell : Backgrid.IntegerCell
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
sortable: true,
|
||||
cell : Backgrid.StringCell
|
||||
},
|
||||
{
|
||||
name : 'size',
|
||||
label : 'Size',
|
||||
sortable: true,
|
||||
cell : NzbDrone.Cells.FileSizeCell
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label : 'Quality',
|
||||
sortable: true,
|
||||
cell : NzbDrone.Cells.QualityCell
|
||||
regions: {
|
||||
grid: '#episode-release-grid'
|
||||
},
|
||||
|
||||
{
|
||||
name : 'rejections',
|
||||
label: 'decision',
|
||||
cell : NzbDrone.Release.ApprovalStatusCell
|
||||
},
|
||||
{
|
||||
name : 'download',
|
||||
label: '',
|
||||
cell : NzbDrone.Release.DownloadReportCell
|
||||
}
|
||||
],
|
||||
columns:
|
||||
[
|
||||
{
|
||||
name : 'age',
|
||||
label : 'Age',
|
||||
sortable: true,
|
||||
cell : Backgrid.IntegerCell
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
sortable: true,
|
||||
cell : Backgrid.StringCell
|
||||
},
|
||||
{
|
||||
name : 'size',
|
||||
label : 'Size',
|
||||
sortable: true,
|
||||
cell : FileSizeCell
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label : 'Quality',
|
||||
sortable: true,
|
||||
cell : QualityCell
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
if (!this.isClosed) {
|
||||
this.grid.show(new Backgrid.Grid(
|
||||
{
|
||||
name : 'rejections',
|
||||
label: 'decision',
|
||||
cell : ApprovalStatusCell
|
||||
},
|
||||
{
|
||||
name : 'download',
|
||||
label: '',
|
||||
cell : DownloadReportCell
|
||||
}
|
||||
],
|
||||
|
||||
onShow: function () {
|
||||
if (!this.isClosed) {
|
||||
this.grid.show(new Backgrid.Grid({
|
||||
row : Backgrid.Row,
|
||||
columns : this.columns,
|
||||
collection: this.collection,
|
||||
className : 'table table-hover'
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -1,8 +1,11 @@
|
||||
'use strict';
|
||||
define(['app'], function () {
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
], function (Marionette) {
|
||||
|
||||
NzbDrone.Episode.Summary.View = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Episode/Summary/ViewTemplate'
|
||||
});
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Episode/Summary/ViewTemplate'
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -1,31 +1,50 @@
|
||||
'use strict';
|
||||
define(['app', 'handlebars'], function (App,Handlebars) {
|
||||
Handlebars.registerHelper('formBuilder', function () {
|
||||
var ret = '';
|
||||
_.each(this.fields, function (field) {
|
||||
ret += NzbDrone.Form.FieldBuilder(field);
|
||||
});
|
||||
define(
|
||||
[
|
||||
'handlebars'
|
||||
], function (Handlebars) {
|
||||
|
||||
return new Handlebars.SafeString(ret);
|
||||
});
|
||||
var formBuilder = function (field) {
|
||||
if (!field.type) {
|
||||
return Handlebars.helpers.partial.apply(field,
|
||||
[
|
||||
'Form/TextboxTemplate'
|
||||
]);
|
||||
}
|
||||
|
||||
if (field.type === 'password') {
|
||||
return Handlebars.helpers.partial.apply(field,
|
||||
[
|
||||
'Form/PasswordTemplate'
|
||||
]);
|
||||
}
|
||||
|
||||
NzbDrone.Form.FieldBuilder = function (field) {
|
||||
if (!field.type) {
|
||||
return Handlebars.helpers.partial.apply(field, ['Form/TextboxTemplate']);
|
||||
}
|
||||
if (field.type === 'checkbox') {
|
||||
return Handlebars.helpers.partial.apply(field,
|
||||
[
|
||||
'Form/CheckboxTemplate'
|
||||
]);
|
||||
}
|
||||
|
||||
if (field.type === 'password') {
|
||||
return Handlebars.helpers.partial.apply(field, ['Form/PasswordTemplate']);
|
||||
}
|
||||
if (field.type === 'select') {
|
||||
return Handlebars.helpers.partial.apply(field,
|
||||
[
|
||||
'Form/SelectTemplate'
|
||||
]);
|
||||
}
|
||||
|
||||
if (field.type === 'checkbox') {
|
||||
return Handlebars.helpers.partial.apply(field, ['Form/CheckboxTemplate']);
|
||||
}
|
||||
return Handlebars.helpers.partial.apply(field,
|
||||
[
|
||||
'Form/TextboxTemplate'
|
||||
]);
|
||||
};
|
||||
|
||||
if (field.type === 'select') {
|
||||
return Handlebars.helpers.partial.apply(field, ['Form/SelectTemplate']);
|
||||
}
|
||||
Handlebars.registerHelper('formBuilder', function () {
|
||||
var ret = '';
|
||||
_.each(this.fields, function (field) {
|
||||
ret += this.FieldBuilder(field);
|
||||
});
|
||||
|
||||
return Handlebars.helpers.partial.apply(field, ['Form/TextboxTemplate']);
|
||||
};
|
||||
});
|
||||
return new Handlebars.SafeString(ret);
|
||||
});
|
||||
});
|
||||
|
@ -1,49 +1,55 @@
|
||||
'use strict';
|
||||
define(['app', 'signalR'], function () {
|
||||
define(
|
||||
[
|
||||
'signalR'
|
||||
], function () {
|
||||
|
||||
_.extend(Backbone.Collection.prototype, {BindSignalR: function (options) {
|
||||
|
||||
if (!options || !options.url) {
|
||||
console.assert(this.url, 'url must be provided or collection must have url');
|
||||
options = {
|
||||
url: this.url.replace('api', 'signalr')
|
||||
};
|
||||
}
|
||||
|
||||
_.extend(Backbone.Collection.prototype, {BindSignalR: function (options) {
|
||||
var self = this;
|
||||
|
||||
var _getStatus = function (status) {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return 'connecting';
|
||||
case 1:
|
||||
return 'connected';
|
||||
case 2:
|
||||
return 'reconnecting';
|
||||
case 4:
|
||||
return 'disconnected';
|
||||
default:
|
||||
throw 'invalid status ' + status;
|
||||
}
|
||||
|
||||
if (!options || !options.url) {
|
||||
console.assert(this.url, 'url must be provided or collection must have url');
|
||||
options = {
|
||||
url: this.url.replace('api', 'signalr')
|
||||
};
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
var _getStatus = function (status) {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return 'connecting';
|
||||
case 1:
|
||||
return 'connected';
|
||||
case 2:
|
||||
return 'reconnecting';
|
||||
case 4:
|
||||
return 'disconnected';
|
||||
default:
|
||||
throw 'invalid status ' + status;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
var connection = $.connection(options.url);
|
||||
var connection = $.connection(options.url);
|
||||
|
||||
connection.stateChanged(function (change) {
|
||||
console.debug('{0} [{1}]'.format(options.url, _getStatus(change.newState)));
|
||||
});
|
||||
connection.stateChanged(function (change) {
|
||||
console.debug('{0} [{1}]'.format(options.url, _getStatus(change.newState)));
|
||||
});
|
||||
|
||||
connection.received(function (model) {
|
||||
console.debug(model);
|
||||
self.fetch();
|
||||
});
|
||||
connection.received(function (model) {
|
||||
console.debug(model);
|
||||
self.fetch();
|
||||
});
|
||||
|
||||
connection.start({ transport: ['longPolling'] });
|
||||
connection.start({ transport:
|
||||
[
|
||||
'longPolling'
|
||||
] });
|
||||
|
||||
return this;
|
||||
}});
|
||||
});
|
||||
return this;
|
||||
}});
|
||||
});
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette'
|
||||
], function (App, Marionette) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Quality/Profile/DeleteTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_removeProfile'
|
||||
},
|
||||
|
||||
_removeProfile: function () {
|
||||
|
||||
this.model.destroy({
|
||||
wait: true
|
||||
}).done(function () {
|
||||
App.modalRegion.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
@ -1,37 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
define(['app'], function () {
|
||||
NzbDrone.Shared.FormatHelpers.FileSizeHelper = function (sourceSize) {
|
||||
var size = Number(sourceSize);
|
||||
return size.bytes(1);
|
||||
};
|
||||
define(
|
||||
[
|
||||
'sugar'
|
||||
], {
|
||||
FileSizeHelper: function (sourceSize) {
|
||||
var size = Number(sourceSize);
|
||||
return size.bytes(1);
|
||||
},
|
||||
|
||||
NzbDrone.Shared.FormatHelpers.DateHelper = function (sourceDate) {
|
||||
if (!sourceDate) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Date.create(sourceDate);
|
||||
DateHelper: function (sourceDate) {
|
||||
if (!sourceDate) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (date.isYesterday()) {
|
||||
return 'Yesterday';
|
||||
}
|
||||
if (date.isToday()) {
|
||||
return 'Today';
|
||||
}
|
||||
if (date.isTomorrow()) {
|
||||
return 'Tomorrow';
|
||||
}
|
||||
if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) {
|
||||
return date.format('{Weekday}');
|
||||
}
|
||||
var date = Date.create(sourceDate);
|
||||
|
||||
if (date.isAfter(Date.create().addDays(6))) {
|
||||
return date.relative().replace(' from now', '');
|
||||
}
|
||||
if (date.isYesterday()) {
|
||||
return 'Yesterday';
|
||||
}
|
||||
if (date.isToday()) {
|
||||
return 'Today';
|
||||
}
|
||||
if (date.isTomorrow()) {
|
||||
return 'Tomorrow';
|
||||
}
|
||||
if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) {
|
||||
return date.format('{Weekday}');
|
||||
}
|
||||
|
||||
return date.format('{MM}/{dd}/{yyyy}');
|
||||
};
|
||||
if (date.isAfter(Date.create().addDays(6))) {
|
||||
return date.relative().replace(' from now', '');
|
||||
}
|
||||
|
||||
return NzbDrone.Shared.FormatHelpers;
|
||||
});
|
||||
return date.format('{MM}/{dd}/{yyyy}');
|
||||
}
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue