mirror of
https://github.com/nextcloud/server.git
synced 2024-08-14 14:10:40 +02:00
Show loading spinner for first fetch of shares
Whenever the sidebar first loads shares, show a spinner instead of an empty content
This commit is contained in:
parent
d68079f932
commit
a823a79f12
@ -14,7 +14,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var TEMPLATE_BASE =
|
var TEMPLATE_BASE =
|
||||||
'<div class="resharerInfoView"></div>' +
|
'<div class="resharerInfoView subView"></div>' +
|
||||||
'{{#if isSharingAllowed}}' +
|
'{{#if isSharingAllowed}}' +
|
||||||
'<label for="shareWith" class="hidden-visually">{{shareLabel}}</label>' +
|
'<label for="shareWith" class="hidden-visually">{{shareLabel}}</label>' +
|
||||||
'<div class="oneline">' +
|
'<div class="oneline">' +
|
||||||
@ -23,10 +23,10 @@
|
|||||||
'{{{remoteShareInfo}}}' +
|
'{{{remoteShareInfo}}}' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'{{/if}}' +
|
'{{/if}}' +
|
||||||
'<div class="shareeListView"></div>' +
|
'<div class="shareeListView subView"></div>' +
|
||||||
'<div class="linkShareView"></div>' +
|
'<div class="linkShareView subView"></div>' +
|
||||||
'<div class="expirationView"></div>'
|
'<div class="expirationView subView"></div>' +
|
||||||
;
|
'<div class="loading hidden" style="height: 50px"></div>';
|
||||||
|
|
||||||
var TEMPLATE_REMOTE_SHARE_INFO =
|
var TEMPLATE_REMOTE_SHARE_INFO =
|
||||||
'<a target="_blank" class="icon-info svg shareWithRemoteInfo hasTooltip" href="{{docLink}}" ' +
|
'<a target="_blank" class="icon-info svg shareWithRemoteInfo hasTooltip" href="{{docLink}}" ' +
|
||||||
@ -87,6 +87,9 @@
|
|||||||
view.render();
|
view.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.model.on('request', this._onRequest, this);
|
||||||
|
this.model.on('sync', this._onEndRequest, this);
|
||||||
|
|
||||||
var subViewOptions = {
|
var subViewOptions = {
|
||||||
model: this.model,
|
model: this.model,
|
||||||
configModel: this.configModel
|
configModel: this.configModel
|
||||||
@ -161,6 +164,24 @@
|
|||||||
this.model.addShare(s.item.value);
|
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() {
|
render: function() {
|
||||||
var baseTemplate = this._getTemplate('base', TEMPLATE_BASE);
|
var baseTemplate = this._getTemplate('base', TEMPLATE_BASE);
|
||||||
|
|
||||||
|
@ -624,7 +624,9 @@
|
|||||||
|
|
||||||
fetch: function() {
|
fetch: function() {
|
||||||
var model = this;
|
var model = this;
|
||||||
|
this.trigger('request', this);
|
||||||
OC.Share.loadItem(this.get('itemType'), this.get('itemSource'), function(data) {
|
OC.Share.loadItem(this.get('itemType'), this.get('itemSource'), function(data) {
|
||||||
|
model.trigger('sync', 'GET', this);
|
||||||
model.set(model.parse(data));
|
model.set(model.parse(data));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user