mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
broken
This commit is contained in:
parent
0916c8b8d1
commit
24c77b4047
29 changed files with 610 additions and 517 deletions
15
UI/AddSeries/RootFolders/Collection.js
Normal file
15
UI/AddSeries/RootFolders/Collection.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'AddSeries/RootFolders/Model',
|
||||
'mixins/backbone.signalr.mixin'
|
||||
], function () {
|
||||
|
||||
var rootFolderCollection = Backbone.Collection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/rootfolder',
|
||||
model: NzbDrone.AddSeries.RootFolders.RootFolderModel
|
||||
});
|
||||
|
||||
return new rootFolderCollection().BindSignalR();
|
||||
});
|
16
UI/AddSeries/RootFolders/CollectionView.js
Normal file
16
UI/AddSeries/RootFolders/CollectionView.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'AddSeries/RootFolders/ItemView'
|
||||
], function (Marionette, RootFolderItemView) {
|
||||
|
||||
|
||||
return Marionette.CollectionView.extend({
|
||||
itemView: RootFolderItemView,
|
||||
|
||||
tagName : 'table',
|
||||
className: 'table table-hover'
|
||||
});
|
||||
});
|
27
UI/AddSeries/RootFolders/ItemView.js
Normal file
27
UI/AddSeries/RootFolders/ItemView.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
], function (Marionette) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
|
||||
template: 'AddSeries/RootFolders/RootFolderItemTemplate',
|
||||
tagName : 'tr',
|
||||
|
||||
events: {
|
||||
'click .x-remove': 'removeFolder',
|
||||
'click .x-folder': 'folderSelected'
|
||||
},
|
||||
|
||||
removeFolder: function () {
|
||||
this.model.destroy({ wait: true });
|
||||
this.model.collection.remove(this.model);
|
||||
},
|
||||
|
||||
folderSelected: function () {
|
||||
this.trigger('folderSelected', this.model);
|
||||
}
|
||||
});
|
||||
});
|
57
UI/AddSeries/RootFolders/Layout.js
Normal file
57
UI/AddSeries/RootFolders/Layout.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
"use strict";
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'AddSeries/RootFolders/CollectionView',
|
||||
'AddSeries/RootFolders/Model',
|
||||
'AddSeries/RootFolders/Collection',
|
||||
'Mixins/AutoComplete'
|
||||
], function (Marionette, RootFolderCollectionView, RootFolderCollection, RootFolderModel) {
|
||||
|
||||
return Marionette.Layout.extend({
|
||||
template: 'AddSeries/RootFolders/LayoutTemplate',
|
||||
|
||||
ui: {
|
||||
pathInput: '.x-path input'
|
||||
},
|
||||
|
||||
regions: {
|
||||
currentDirs: '#current-dirs'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add': 'addFolder'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.collection = RootFolderCollection;
|
||||
this.rootfolderListView = new RootFolderCollectionView({ collection: RootFolderCollection });
|
||||
this.rootfolderListView.on('itemview:folderSelected', this._onFolderSelected, this);
|
||||
},
|
||||
|
||||
|
||||
onRender: function () {
|
||||
|
||||
this.currentDirs.show(this.rootfolderListView);
|
||||
this.ui.pathInput.autoComplete('/directories');
|
||||
},
|
||||
|
||||
_onFolderSelected: function (options) {
|
||||
this.trigger('folderSelected', options);
|
||||
},
|
||||
|
||||
addFolder: function () {
|
||||
var newDir = new RootFolderModel({
|
||||
Path: this.ui.pathInput.val()
|
||||
});
|
||||
|
||||
RootFolderCollection.create(newDir, {
|
||||
wait: true, success: function () {
|
||||
RootFolderCollection.fetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -11,4 +11,4 @@ define(['app'], function () {
|
|||
freeSpace: 0
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,10 +0,0 @@
|
|||
"use strict";
|
||||
define(['app', 'AddSeries/RootFolders/RootFolderModel','mixins/backbone.signalr.mixin'], function () {
|
||||
|
||||
var rootFolderCollection = Backbone.Collection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/rootfolder',
|
||||
model: NzbDrone.AddSeries.RootFolders.RootFolderModel
|
||||
});
|
||||
|
||||
return new rootFolderCollection().BindSignalR();
|
||||
});
|
|
@ -1,11 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
define(['app', 'AddSeries/RootFolders/RootFolderCollection','handlebars'], function (app, rootFolders, Handlebars) {
|
||||
define(
|
||||
[
|
||||
'AddSeries/RootFolders/Collection',
|
||||
'handlebars'
|
||||
], function (rootFolders, Handlebars) {
|
||||
|
||||
Handlebars.registerHelper('rootFolderSelection', function () {
|
||||
//TODO: We should be able to pass in the context, either an object or a property
|
||||
|
||||
var templateFunction = Marionette.TemplateCache.get('AddSeries/RootFolders/RootFolderSelectionTemplate');
|
||||
return new Handlebars.SafeString(templateFunction(rootFolders.toJSON()));
|
||||
Handlebars.registerHelper('rootFolderSelection', function () {
|
||||
var templateFunction = Marionette.TemplateCache.get('AddSeries/RootFolders/RootFolderSelectionTemplate');
|
||||
return new Handlebars.SafeString(templateFunction(rootFolders.toJSON()));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplete'], function (app, rootFolders) {
|
||||
|
||||
NzbDrone.AddSeries.RootFolderItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
||||
template: 'AddSeries/RootFolders/RootFolderItemTemplate',
|
||||
tagName : 'tr',
|
||||
|
||||
events: {
|
||||
'click .x-remove': 'removeFolder',
|
||||
'click .x-folder': 'folderSelected'
|
||||
},
|
||||
|
||||
removeFolder: function () {
|
||||
this.model.destroy({ wait: true });
|
||||
this.model.collection.remove(this.model);
|
||||
},
|
||||
|
||||
folderSelected: function () {
|
||||
this.trigger('folderSelected', this.model);
|
||||
}
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
|
||||
itemView: NzbDrone.AddSeries.RootFolderItemView,
|
||||
|
||||
tagName : 'table',
|
||||
className: 'table table-hover'
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.RootFolders.Layout = Backbone.Marionette.Layout.extend({
|
||||
template: 'AddSeries/RootFolders/LayoutTemplate',
|
||||
|
||||
ui: {
|
||||
pathInput: '.x-path input'
|
||||
},
|
||||
|
||||
regions: {
|
||||
currentDirs: '#current-dirs'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add': 'addFolder'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.collection = rootFolders;
|
||||
this.rootfolderListView = new NzbDrone.AddSeries.RootDirListView({ collection: rootFolders });
|
||||
this.rootfolderListView.on('itemview:folderSelected', this._onFolderSelected, this);
|
||||
},
|
||||
|
||||
|
||||
onRender: function () {
|
||||
|
||||
this.currentDirs.show(this.rootfolderListView);
|
||||
this.ui.pathInput.autoComplete('/directories');
|
||||
},
|
||||
|
||||
_onFolderSelected: function (options) {
|
||||
this.trigger('folderSelected', options);
|
||||
},
|
||||
|
||||
addFolder: function () {
|
||||
var newDir = new NzbDrone.AddSeries.RootFolders.RootFolderModel(
|
||||
{
|
||||
Path: this.ui.pathInput.val()
|
||||
});
|
||||
|
||||
|
||||
rootFolders.create(newDir, {
|
||||
wait: true, success: function () {
|
||||
rootFolders.fetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue