mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
switch to async item loading, take care stuff is updated subsequently
This commit is contained in:
parent
e6edc3e05d
commit
97b5fe0b1e
2 changed files with 25 additions and 5 deletions
|
|
@ -76,10 +76,22 @@
|
|||
/** @type {string} **/
|
||||
tagName: 'div',
|
||||
|
||||
initialize: function() {
|
||||
var view = this;
|
||||
this.model.on('change', function() {
|
||||
view.render();
|
||||
});
|
||||
|
||||
this.model.on('fetchError', function() {
|
||||
OC.Notification.showTemporary(t('core', 'Share details could not be loaded for this item.'));
|
||||
});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var baseTemplate = this._getTemplate('base', TEMPLATE_BASE);
|
||||
|
||||
this.$el.html(baseTemplate({
|
||||
|
||||
shareLabel: t('core', 'Share'),
|
||||
resharerInfo: this._renderResharerInfo(),
|
||||
sharePlaceholder: this._renderSharePlaceholderPart(),
|
||||
|
|
|
|||
|
|
@ -65,6 +65,14 @@
|
|||
return _.isObject(this.get('reshare')) && !_.isUndefined(this.get('reshare').uid_owner);
|
||||
},
|
||||
|
||||
/**
|
||||
* whether this item has reshare information
|
||||
* @returns {boolean}
|
||||
*/
|
||||
hasShares: function() {
|
||||
return _.isObject(this.get('shares'));
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
|
|
@ -94,16 +102,16 @@
|
|||
},
|
||||
|
||||
fetch: function() {
|
||||
/** var {OC.Share.Types.ShareItemInfo} **/
|
||||
var data = OC.Share.loadItem(this.get('itemType'), this.get('itemSource'));
|
||||
var attributes = this.parse(data);
|
||||
this.set(attributes);
|
||||
console.warn(this.attributes);
|
||||
var model = this;
|
||||
OC.Share.loadItem(this.get('itemType'), this.get('itemSource'), function(data) {
|
||||
model.set(model.parse(data));
|
||||
});
|
||||
},
|
||||
|
||||
parse: function(data) {
|
||||
if(data === false) {
|
||||
console.warn('no data was returned');
|
||||
trigger('fetchError');
|
||||
return {};
|
||||
}
|
||||
var attributes = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue