Cleanup file browser, added loading indicator

This commit is contained in:
Mark McDowall 2014-12-20 21:54:29 -08:00
parent 7a21f8b151
commit 7f91e0284f
3 changed files with 9 additions and 7 deletions

View File

@ -42,7 +42,7 @@ define(
this._showCurrentDirs(); this._showCurrentDirs();
} }
this.ui.pathInput.fileBrowser({ showFiles: true, showLastModified: true }); this.ui.pathInput.fileBrowser();
}, },
_onFolderSelected: function (options) { _onFolderSelected: function (options) {

View File

@ -39,7 +39,7 @@ define([
this.ui.modalBody.addClass('modal-overflow'); this.ui.modalBody.addClass('modal-overflow');
} }
this.ui.path.fileBrowser({ showFiles: true }); this.ui.path.fileBrowser();
}, },
_onAfterSave: function () { _onAfterSave: function () {

View File

@ -35,7 +35,8 @@ define(
}, },
ui: { ui: {
path: '.x-path' path : '.x-path',
indicator : '.x-indicator'
}, },
events: { events: {
@ -53,17 +54,15 @@ define(
this.input = options.input; this.input = options.input;
this._setColumns(); this._setColumns();
this._fetchCollection(this.input.val());
this.listenTo(this.collection, 'sync', this._showGrid); this.listenTo(this.collection, 'sync', this._showGrid);
this.listenTo(this.collection, 'filebrowser:folderselected', this._rowSelected); this.listenTo(this.collection, 'filebrowser:folderselected', this._rowSelected);
}, },
onRender: function () { onRender: function () {
this.browser.show(new LoadingView()); this.browser.show(new LoadingView());
},
onShow: function () {
this.ui.path.directoryAutoComplete(); this.ui.path.directoryAutoComplete();
this._fetchCollection(this.input.val());
this._updatePath(this.input.val()); this._updatePath(this.input.val());
}, },
@ -103,6 +102,8 @@ define(
}, },
_fetchCollection: function (path) { _fetchCollection: function (path) {
this.ui.indicator.show();
var data = { var data = {
includeFiles : this.collection.showFiles includeFiles : this.collection.showFiles
}; };
@ -117,6 +118,7 @@ define(
}, },
_showGrid: function () { _showGrid: function () {
this.ui.indicator.hide();
if (this.collection.models.length === 0) { if (this.collection.models.length === 0) {
this.browser.show(new EmptyView()); this.browser.show(new EmptyView());