mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
removed backbone from VS solution,
renamed NzbDrone.Backbone to UI
This commit is contained in:
parent
c7776f74e1
commit
663160c06a
230 changed files with 57 additions and 386 deletions
87
UI/AddSeries/RootFolders/RootFolderView.js
Normal file
87
UI/AddSeries/RootFolders/RootFolderView.js
Normal file
|
@ -0,0 +1,87 @@
|
|||
"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'
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
},
|
||||
|
||||
removeFolder: function () {
|
||||
this.model.destroy({ wait: true });
|
||||
this.model.collection.remove(this.model);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
|
||||
itemView: NzbDrone.AddSeries.RootFolderItemView,
|
||||
|
||||
tagName: 'table',
|
||||
className: 'table table-hover'
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
|
||||
template: 'AddSeries/RootFolders/RootFolderTemplate',
|
||||
route: 'series/add/rootdir',
|
||||
|
||||
ui: {
|
||||
pathInput: '.x-path input'
|
||||
},
|
||||
|
||||
regions: {
|
||||
currentDirs: '#current-dirs'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add': 'addFolder'
|
||||
},
|
||||
|
||||
|
||||
onRender: function () {
|
||||
|
||||
this.collection = rootFolders;
|
||||
this.currentDirs.show(new NzbDrone.AddSeries.RootDirListView({ collection: this.collection }));
|
||||
this.ui.pathInput.autoComplete('/directories');
|
||||
},
|
||||
|
||||
|
||||
addFolder: function () {
|
||||
var newDir = new NzbDrone.AddSeries.RootFolders.RootFolderModel(
|
||||
{
|
||||
Path: this.ui.pathInput.val()
|
||||
});
|
||||
|
||||
var self = this;
|
||||
|
||||
this.collection.create(newDir, {
|
||||
wait: true, success: function () {
|
||||
self.collection.fetch();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
search: function (context) {
|
||||
|
||||
var term = context.ui.seriesSearch.val();
|
||||
|
||||
if (term === "") {
|
||||
context.collection.reset();
|
||||
} else {
|
||||
console.log(term);
|
||||
context.collection.fetch({ data: { term: term } });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue