summaryrefslogtreecommitdiffstats
path: root/core/js/sharedialogview.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-09-28 15:57:57 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-28 15:57:57 +0200
commita823a79f12dde467a48b0366821a505ed66ecd66 (patch)
tree55e01ccea6551b6abad2867363ce6a512239fae8 /core/js/sharedialogview.js
parentd68079f93210f8fe0b5327e686497db97fde6a3e (diff)
downloadnextcloud-server-a823a79f12dde467a48b0366821a505ed66ecd66.tar.gz
nextcloud-server-a823a79f12dde467a48b0366821a505ed66ecd66.zip
Show loading spinner for first fetch of shares
Whenever the sidebar first loads shares, show a spinner instead of an empty content
Diffstat (limited to 'core/js/sharedialogview.js')
-rw-r--r--core/js/sharedialogview.js31
1 files changed, 26 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);