mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
rjs -> webpack
This commit is contained in:
@@ -1,17 +1,11 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'AddSeries/RootFolders/RootFolderModel',
|
||||
'Mixins/backbone.signalr.mixin'
|
||||
], function (Backbone, RootFolderModel) {
|
||||
var Backbone = require('backbone');
|
||||
var RootFolderModel = require('./RootFolderModel');
|
||||
require('../../Mixins/backbone.signalr.mixin');
|
||||
|
||||
var RootFolderCollection = Backbone.Collection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/rootfolder',
|
||||
model: RootFolderModel
|
||||
});
|
||||
|
||||
//var collection = new RootFolderCollection().bindSignalR();
|
||||
|
||||
return new RootFolderCollection();
|
||||
module.exports = (function(){
|
||||
var RootFolderCollection = Backbone.Collection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/rootfolder',
|
||||
model : RootFolderModel
|
||||
});
|
||||
return new RootFolderCollection();
|
||||
}).call(this);
|
||||
@@ -1,15 +1,8 @@
|
||||
'use strict';
|
||||
var Marionette = require('marionette');
|
||||
var RootFolderItemView = require('./RootFolderItemView');
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'AddSeries/RootFolders/RootFolderItemView'
|
||||
], function (Marionette, RootFolderItemView) {
|
||||
|
||||
|
||||
return Marionette.CompositeView.extend({
|
||||
template : 'AddSeries/RootFolders/RootFolderCollectionViewTemplate',
|
||||
itemViewContainer : '.x-root-folders',
|
||||
itemView : RootFolderItemView
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.CompositeView.extend({
|
||||
template : 'AddSeries/RootFolders/RootFolderCollectionViewTemplate',
|
||||
itemViewContainer : '.x-root-folders',
|
||||
itemView : RootFolderItemView
|
||||
});
|
||||
@@ -1,37 +1,22 @@
|
||||
'use strict';
|
||||
var Marionette = require('marionette');
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
], function (Marionette) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
|
||||
template: 'AddSeries/RootFolders/RootFolderItemViewTemplate',
|
||||
tagName : 'tr',
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
},
|
||||
|
||||
|
||||
events: {
|
||||
'click .x-delete': 'removeFolder',
|
||||
'click .x-folder': 'folderSelected'
|
||||
},
|
||||
|
||||
removeFolder: function () {
|
||||
|
||||
var self = this;
|
||||
|
||||
this.model.destroy()
|
||||
.success(function(){
|
||||
self.close();
|
||||
});
|
||||
},
|
||||
|
||||
folderSelected: function () {
|
||||
this.trigger('folderSelected', this.model);
|
||||
}
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'AddSeries/RootFolders/RootFolderItemViewTemplate',
|
||||
tagName : 'tr',
|
||||
initialize : function(){
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
},
|
||||
events : {
|
||||
'click .x-delete' : 'removeFolder',
|
||||
'click .x-folder' : 'folderSelected'
|
||||
},
|
||||
removeFolder : function(){
|
||||
var self = this;
|
||||
this.model.destroy().success(function(){
|
||||
self.close();
|
||||
});
|
||||
});
|
||||
},
|
||||
folderSelected : function(){
|
||||
this.trigger('folderSelected', this.model);
|
||||
}
|
||||
});
|
||||
@@ -1,81 +1,54 @@
|
||||
'use strict';
|
||||
var Marionette = require('marionette');
|
||||
var RootFolderCollectionView = require('./RootFolderCollectionView');
|
||||
var RootFolderCollection = require('./RootFolderCollection');
|
||||
var RootFolderModel = require('./RootFolderModel');
|
||||
var LoadingView = require('../../Shared/LoadingView');
|
||||
var AsValidatedView = require('../../Mixins/AsValidatedView');
|
||||
require('../../Mixins/FileBrowser');
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'AddSeries/RootFolders/RootFolderCollectionView',
|
||||
'AddSeries/RootFolders/RootFolderCollection',
|
||||
'AddSeries/RootFolders/RootFolderModel',
|
||||
'Shared/LoadingView',
|
||||
'Mixins/AsValidatedView',
|
||||
'Mixins/FileBrowser'
|
||||
], function (Marionette, RootFolderCollectionView, RootFolderCollection, RootFolderModel, LoadingView, AsValidatedView) {
|
||||
|
||||
var layout = Marionette.Layout.extend({
|
||||
template: 'AddSeries/RootFolders/RootFolderLayoutTemplate',
|
||||
|
||||
ui: {
|
||||
pathInput: '.x-path'
|
||||
},
|
||||
|
||||
regions: {
|
||||
currentDirs: '#current-dirs'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add': '_addFolder',
|
||||
'keydown .x-path input': '_keydown'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.collection = RootFolderCollection;
|
||||
this.rootfolderListView = new RootFolderCollectionView({ collection: RootFolderCollection });
|
||||
|
||||
this.listenTo(this.rootfolderListView, 'itemview:folderSelected', this._onFolderSelected);
|
||||
this.listenTo(RootFolderCollection, 'sync', this._showCurrentDirs);
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.currentDirs.show(new LoadingView());
|
||||
|
||||
if (RootFolderCollection.synced) {
|
||||
this._showCurrentDirs();
|
||||
}
|
||||
|
||||
this.ui.pathInput.fileBrowser();
|
||||
},
|
||||
|
||||
_onFolderSelected: function (options) {
|
||||
this.trigger('folderSelected', options);
|
||||
},
|
||||
|
||||
_addFolder: function () {
|
||||
var self = this;
|
||||
|
||||
var newDir = new RootFolderModel({
|
||||
Path: this.ui.pathInput.val()
|
||||
});
|
||||
|
||||
this.bindToModelValidation(newDir);
|
||||
|
||||
newDir.save().done(function () {
|
||||
RootFolderCollection.add(newDir);
|
||||
self.trigger('folderSelected', {model: newDir});
|
||||
});
|
||||
},
|
||||
|
||||
_showCurrentDirs: function () {
|
||||
this.currentDirs.show(this.rootfolderListView);
|
||||
},
|
||||
|
||||
_keydown: function (e) {
|
||||
if (e.keyCode !== 13) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._addFolder();
|
||||
module.exports = (function(){
|
||||
var layout = Marionette.Layout.extend({
|
||||
template : 'AddSeries/RootFolders/RootFolderLayoutTemplate',
|
||||
ui : {pathInput : '.x-path'},
|
||||
regions : {currentDirs : '#current-dirs'},
|
||||
events : {
|
||||
'click .x-add' : '_addFolder',
|
||||
'keydown .x-path input' : '_keydown'
|
||||
},
|
||||
initialize : function(){
|
||||
this.collection = RootFolderCollection;
|
||||
this.rootfolderListView = new RootFolderCollectionView({collection : RootFolderCollection});
|
||||
this.listenTo(this.rootfolderListView, 'itemview:folderSelected', this._onFolderSelected);
|
||||
this.listenTo(RootFolderCollection, 'sync', this._showCurrentDirs);
|
||||
},
|
||||
onRender : function(){
|
||||
this.currentDirs.show(new LoadingView());
|
||||
if(RootFolderCollection.synced) {
|
||||
this._showCurrentDirs();
|
||||
}
|
||||
});
|
||||
|
||||
return AsValidatedView.apply(layout);
|
||||
this.ui.pathInput.fileBrowser();
|
||||
},
|
||||
_onFolderSelected : function(options){
|
||||
this.trigger('folderSelected', options);
|
||||
},
|
||||
_addFolder : function(){
|
||||
var self = this;
|
||||
var newDir = new RootFolderModel({Path : this.ui.pathInput.val()});
|
||||
this.bindToModelValidation(newDir);
|
||||
newDir.save().done(function(){
|
||||
RootFolderCollection.add(newDir);
|
||||
self.trigger('folderSelected', {model : newDir});
|
||||
});
|
||||
},
|
||||
_showCurrentDirs : function(){
|
||||
this.currentDirs.show(this.rootfolderListView);
|
||||
},
|
||||
_keydown : function(e){
|
||||
if(e.keyCode !== 13) {
|
||||
return;
|
||||
}
|
||||
this._addFolder();
|
||||
}
|
||||
});
|
||||
return AsValidatedView.apply(layout);
|
||||
}).call(this);
|
||||
@@ -1,12 +1,6 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone'
|
||||
], function (Backbone) {
|
||||
return Backbone.Model.extend({
|
||||
urlRoot : window.NzbDrone.ApiRoot + '/rootfolder',
|
||||
defaults: {
|
||||
freeSpace: 0
|
||||
}
|
||||
});
|
||||
});
|
||||
var Backbone = require('backbone');
|
||||
|
||||
module.exports = Backbone.Model.extend({
|
||||
urlRoot : window.NzbDrone.ApiRoot + '/rootfolder',
|
||||
defaults : {freeSpace : 0}
|
||||
});
|
||||
Reference in New Issue
Block a user