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