rjs -> webpack

This commit is contained in:
Keivan Beigi
2015-02-02 17:18:45 -08:00
parent 344f3d66ef
commit 428a1439e5
399 changed files with 11591 additions and 16139 deletions
+19 -40
View File
@@ -1,42 +1,21 @@
'use strict';
define(
[
'Cells/NzbDroneCell',
'Commands/CommandController'
], function (NzbDroneCell, CommandController) {
return NzbDroneCell.extend({
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var CommandController = require('../../Commands/CommandController');
className: 'execute-task-cell',
events: {
'click .x-execute' : '_executeTask'
},
render: function () {
this.$el.empty();
var name = this.model.get('name');
var task = this.model.get('taskName');
this.$el.html(
'<i class="icon-refresh icon-can-spin x-execute" title="Execute {0}"></i>'.format(name)
);
CommandController.bindToCommand({
element: this.$el.find('.x-execute'),
command: {
name : task
}
});
return this;
},
_executeTask: function () {
CommandController.Execute(this.model.get('taskName'), {
name : this.model.get('taskName')
});
}
module.exports = NzbDroneCell.extend({
className : 'execute-task-cell',
events : {"click .x-execute" : '_executeTask'},
render : function(){
this.$el.empty();
var name = this.model.get('name');
var task = this.model.get('taskName');
this.$el.html('<i class="icon-refresh icon-can-spin x-execute" title="Execute {0}"></i>'.format(name));
CommandController.bindToCommand({
element : this.$el.find('.x-execute'),
command : {name : task}
});
});
return this;
},
_executeTask : function(){
CommandController.Execute(this.model.get('taskName'), {name : this.model.get('taskName')});
}
});
+29 -44
View File
@@ -1,46 +1,31 @@
'use strict';
define(
[
'Cells/NzbDroneCell',
'moment',
'Shared/UiSettingsModel'
], function (NzbDroneCell, moment, UiSettings) {
return NzbDroneCell.extend({
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var moment = require('moment');
var UiSettings = require('../../Shared/UiSettingsModel');
className: 'next-execution-cell',
render: function () {
this.$el.empty();
var interval = this.model.get('interval');
var nextExecution = moment(this.model.get('nextExecution'));
if (interval === 0 ) {
this.$el.html('-');
}
else if (moment().isAfter(nextExecution)) {
this.$el.html('now');
}
else {
var result = '<span title="{0}">{1}</span>';
var tooltip = nextExecution.format(UiSettings.longDateTime());
var text;
if (UiSettings.get('showRelativeDates')) {
text = nextExecution.fromNow();
}
else {
text = nextExecution.format(UiSettings.shortDateTime());
}
this.$el.html(result.format(tooltip, text));
}
return this;
module.exports = NzbDroneCell.extend({
className : 'next-execution-cell',
render : function(){
this.$el.empty();
var interval = this.model.get('interval');
var nextExecution = moment(this.model.get('nextExecution'));
if(interval === 0) {
this.$el.html('-');
}
else if(moment().isAfter(nextExecution)) {
this.$el.html('now');
}
else {
var result = '<span title="{0}">{1}</span>';
var tooltip = nextExecution.format(UiSettings.longDateTime());
var text;
if(UiSettings.get('showRelativeDates')) {
text = nextExecution.fromNow();
}
});
});
else {
text = nextExecution.format(UiSettings.shortDateTime());
}
this.$el.html(result.format(tooltip, text));
}
return this;
}
});
+12 -18
View File
@@ -1,19 +1,13 @@
'use strict';
define(
[
'backbone.pageable',
'System/Task/TaskModel'
], function (PageableCollection, TaskModel) {
return PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/system/task',
model: TaskModel,
var PageableCollection = require('backbone.pageable');
var TaskModel = require('./TaskModel');
state: {
sortKey : 'name',
order : -1,
pageSize : 100000
},
mode: 'client'
});
});
module.exports = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/system/task',
model : TaskModel,
state : {
sortKey : 'name',
order : -1,
pageSize : 100000
},
mode : 'client'
});
+17 -28
View File
@@ -1,29 +1,18 @@
'use strict';
define(
[
'Cells/NzbDroneCell',
'moment'
], function (NzbDroneCell, moment) {
return NzbDroneCell.extend({
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var moment = require('moment');
className: 'task-interval-cell',
render: function () {
this.$el.empty();
var interval = this.model.get('interval');
var duration = moment.duration(interval, 'minutes').humanize().replace(/an?(?=\s)/, '1');
if (interval === 0 ) {
this.$el.html('disabled');
}
else {
this.$el.html(duration);
}
return this;
}
});
});
module.exports = NzbDroneCell.extend({
className : 'task-interval-cell',
render : function(){
this.$el.empty();
var interval = this.model.get('interval');
var duration = moment.duration(interval, 'minutes').humanize().replace(/an?(?=\s)/, '1');
if(interval === 0) {
this.$el.html('disabled');
}
else {
this.$el.html(duration);
}
return this;
}
});
+55 -82
View File
@@ -1,83 +1,56 @@
'use strict';
define(
[
'marionette',
'backgrid',
'System/Task/TaskCollection',
'Cells/RelativeTimeCell',
'System/Task/TaskIntervalCell',
'System/Task/ExecuteTaskCell',
'System/Task/NextExecutionCell',
'Shared/LoadingView',
'Mixins/backbone.signalr.mixin'
], function (Marionette,
Backgrid,
BackupCollection,
RelativeTimeCell,
TaskIntervalCell,
ExecuteTaskCell,
NextExecutionCell,
LoadingView) {
return Marionette.Layout.extend({
template: 'System/Task/TaskLayoutTemplate',
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var BackupCollection = require('./TaskCollection');
var RelativeTimeCell = require('../../Cells/RelativeTimeCell');
var TaskIntervalCell = require('./TaskIntervalCell');
var ExecuteTaskCell = require('./ExecuteTaskCell');
var NextExecutionCell = require('./NextExecutionCell');
var LoadingView = require('../../Shared/LoadingView');
require('../../Mixins/backbone.signalr.mixin');
regions: {
tasks : '#x-tasks'
},
columns: [
{
name : 'name',
label : 'Name',
sortable : true,
cell : 'string'
},
{
name : 'interval',
label : 'Interval',
sortable : true,
cell : TaskIntervalCell
},
{
name : 'lastExecution',
label : 'Last Execution',
sortable : true,
cell : RelativeTimeCell
},
{
name : 'nextExecution',
label : 'Next Execution',
sortable : true,
cell : NextExecutionCell
},
{
name : 'this',
label : '',
sortable : false,
cell : ExecuteTaskCell
}
],
initialize: function () {
this.taskCollection = new BackupCollection();
this.listenTo(this.taskCollection, 'sync', this._showTasks);
this.taskCollection.bindSignalR();
},
onRender: function () {
this.tasks.show(new LoadingView());
this.taskCollection.fetch();
},
_showTasks: function () {
this.tasks.show(new Backgrid.Grid({
columns : this.columns,
collection: this.taskCollection,
className : 'table table-hover'
}));
}
});
});
module.exports = Marionette.Layout.extend({
template : 'System/Task/TaskLayoutTemplate',
regions : {tasks : '#x-tasks'},
columns : [{
name : 'name',
label : 'Name',
sortable : true,
cell : 'string'
}, {
name : 'interval',
label : 'Interval',
sortable : true,
cell : TaskIntervalCell
}, {
name : 'lastExecution',
label : 'Last Execution',
sortable : true,
cell : RelativeTimeCell
}, {
name : 'nextExecution',
label : 'Next Execution',
sortable : true,
cell : NextExecutionCell
}, {
name : 'this',
label : '',
sortable : false,
cell : ExecuteTaskCell
}],
initialize : function(){
this.taskCollection = new BackupCollection();
this.listenTo(this.taskCollection, 'sync', this._showTasks);
this.taskCollection.bindSignalR();
},
onRender : function(){
this.tasks.show(new LoadingView());
this.taskCollection.fetch();
},
_showTasks : function(){
this.tasks.show(new Backgrid.Grid({
columns : this.columns,
collection : this.taskCollection,
className : 'table table-hover'
}));
}
});
+2 -8
View File
@@ -1,9 +1,3 @@
'use strict';
define(
[
'backbone'
], function (Backbone) {
return Backbone.Model.extend({
var Backbone = require('backbone');
});
});
module.exports = Backbone.Model.extend({});