From 7011f60e7586780abf4cf3b4eedd47749cfc2a46 Mon Sep 17 00:00:00 2001 From: Dariusz Szut Date: Wed, 27 Sep 2017 13:58:07 +0200 Subject: [PATCH] EZEE-1744: Cannot save Landing Page with empty Description field --- .../js/views/actions/ezs-basicsgroupactionview.js | 12 +++++++++++- .../public/js/views/ezs-landingpagebasicsview.js | 13 ++++++++++++- .../public/js/views/ezs-landingpagecreatorview.js | 10 ++++++++++ .../public/js/views/ezs-landingpagetoolbarview.js | 11 ++++++++++- .../views/forms/ezs-landingpageconfigpopupformview.js | 11 ++++++++++- .../ezs-dynamiclandingpagecreatorviewservice.js | 19 +++++++++++++++++++ .../ezs-dynamiclandingpageeditorviewservice.js | 1 + 7 files changed, 73 insertions(+), 4 deletions(-) diff --git a/Resources/public/js/views/actions/ezs-basicsgroupactionview.js b/Resources/public/js/views/actions/ezs-basicsgroupactionview.js index 59bc177..82cabd6 100644 --- a/Resources/public/js/views/actions/ezs-basicsgroupactionview.js +++ b/Resources/public/js/views/actions/ezs-basicsgroupactionview.js @@ -128,7 +128,9 @@ YUI.add('ezs-basicsgroupactionview', function (Y) { return view; } - viewInstance = new Y.eZS.LandingPageBasicsView(); + viewInstance = new Y.eZS.LandingPageBasicsView({ + isDescriptionRequired: this.get('isDescriptionRequired') + }); // Sets the value of the attribute without firing the change event. // It's needed to avoid creation of new model list instances. @@ -149,6 +151,14 @@ YUI.add('ezs-basicsgroupactionview', function (Y) { basicsView: { getter: '_getBasicView' }, + + /** + * The indicator whether the 'description' in landing page is required + * + * @attribute isDescriptionRequired + * @type Boolean + */ + isDescriptionRequired: {}, } }); }); diff --git a/Resources/public/js/views/ezs-landingpagebasicsview.js b/Resources/public/js/views/ezs-landingpagebasicsview.js index 5f6b2b0..b991d1d 100644 --- a/Resources/public/js/views/ezs-landingpagebasicsview.js +++ b/Resources/public/js/views/ezs-landingpagebasicsview.js @@ -281,7 +281,7 @@ YUI.add('ezs-landingpagebasicsview', function (Y) { name: Y.eZ.trans('page.description', {}, 'landingpagebasics'), type: 'text', charsLimited: true, - required: true, + required: this.get('isDescriptionRequired'), prefix: this._yuid }); } @@ -383,6 +383,17 @@ YUI.add('ezs-landingpagebasicsview', function (Y) { * @type Object */ selectedLayoutData: {}, + + /** + * The indicator whether the 'description' in landing page is required + * + * @attribute isDescriptionRequired + * @type Boolean + * @default true + */ + isDescriptionRequired: { + value: true + }, } }); }); diff --git a/Resources/public/js/views/ezs-landingpagecreatorview.js b/Resources/public/js/views/ezs-landingpagecreatorview.js index ba48072..c224e98 100644 --- a/Resources/public/js/views/ezs-landingpagecreatorview.js +++ b/Resources/public/js/views/ezs-landingpagecreatorview.js @@ -975,6 +975,7 @@ YUI.add('ezs-landingpagecreatorview', function (Y) { valueFn: function () { return new Y.eZS.LandingPageConfigPopupFormView({ urlPrefix: this.get('parentLocationPath'), + isDescriptionRequired: this.get('isDescriptionRequired'), bubbleTargets: this }); } @@ -1078,10 +1079,19 @@ YUI.add('ezs-landingpagecreatorview', function (Y) { valueFn: function () { return new Y.eZS.LandingPageToolBarView({ activeLayout: this.get('pageLayoutId'), + isDescriptionRequired: this.get('isDescriptionRequired'), bubbleTargets: this }); } }, + + /** + * The indicator whether the 'description' in landing page is required + * + * @attribute isDescriptionRequired + * @type Boolean + */ + isDescriptionRequired: {}, } }); }); diff --git a/Resources/public/js/views/ezs-landingpagetoolbarview.js b/Resources/public/js/views/ezs-landingpagetoolbarview.js index 6db2a34..9768a80 100644 --- a/Resources/public/js/views/ezs-landingpagetoolbarview.js +++ b/Resources/public/js/views/ezs-landingpagetoolbarview.js @@ -73,6 +73,7 @@ YUI.add('ezs-landingpagetoolbarview', function (Y) { disabled: false, label: Y.eZ.trans('group.basics.title', {}, 'landingpagetoolbar'), priority: 2, + isDescriptionRequired: this.get('isDescriptionRequired'), bubbleTargets: this }); } @@ -122,7 +123,15 @@ YUI.add('ezs-landingpagetoolbarview', function (Y) { this.get('elementsGroupActionView') ]; } - } + }, + + /** + * The indicator whether the 'description' in landing page is required + * + * @attribute isDescriptionRequired + * @type Boolean + */ + isDescriptionRequired: {}, } }); }); diff --git a/Resources/public/js/views/forms/ezs-landingpageconfigpopupformview.js b/Resources/public/js/views/forms/ezs-landingpageconfigpopupformview.js index 20c50ab..c3e39c7 100644 --- a/Resources/public/js/views/forms/ezs-landingpageconfigpopupformview.js +++ b/Resources/public/js/views/forms/ezs-landingpageconfigpopupformview.js @@ -336,7 +336,8 @@ YUI.add('ezs-landingpageconfigpopupformview', function (Y) { landingPageBasicsView: { valueFn: function () { return new Y.eZS.LandingPageBasicsView({ - urlPrefix: this.get('urlPrefix') + urlPrefix: this.get('urlPrefix'), + isDescriptionRequired: this.get('isDescriptionRequired') }); } }, @@ -422,6 +423,14 @@ YUI.add('ezs-landingpageconfigpopupformview', function (Y) { return Y.eZ.trans('btn.done', {}, 'formlandingpageconfig'); } }, + + /** + * The indicator whether the 'description' in landing page is required + * + * @attribute isDescriptionRequired + * @type Boolean + */ + isDescriptionRequired: {}, } }); }); diff --git a/Resources/public/js/views/services/ezs-dynamiclandingpagecreatorviewservice.js b/Resources/public/js/views/services/ezs-dynamiclandingpagecreatorviewservice.js index 0441c0f..6783788 100644 --- a/Resources/public/js/views/services/ezs-dynamiclandingpagecreatorviewservice.js +++ b/Resources/public/js/views/services/ezs-dynamiclandingpagecreatorviewservice.js @@ -22,6 +22,25 @@ YUI.add('ezs-dynamiclandingpagecreatorviewservice', function (Y) { * @extends eZS.LandingPageCreatorService */ Y.eZS.DynamicLandingPageCreatorViewService = Y.Base.create(CLASSNAME, Y.eZS.LandingPageCreatorService, [], { + _getViewParameters: function () { + var app = this.get('app'); + + return { + 'assetRoot': app.get('assetRoot'), + 'apiRoot': app.get('apiRoot'), + 'parentLocationPath': this.get('parentLocationPath'), + 'parentLocationId': this.get('parentLocation').get('id'), + 'currentUserInfo': this.get('app').get('user').getAttrs(), + 'pageLayoutId': this.get('pageLayoutId'), + 'pageLayoutData': this.get('pageLayoutData'), + 'landingPageModel': this.get('pageModel'), + 'blockFieldsConfig': this.get('blockFieldsConfig'), + 'layoutsList': this.get('layoutsList'), + 'timelineMinimumDate': this.get('timelineMinimumDate'), + 'isDescriptionRequired': this.get('contentType').get('fieldDefinitions').description.isRequired + }; + }, + /** * Initializes the content, version and owner model * diff --git a/Resources/public/js/views/services/ezs-dynamiclandingpageeditorviewservice.js b/Resources/public/js/views/services/ezs-dynamiclandingpageeditorviewservice.js index 42a3ed1..f34a671 100644 --- a/Resources/public/js/views/services/ezs-dynamiclandingpageeditorviewservice.js +++ b/Resources/public/js/views/services/ezs-dynamiclandingpageeditorviewservice.js @@ -47,6 +47,7 @@ YUI.add('ezs-dynamiclandingpageeditorviewservice', function (Y) { contentInfo: this.get('isVersionNo') ? contentInfo : null, previewUrl: this.get('versionPreviewUrl'), landingPageData: this.get('landingPageData'), + isDescriptionRequired: this.get('contentType').get('fieldDefinitions').description.isRequired, }); }, -- 2.6.4 (Apple Git-63)