mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
broken
This commit is contained in:
parent
0916c8b8d1
commit
24c77b4047
29 changed files with 610 additions and 517 deletions
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue