diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-29 13:18:04 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-29 13:18:04 +0200 |
commit | 3cd82b8918bc59cf37a447b7c24065f0a5b691f4 (patch) | |
tree | 9933e151f8720af206a3aa8541f3904ef075289c /core | |
parent | f2cd334c8a9c3d21772c5f30a92d95e254e113d8 (diff) | |
parent | a823a79f12dde467a48b0366821a505ed66ecd66 (diff) | |
download | nextcloud-server-3cd82b8918bc59cf37a447b7c24065f0a5b691f4.tar.gz nextcloud-server-3cd82b8918bc59cf37a447b7c24065f0a5b691f4.zip |
Merge pull request #19411 from owncloud/files-sidebar-shareloadspinner
Show loading spinner for first fetch of shares
Diffstat (limited to 'core')
-rw-r--r-- | core/js/sharedialogview.js | 31 | ||||
-rw-r--r-- | core/js/shareitemmodel.js | 2 |
2 files changed, 28 insertions, 5 deletions
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 57743118f28..ee31ed33132 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -14,7 +14,7 @@ } var TEMPLATE_BASE = - '<div class="resharerInfoView"></div>' + + '<div class="resharerInfoView subView"></div>' + '{{#if isSharingAllowed}}' + '<label for="shareWith" class="hidden-visually">{{shareLabel}}</label>' + '<div class="oneline">' + @@ -23,10 +23,10 @@ '{{{remoteShareInfo}}}' + '</div>' + '{{/if}}' + - '<div class="shareeListView"></div>' + - '<div class="linkShareView"></div>' + - '<div class="expirationView"></div>' - ; + '<div class="shareeListView subView"></div>' + + '<div class="linkShareView subView"></div>' + + '<div class="expirationView subView"></div>' + + '<div class="loading hidden" style="height: 50px"></div>'; var TEMPLATE_REMOTE_SHARE_INFO = '<a target="_blank" class="icon-info svg shareWithRemoteInfo hasTooltip" href="{{docLink}}" ' + @@ -87,6 +87,9 @@ view.render(); }); + this.model.on('request', this._onRequest, this); + this.model.on('sync', this._onEndRequest, this); + var subViewOptions = { model: this.model, configModel: this.configModel @@ -161,6 +164,24 @@ this.model.addShare(s.item.value); }, + _toggleLoading: function(state) { + this._loading = state; + this.$el.find('.subView').toggleClass('hidden', state); + this.$el.find('.loading').toggleClass('hidden', !state); + }, + + _onRequest: function() { + // only show the loading spinner for the first request (for now) + if (!this._loadingOnce) { + this._toggleLoading(true); + this._loadingOnce = true; + } + }, + + _onEndRequest: function() { + this._toggleLoading(false); + }, + render: function() { var baseTemplate = this._getTemplate('base', TEMPLATE_BASE); diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 13396670aae..328d291b778 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -624,7 +624,9 @@ fetch: function() { var model = this; + this.trigger('request', this); OC.Share.loadItem(this.get('itemType'), this.get('itemSource'), function(data) { + model.trigger('sync', 'GET', this); model.set(model.parse(data)); }); }, |