parent
019525dd9d
commit
d6079a701c
@ -1,39 +1,41 @@
|
|||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var Backbone = require('backbone');
|
var Backbone = require('backbone');
|
||||||
var Marionette = require('marionette');
|
var Marionette = require('marionette');
|
||||||
|
var region = Marionette.Region.extend({
|
||||||
|
el : '#control-panel-region',
|
||||||
|
|
||||||
module.exports = (function(){
|
constructor : function() {
|
||||||
var region = Marionette.Region.extend({
|
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);
|
||||||
el : '#control-panel-region',
|
this.on('show', this.showPanel, this);
|
||||||
constructor : function(){
|
},
|
||||||
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);
|
|
||||||
this.on('show', this.showPanel, this);
|
getEl : function(selector) {
|
||||||
},
|
var $el = $(selector);
|
||||||
getEl : function(selector){
|
|
||||||
var $el = $(selector);
|
return $el;
|
||||||
return $el;
|
},
|
||||||
},
|
|
||||||
showPanel : function(){
|
showPanel : function() {
|
||||||
$('body').addClass('control-panel-visible');
|
$('body').addClass('control-panel-visible');
|
||||||
this.$el.animate({
|
this.$el.animate({
|
||||||
"margin-bottom" : 0,
|
'margin-bottom' : 0,
|
||||||
"opacity" : 1
|
'opacity' : 1
|
||||||
}, {
|
}, {
|
||||||
queue : false,
|
queue : false,
|
||||||
duration : 300
|
duration : 300
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
closePanel : function(){
|
|
||||||
$('body').removeClass('control-panel-visible');
|
closePanel : function() {
|
||||||
this.$el.animate({
|
$('body').removeClass('control-panel-visible');
|
||||||
"margin-bottom" : -100,
|
this.$el.animate({
|
||||||
"opacity" : 0
|
'margin-bottom' : -100,
|
||||||
}, {
|
'opacity' : 0
|
||||||
queue : false,
|
}, {
|
||||||
duration : 300
|
queue : false,
|
||||||
});
|
duration : 300
|
||||||
this.reset();
|
});
|
||||||
}
|
this.reset();
|
||||||
});
|
}
|
||||||
return region;
|
});
|
||||||
}).call(this);
|
module.exports = region;
|
@ -1,3 +1,5 @@
|
|||||||
var Marionette = require('marionette');
|
var Marionette = require('marionette');
|
||||||
|
|
||||||
module.exports = Marionette.CompositeView.extend({template : 'Shared/FileBrowser/EmptyViewTemplate'});
|
module.exports = Marionette.CompositeView.extend({
|
||||||
|
template : 'Shared/FileBrowser/EmptyViewTemplate'
|
||||||
|
});
|
@ -1,116 +1,144 @@
|
|||||||
module.exports = function() {
|
module.exports = function() {
|
||||||
var backgrid = this;
|
var Backgrid = this;
|
||||||
|
|
||||||
backgrid.SonarrHeaderCell = backgrid.HeaderCell.extend({
|
Backgrid.SonarrHeaderCell = Backgrid.HeaderCell.extend({
|
||||||
events : {
|
events : {
|
||||||
'click' : 'onClick'
|
'click' : 'onClick'
|
||||||
},
|
},
|
||||||
_originalInit : backgrid.HeaderCell.prototype.initialize,
|
|
||||||
initialize : function(options){
|
_originalInit : Backgrid.HeaderCell.prototype.initialize,
|
||||||
|
|
||||||
|
initialize : function(options) {
|
||||||
this._originalInit.call(this, options);
|
this._originalInit.call(this, options);
|
||||||
|
|
||||||
this.listenTo(this.collection, 'drone:sort', this.render);
|
this.listenTo(this.collection, 'drone:sort', this.render);
|
||||||
},
|
},
|
||||||
render : function(){
|
|
||||||
|
render : function() {
|
||||||
this.$el.empty();
|
this.$el.empty();
|
||||||
this.$el.append(this.column.get('label'));
|
this.$el.append(this.column.get('label'));
|
||||||
|
|
||||||
var column = this.column;
|
var column = this.column;
|
||||||
var sortable = backgrid.callByNeed(column.sortable(), column, this.collection);
|
var sortable = Backgrid.callByNeed(column.sortable(), column, this.collection);
|
||||||
if(sortable) {
|
|
||||||
|
if (sortable) {
|
||||||
this.$el.addClass('sortable');
|
this.$el.addClass('sortable');
|
||||||
this.$el.append(' <i class="pull-right"></i>');
|
this.$el.append(' <i class="pull-right"></i>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Do we need this?
|
||||||
this.$el.addClass(column.get('name'));
|
this.$el.addClass(column.get('name'));
|
||||||
if(column.has('className')) {
|
|
||||||
|
if (column.has('className')) {
|
||||||
this.$el.addClass(column.get('className'));
|
this.$el.addClass(column.get('className'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.delegateEvents();
|
this.delegateEvents();
|
||||||
this.direction(column.get('direction'));
|
this.direction(column.get('direction'));
|
||||||
if(this.collection.state) {
|
|
||||||
|
if (this.collection.state) {
|
||||||
var name = this._getSortMapping().name;
|
var name = this._getSortMapping().name;
|
||||||
var order = this.collection.state.order;
|
var order = this.collection.state.order;
|
||||||
if(name === column.get('name')) {
|
|
||||||
|
if (name === column.get('name')) {
|
||||||
this._setSortIcon(order);
|
this._setSortIcon(order);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this._removeSortIcon();
|
this._removeSortIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
direction : function(dir){
|
|
||||||
|
direction : function(dir) {
|
||||||
this.$el.children('i').removeClass('icon-sort-up icon-sort-down');
|
this.$el.children('i').removeClass('icon-sort-up icon-sort-down');
|
||||||
if(arguments.length) {
|
|
||||||
if(dir) {
|
if (arguments.length) {
|
||||||
|
if (dir) {
|
||||||
this._setSortIcon(dir);
|
this._setSortIcon(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.column.set('direction', dir);
|
this.column.set('direction', dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
var columnDirection = this.column.get('direction');
|
var columnDirection = this.column.get('direction');
|
||||||
if(!columnDirection && this.collection.state) {
|
|
||||||
|
if (!columnDirection && this.collection.state) {
|
||||||
var name = this._getSortMapping().name;
|
var name = this._getSortMapping().name;
|
||||||
var order = this.collection.state.order;
|
var order = this.collection.state.order;
|
||||||
if(name === this.column.get('name')) {
|
|
||||||
|
if (name === this.column.get('name')) {
|
||||||
columnDirection = order;
|
columnDirection = order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return columnDirection;
|
return columnDirection;
|
||||||
},
|
},
|
||||||
_getSortMapping : function(){
|
|
||||||
|
_getSortMapping : function() {
|
||||||
var sortKey = this.collection.state.sortKey;
|
var sortKey = this.collection.state.sortKey;
|
||||||
if(this.collection._getSortMapping) {
|
|
||||||
|
if (this.collection._getSortMapping) {
|
||||||
return this.collection._getSortMapping(sortKey);
|
return this.collection._getSortMapping(sortKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name : sortKey,
|
name : sortKey,
|
||||||
sortKey : sortKey
|
sortKey : sortKey
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onClick : function(e){
|
|
||||||
|
onClick : function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var collection = this.collection;
|
var collection = this.collection;
|
||||||
var event = 'backgrid:sort';
|
var event = 'backgrid:sort';
|
||||||
|
|
||||||
var column = this.column;
|
var column = this.column;
|
||||||
var sortable = backgrid.callByNeed(column.sortable(), column, collection);
|
var sortable = Backgrid.callByNeed(column.sortable(), column, collection);
|
||||||
if(sortable) {
|
if (sortable) {
|
||||||
var direction = collection.state.order;
|
var direction = collection.state.order;
|
||||||
if(direction === 'ascending' || direction === -1) {
|
if (direction === 'ascending' || direction === -1) {
|
||||||
direction = 'descending';
|
direction = 'descending';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
direction = 'ascending';
|
direction = 'ascending';
|
||||||
}
|
}
|
||||||
if(collection.setSorting) {
|
|
||||||
|
if (collection.setSorting) {
|
||||||
collection.setSorting(column.get('name'), direction);
|
collection.setSorting(column.get('name'), direction);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
collection.state.sortKey = column.get('name');
|
collection.state.sortKey = column.get('name');
|
||||||
collection.state.order = direction;
|
collection.state.order = direction;
|
||||||
}
|
}
|
||||||
collection.trigger(event, column, direction);
|
collection.trigger(event, column, direction);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_resetCellDirection : function(columnToSort, direction){
|
|
||||||
if(columnToSort !== this.column) {
|
_resetCellDirection : function(columnToSort, direction) {
|
||||||
|
if (columnToSort !== this.column) {
|
||||||
this.direction(null);
|
this.direction(null);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.direction(direction);
|
this.direction(direction);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_convertDirectionToIcon : function(dir){
|
|
||||||
if(dir === 'ascending' || dir === -1) {
|
_convertDirectionToIcon : function(dir) {
|
||||||
|
if (dir === 'ascending' || dir === -1) {
|
||||||
return 'icon-sort-up';
|
return 'icon-sort-up';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'icon-sort-down';
|
return 'icon-sort-down';
|
||||||
},
|
},
|
||||||
_setSortIcon : function(dir){
|
|
||||||
|
_setSortIcon : function(dir) {
|
||||||
this._removeSortIcon();
|
this._removeSortIcon();
|
||||||
this.$el.children('i').addClass(this._convertDirectionToIcon(dir));
|
this.$el.children('i').addClass(this._convertDirectionToIcon(dir));
|
||||||
},
|
},
|
||||||
_removeSortIcon : function(){
|
|
||||||
|
_removeSortIcon : function() {
|
||||||
this.$el.children('i').removeClass('icon-sort-up icon-sort-down');
|
this.$el.children('i').removeClass('icon-sort-up icon-sort-down');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return backgrid.SonarrHeaderCell;
|
return Backgrid.SonarrHeaderCell;
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
var Marionette = require('marionette');
|
var Marionette = require('marionette');
|
||||||
|
|
||||||
module.exports = Marionette.ItemView.extend({template : 'Shared/NotFoundViewTemplate'});
|
module.exports = Marionette.ItemView.extend({
|
||||||
|
template : 'Shared/NotFoundViewTemplate'
|
||||||
|
});
|
@ -1,4 +1,6 @@
|
|||||||
var Backbone = require('backbone');
|
var Backbone = require('backbone');
|
||||||
var ButtonModel = require('./ButtonModel');
|
var ButtonModel = require('./ButtonModel');
|
||||||
|
|
||||||
module.exports = Backbone.Collection.extend({model : ButtonModel});
|
module.exports = Backbone.Collection.extend({
|
||||||
|
model : ButtonModel
|
||||||
|
});
|
@ -1,25 +1,29 @@
|
|||||||
var Backbone = require('backbone');
|
var Backbone = require('backbone');
|
||||||
var ApiData = require('./ApiData');
|
var ApiData = require('./ApiData');
|
||||||
|
|
||||||
module.exports = (function(){
|
var UiSettings = Backbone.Model.extend({
|
||||||
var UiSettings = Backbone.Model.extend({
|
url : window.NzbDrone.ApiRoot + '/config/ui',
|
||||||
url : window.NzbDrone.ApiRoot + '/config/ui',
|
|
||||||
shortDateTime : function(includeSeconds){
|
shortDateTime : function(includeSeconds) {
|
||||||
return this.get('shortDateFormat') + ' ' + this.time(true, includeSeconds);
|
return this.get('shortDateFormat') + ' ' + this.time(true, includeSeconds);
|
||||||
},
|
},
|
||||||
longDateTime : function(includeSeconds){
|
|
||||||
return this.get('longDateFormat') + ' ' + this.time(true, includeSeconds);
|
longDateTime : function(includeSeconds) {
|
||||||
},
|
return this.get('longDateFormat') + ' ' + this.time(true, includeSeconds);
|
||||||
time : function(includeMinuteZero, includeSeconds){
|
},
|
||||||
if(includeSeconds) {
|
|
||||||
return this.get('timeFormat').replace(/\(?\:mm\)?/, ':mm:ss');
|
time : function(includeMinuteZero, includeSeconds) {
|
||||||
}
|
if (includeSeconds) {
|
||||||
if(includeMinuteZero) {
|
return this.get('timeFormat').replace(/\(?\:mm\)?/, ':mm:ss');
|
||||||
return this.get('timeFormat').replace('(', '').replace(')', '');
|
}
|
||||||
}
|
if (includeMinuteZero) {
|
||||||
return this.get('timeFormat').replace(/\(\:mm\)/, '');
|
return this.get('timeFormat').replace('(', '').replace(')', '');
|
||||||
}
|
}
|
||||||
});
|
|
||||||
var instance = new UiSettings(ApiData.get('config/ui'));
|
return this.get('timeFormat').replace(/\(\:mm\)/, '');
|
||||||
return instance;
|
}
|
||||||
}).call(this);
|
});
|
||||||
|
|
||||||
|
var instance = new UiSettings(ApiData.get('config/ui'));
|
||||||
|
|
||||||
|
module.exports = instance;
|
@ -1,13 +1,13 @@
|
|||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var vent = require('vent');
|
var vent = require('vent');
|
||||||
|
|
||||||
$(document).ajaxSuccess(function(event, xhr){
|
$(document).ajaxSuccess(function(event, xhr) {
|
||||||
var version = xhr.getResponseHeader('X-ApplicationVersion');
|
var version = xhr.getResponseHeader('X-ApplicationVersion');
|
||||||
if(!version || !window.NzbDrone || !window.NzbDrone.Version) {
|
if (!version || !window.NzbDrone || !window.NzbDrone.Version) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(version !== window.NzbDrone.Version) {
|
if (version !== window.NzbDrone.Version) {
|
||||||
vent.trigger(vent.Events.ServerUpdated);
|
vent.trigger(vent.Events.ServerUpdated);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -1,6 +1,4 @@
|
|||||||
require('backgrid');
|
|
||||||
require('../JsLibraries/backbone.backgrid.selectall');
|
|
||||||
|
|
||||||
var backgrid = require('backgrid');
|
var backgrid = require('backgrid');
|
||||||
require('../JsLibraries/backbone.backgrid.selectall');
|
require('../JsLibraries/backbone.backgrid.selectall');
|
||||||
|
|
||||||
module.exports = backgrid.Extension.SelectRowCell;
|
module.exports = backgrid.Extension.SelectRowCell;
|
@ -1,6 +1,4 @@
|
|||||||
require('backbone');
|
|
||||||
require('../JsLibraries/backbone.collectionview');
|
|
||||||
|
|
||||||
window.Backbone = require('backbone');
|
window.Backbone = require('backbone');
|
||||||
require('../JsLibraries/backbone.collectionview');
|
require('../JsLibraries/backbone.collectionview');
|
||||||
|
|
||||||
module.exports = window.Backbone.CollectionView;
|
module.exports = window.Backbone.CollectionView;
|
@ -1,7 +1,7 @@
|
|||||||
var jquery = require('jquery');
|
var jquery = require('jquery');
|
||||||
|
var Backbone = require('../JsLibraries/backbone');
|
||||||
|
|
||||||
var backbone = require('../JsLibraries/backbone');
|
window.Backbone = Backbone;
|
||||||
window.Backbone = backbone;
|
Backbone.$ = jquery;
|
||||||
backbone.$ = jquery;
|
|
||||||
|
|
||||||
module.exports = backbone;
|
module.exports = Backbone;
|
@ -1,6 +1,7 @@
|
|||||||
require('backbone');
|
require('backbone');
|
||||||
require('../JsLibraries/backbone.validation');
|
require('../JsLibraries/backbone.validation');
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
|
|
||||||
var jqueryValidation = require('../jQuery/jquery.validation');
|
var jqueryValidation = require('../jQuery/jquery.validation');
|
||||||
jqueryValidation.call($);
|
jqueryValidation.call($);
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
require('../JsLibraries/jquery.signalR');
|
|
||||||
require('jquery');
|
|
||||||
|
|
||||||
require('jquery');
|
require('jquery');
|
||||||
var signalR = require('../JsLibraries/jquery.signalR');
|
var signalR = require('../JsLibraries/jquery.signalR');
|
||||||
|
|
||||||
module.exports = signalR;
|
module.exports = signalR;
|
@ -1,7 +1,6 @@
|
|||||||
require('../JsLibraries/messenger');
|
|
||||||
require('jquery');
|
|
||||||
|
|
||||||
require('jquery');
|
require('jquery');
|
||||||
var m = require('../JsLibraries/messenger');
|
var m = require('../JsLibraries/messenger');
|
||||||
window.Messenger.options = {theme : 'flat'};
|
|
||||||
|
window.Messenger.options = { theme : 'flat' };
|
||||||
|
|
||||||
module.exports = window.Messenger;
|
module.exports = window.Messenger;
|
@ -1,6 +1,4 @@
|
|||||||
require('../JsLibraries/moment');
|
|
||||||
require('backbone');
|
|
||||||
|
|
||||||
require('backbone');
|
require('backbone');
|
||||||
var backgrid = require('../JsLibraries/moment');
|
var backgrid = require('../JsLibraries/moment');
|
||||||
|
|
||||||
module.exports = backgrid;
|
module.exports = backgrid;
|
Loading…
Reference in new issue