diff options
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/sharedialogview.js | 12 | ||||
-rw-r--r-- | core/js/shareitemmodel.js | 18 |
2 files changed, 25 insertions, 5 deletions
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 38b98a218aa..3c12bedca86 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -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(), diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 74e696e7200..fe7aed46509 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -66,6 +66,14 @@ }, /** + * whether this item has reshare information + * @returns {boolean} + */ + hasShares: function() { + return _.isObject(this.get('shares')); + }, + + /** * @returns {string} */ getReshareOwner: function() { @@ -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 = { |