From e306bf871e1422fbd56c0ba5a4fde291e7eb301b Mon Sep 17 00:00:00 2001 From: Dariusz Szut Date: Wed, 27 Jul 2016 13:59:33 +0200 Subject: [PATCH] EZP-26127: Cannot publish content via content on the fly after select location --- ...reatecontent-universaldiscoveryserviceplugin.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bundle/Resources/public/js/views/plugins/cof-createcontent-universaldiscoveryserviceplugin.js b/bundle/Resources/public/js/views/plugins/cof-createcontent-universaldiscoveryserviceplugin.js index 757c06e..33571cb 100644 --- a/bundle/Resources/public/js/views/plugins/cof-createcontent-universaldiscoveryserviceplugin.js +++ b/bundle/Resources/public/js/views/plugins/cof-createcontent-universaldiscoveryserviceplugin.js @@ -15,6 +15,15 @@ YUI.add('cof-createcontent-universaldiscoveryserviceplugin', function (Y) { Y.cof.Plugin.CreateContentUniversalDiscoveryService = Y.Base.create('CreateContentUniversalDiscoveryServicePlugin', Y.eZ.Plugin.ViewServiceBase, [Y.eZ.Plugin.PublishDraft], { initializer: function () { + /** + * Stores the attributes of saved discovery widget + * + * @property _savedDiscoveryAttributes + * @type {Object} + * @protected + */ + this._savedDiscoveryAttributes = null; + this.onHostEvent('*:openUniversalDiscoveryWidget', this._openUniversalDiscoveryWidget, this); this.onHostEvent('*:prepareContentModel', this._loadContentTypeData, this); this.onHostEvent('*:setParentLocation', this._setParentLocation, this); @@ -104,6 +113,8 @@ YUI.add('cof-createcontent-universaldiscoveryserviceplugin', function (Y) { target.set('displayed', true); + this._savedDiscoveryAttributes = target.get('savedDiscoveryState'); + /** * Fired to restore the universal discovery state. * Listened by cof.Plugin.CreateContentUniversalDiscovery @@ -230,12 +241,13 @@ YUI.add('cof-createcontent-universaldiscoveryserviceplugin', function (Y) { */ _loadContentLocation: function (event) { var udwService = this.get('host'), + udwParameters = udwService.get('parameters') ? udwService.get('parameters') : this._savedDiscoveryAttributes, selection = { contentType: udwService.get('contentType'), }, mainLocation = new Y.eZ.Location(); - if ( udwService.get('parameters').loadContent ) { + if ( udwParameters.loadContent ) { selection.content = event.content; }