From 8cde802fbd957cfd8ba01060237de7e194bb7f5a 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 --- .../public/js/views/actions/ezs-basicsgroupactionview.js | 12 +++++++++++- Resources/public/js/views/ezs-landingpagebasicsview.js | 13 ++++++++++++- Resources/public/js/views/ezs-landingpagecreatorview.js | 10 ++++++++++ Resources/public/js/views/ezs-landingpagetoolbarview.js | 11 ++++++++++- .../js/views/forms/ezs-landingpageconfigpopupformview.js | 13 +++++++++++-- .../services/ezs-dynamiclandingpagecreatorviewservice.js | 3 ++- .../services/ezs-dynamiclandingpageeditorviewservice.js | 3 ++- 7 files changed, 58 insertions(+), 7 deletions(-) diff --git a/Resources/public/js/views/actions/ezs-basicsgroupactionview.js b/Resources/public/js/views/actions/ezs-basicsgroupactionview.js index e1a4f137..59a39540 100644 --- a/Resources/public/js/views/actions/ezs-basicsgroupactionview.js +++ b/Resources/public/js/views/actions/ezs-basicsgroupactionview.js @@ -130,7 +130,9 @@ YUI.add('ezs-basicsgroupactionview', function (Y) { } View = this.get('basicsViewClass'); - viewInstance = new View(); + viewInstance = new View({ + 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. @@ -163,6 +165,14 @@ YUI.add('ezs-basicsgroupactionview', function (Y) { basicsViewClass: { value: Y.eZS.LandingPageBasicsView }, + + /** + * 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 e1245ced..20871c51 100644 --- a/Resources/public/js/views/ezs-landingpagebasicsview.js +++ b/Resources/public/js/views/ezs-landingpagebasicsview.js @@ -282,7 +282,7 @@ YUI.add('ezs-landingpagebasicsview', function (Y) { name: 'Page Description', 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 ad58c3bb..2485bbbd 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 b8c67444..30b14b05 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: 'Basics', 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 06dedba0..abef3db4 100644 --- a/Resources/public/js/views/forms/ezs-landingpageconfigpopupformview.js +++ b/Resources/public/js/views/forms/ezs-landingpageconfigpopupformview.js @@ -369,7 +369,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') }); } }, @@ -414,7 +415,15 @@ YUI.add('ezs-landingpageconfigpopupformview', function (Y) { }) ]; } - } + }, + + /** + * 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 0c8a3409..bbe74486 100644 --- a/Resources/public/js/views/services/ezs-dynamiclandingpagecreatorviewservice.js +++ b/Resources/public/js/views/services/ezs-dynamiclandingpagecreatorviewservice.js @@ -34,7 +34,8 @@ YUI.add('ezs-dynamiclandingpagecreatorviewservice', function (Y) { 'landingPageModel': this.get('pageModel'), 'blockFieldsConfig': this.get('blockFieldsConfig'), 'layoutsList': this.get('layoutsList'), - 'timelineMinimumDate': this.get('timelineMinimumDate') + 'timelineMinimumDate': this.get('timelineMinimumDate'), + 'isDescriptionRequired': this.get('contentType').get('fieldDefinitions').description.isRequired }; }, diff --git a/Resources/public/js/views/services/ezs-dynamiclandingpageeditorviewservice.js b/Resources/public/js/views/services/ezs-dynamiclandingpageeditorviewservice.js index 08a4f557..b3beac30 100644 --- a/Resources/public/js/views/services/ezs-dynamiclandingpageeditorviewservice.js +++ b/Resources/public/js/views/services/ezs-dynamiclandingpageeditorviewservice.js @@ -62,7 +62,8 @@ YUI.add('ezs-dynamiclandingpageeditorviewservice', function (Y) { 'layoutsList': this.get('layoutsList'), 'version': this.get('version'), 'timelineMinimumDate': this.get('timelineMinimumDate'), - 'contentInfo': this.get('isVersionNo') ? contentInfo : null + 'contentInfo': this.get('isVersionNo') ? contentInfo : null, + 'isDescriptionRequired': this.get('contentType').get('fieldDefinitions').description.isRequired }; },