mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
Moved source code under src folder - massive change
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'AddSeries/RootFolders/Model',
|
||||
'Mixins/backbone.signalr.mixin'
|
||||
], function (Backbone, RootFolderModel) {
|
||||
|
||||
var RootFolderCollection = Backbone.Collection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/rootfolder',
|
||||
model: RootFolderModel
|
||||
});
|
||||
|
||||
//var collection = new RootFolderCollection().bindSignalR();
|
||||
|
||||
return new RootFolderCollection();
|
||||
});
|
||||
@@ -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'
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
], function (Marionette) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
|
||||
template: 'AddSeries/RootFolders/ItemViewTemplate',
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
<td class="span10 x-folder folder-path">
|
||||
{{path}}
|
||||
</td>
|
||||
<td class="span3 x-folder folder-free-space">
|
||||
<span>{{Bytes freeSpace}}</span>
|
||||
</td>
|
||||
<td class="span1 nz-row-action">
|
||||
<div class="btn btn-small btn-icon-only icon-nd-delete x-delete">
|
||||
</div>
|
||||
</td>
|
||||
@@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'AddSeries/RootFolders/CollectionView',
|
||||
'AddSeries/RootFolders/Collection',
|
||||
'AddSeries/RootFolders/Model',
|
||||
'Shared/LoadingView',
|
||||
'Mixins/AsValidatedView',
|
||||
'Mixins/AutoComplete'
|
||||
], function (Marionette, RootFolderCollectionView, RootFolderCollection, RootFolderModel, LoadingView, AsValidatedView) {
|
||||
|
||||
var layout = 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.listenTo(this.rootfolderListView, 'itemview:folderSelected', this._onFolderSelected);
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
var self = this;
|
||||
this.currentDirs.show(new LoadingView());
|
||||
|
||||
RootFolderCollection.promise.done(function () {
|
||||
self.currentDirs.show(self.rootfolderListView);
|
||||
});
|
||||
|
||||
this.ui.pathInput.autoComplete('/directories');
|
||||
},
|
||||
|
||||
_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});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return AsValidatedView.apply(layout);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Select Folder</h3>
|
||||
</div>
|
||||
<div class="modal-body root-folders-modal">
|
||||
<div class="validation-errors"></div>
|
||||
<div class="input-prepend input-append x-path control-group">
|
||||
<span class="add-on"> <i class="icon-folder-open"></i></span>
|
||||
<input class="span9" type="text" validation-name="path" placeholder="Enter path to folder that contains your shows">
|
||||
<button class="btn btn-success x-add">
|
||||
<i class="icon-ok"/>
|
||||
</button>
|
||||
</div>
|
||||
{{#if items}}
|
||||
<h4>Recent Folders</h4>
|
||||
{{/if}}
|
||||
<div id="current-dirs" class="root-folders-list"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">close</button>
|
||||
</div>
|
||||
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone'
|
||||
], function (Backbone) {
|
||||
return Backbone.Model.extend({
|
||||
urlRoot : window.NzbDrone.ApiRoot + '/rootfolder',
|
||||
defaults: {
|
||||
freeSpace: 0
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
<div>
|
||||
<select class="span4 x-root-folder" validation-name="RootFolderPath">
|
||||
{{#if this}}
|
||||
{{#each this}}
|
||||
<option value="{{id}}">{{path}}</option>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<option value="">Select Path</option>
|
||||
{{/if}}
|
||||
<option value="addNew">Add a different path</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<select class="span2 x-starting-season">
|
||||
{{#each this}}
|
||||
{{#if_eq seasonNumber compare="0"}}
|
||||
<option value="{{seasonNumber}}">Specials</option>
|
||||
{{else}}
|
||||
<option value="{{seasonNumber}}">Season {{seasonNumber}}</option>
|
||||
{{/if_eq}}
|
||||
{{/each}}
|
||||
</select>
|
||||
Reference in New Issue
Block a user