Fixed selecting a new folder on add new series.

This commit is contained in:
Keivan Beigi 2013-07-11 14:28:57 -07:00
commit f3194279e4
7 changed files with 60 additions and 15 deletions

View file

@ -10,6 +10,11 @@ define(
template: 'AddSeries/RootFolders/ItemViewTemplate',
tagName : 'tr',
initialize: function () {
this.listenTo(this.model, 'change', this.render);
},
events: {
'click .x-delete': 'removeFolder',
'click .x-folder': 'folderSelected'

View file

@ -5,6 +5,6 @@
<span>{{Bytes freeSpace}}</span>
</td>
<td class="span1 nz-row-action">
<div class="btn btn-small btn-icon-only btn-danger icon-minus x-delete">
<div class="btn btn-small btn-icon-only icon-nd-delete x-delete">
</div>
</td>

View file

@ -27,7 +27,8 @@ define(
initialize: function () {
this.collection = RootFolderCollection;
this.rootfolderListView = new RootFolderCollectionView({ collection: RootFolderCollection });
this.rootfolderListView.on('itemview:folderSelected', this._onFolderSelected, this);
this.listenTo(this.rootfolderListView, 'itemview:folderSelected', this._onFolderSelected);
},
onRender: function () {
@ -41,14 +42,17 @@ define(
},
_addFolder: function () {
var self = this;
var newDir = new RootFolderModel({
Path: this.ui.pathInput.val()
});
RootFolderCollection.create(newDir, {
wait: true, success: function () {
RootFolderCollection.fetch();
}
RootFolderCollection.add(newDir);
newDir.save().done(function () {
self.trigger('folderSelected', {model: newDir});
});
}
});

View file

@ -1,13 +1,16 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<i class="icon-hdd"/>
<h3>Select Folder</h3>
</div>
<div class="modal-body root-folders-modal">
<div class="input-prepend input-append x-path">
<span class="add-on">&nbsp;<i class="icon-folder-open"></i></span>
<input class="span5" type="text" placeholder="Path of the folder to add ...">
<button class="btn btn-success x-add"><i class="icon-plus"/></button>
<input class="span9" type="text" placeholder="Start Typing Folder Path...">
<button class="btn btn-success x-add"><i class="icon-ok"/></button>
</div>
{{#if items}}
<h4>Recent Folders</h4>
{{/if}}
<div id="current-dirs"/>
</div>
<div class="modal-footer">

View file

@ -1,6 +1,10 @@
<select class="span6 x-root-folder">
{{#if this}}
{{#each this}}
<option value="{{id}}">{{path}}</option>
<option value="{{id}}">{{path}}</option>
{{/each}}
{{else}}
<option value="">Select Path</option>
{{/if}}
<option value="addNew">Add a different path</option>
</select>