Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

EZP-26751: Value of fields not flagged as Translatable can be updated #788

Merged
merged 1 commit into from
Mar 14, 2017

Conversation

yannickroger
Copy link
Contributor

@yannickroger yannickroger commented Jan 27, 2017

Link: https://jira.ez.no/browse/EZP-26751

Description

Field that can not be translated are not flagged as they should on other languages. They also can be updated. This PR fixes that.

not-translatable

Tests

Manual test and unit test update

TODO

  • Squash commits

@@ -85,6 +88,7 @@ YUI.add('ez-contenteditformview', function (Y) {
field: field,
config: config,
languageCode: languageCode,
isNotTranslatable: isNotTranslatable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not super convinced by the name but I don't have a better idea at the moment

@@ -1,4 +1,4 @@
<div class="pure-g ez-editfield-row">
<div class="pure-g ez-editfield-row {{#if isNotTranslatable}}ez-editfield-not-translatable{{/if}}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add this class on the view container instead. Also, given it represents a state, it should be name is-not-translatable (or something like that depending on the name of this state)

@@ -24,3 +24,22 @@
.ez-view-contenteditformview .is-collapsed .fieldgroup-name:after {
content: "\E604";
}

.ez-view-contenteditformview .ez-editfield-not-translatable-msg {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be in contenteditform.css but in fieldedit.css as you actually style a field edit view


if (field) {
try {
isNotTranslatable = !(def.isTranslatable || languageCode === content.get('mainLanguageCode'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you check that when creating a Content item ?


this.set('isNotTranslatable', this.get('translating') && !this.get('fieldDefinition').isTranslatable);

this.after('activeChange', Y.bind(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should subscribe to isNotTranslatableChange event instead

@@ -276,6 +277,14 @@ YUI.add('ez-fieldeditview', function (Y) {
this.after('errorStatusChange', this._errorUI);

this._addDOMEventHandlers(_events);

this.set('isNotTranslatable', this.get('translating') && !this.get('fieldDefinition').isTranslatable);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNotTranslatable should be marked as read only since it is a computed value so here you should use _set and the attribute should have the read only flag

@yannickroger yannickroger force-pushed the ezp-26751-translatable_fields branch from 7e374e7 to e806c53 Compare January 27, 2017 15:14
@yannickroger yannickroger force-pushed the ezp-26751-translatable_fields branch 2 times, most recently from 916319c to 5127239 Compare February 9, 2017 10:45
@@ -351,7 +357,11 @@ YUI.add('ez-richtext-editview', function (Y) {
* @return {Object}
*/
_getFieldValue: function () {
var value = this._getXHTML5EditValue();
var value = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most likely you should init it with the field value

@yannickroger yannickroger force-pushed the ezp-26751-translatable_fields branch from 5a48e0a to 85c5609 Compare February 10, 2017 10:59
@yannickroger yannickroger force-pushed the ezp-26751-translatable_fields branch 3 times, most recently from ddf5c65 to 8833c25 Compare February 21, 2017 08:35
@yannickroger
Copy link
Contributor Author

Feedback taken into account @dpobel and PR is complete fo review.

@andrerom
Copy link
Contributor

As this is support issue this should be against 1.7 branch right?

@yannickroger
Copy link
Contributor Author

@andrerom I was considering it at first. But the diff is quite big and it kind of changes the behavior so it is more than a bugfix.
@dpobel often referred this as an improvement as it is a border line bug (everything works without this patch, the interface is just misleading).

@andrerom
Copy link
Contributor

andrerom commented Feb 21, 2017

It is indeed border line, but the size of a change is not what we choose to call it a bug or not on, with test coverage, own manual testing, QA story testing, patch release certification, you should be able to be confident in what you are proposing and decide depending on if it can provide greater customer value then the risk it introduces.

@bdunogier
Copy link
Member

bdunogier commented Feb 21, 2017

The fact remains that this patch is much more of an improvement, or even a new feature, than a bugfix. The feature fixes a bug for a user, but it is still a feature, and we do not backport features as per semver.

Could we think of a limited, less intrusive version of the feature for 1.7, that would unblock the user ?

@yannickroger
Copy link
Contributor Author

We can provide a patch that applies on 1.7 for users wanting it, but they would have to reapply it after each update.
Or split the fix so it could be applied only on non translatable fields that they use to have a smaller codeprint.

@andrerom
Copy link
Contributor

andrerom commented Feb 22, 2017

providing patch but not applying it to 1.7 won't give much value here, my comment was about being clear and decide on bug / improvement, I have updated the comment to more clearly reflect that.

Copy link
Contributor

@dpobel dpobel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small changes to make but overall it's good.
For the target branch, given the patch, I think we can exceptionally apply it to 1.7 even if it does not strictly comply with semver and that it actually provides a new feature. But that means the QA will have to be very complete to avoid regressions.

*
* @attribute translating
* @type {Boolean}
* @default null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should remove the default value and mark the attribute as required

* True if the field is not translatable
*
* @attribute isNotTranslatable
* @readonly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@readOnly (unsure if yuidoc understands the @readonly)

* @default null
*/
isNotTranslatable: {
value: null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put false as the default value

}

.is-not-translatable .ez-editfield-not-translatable:before {
content: "\e61b";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in the theme css

@@ -32,3 +32,7 @@
display: block;
margin-top: 3em;
}

.ez-view-authoreditview.is-not-translatable .ez-field-sublabel {
opacity: 0.3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the opacity changes (in this CSS file and the others) should be moved in the theme CSS

@yannickroger yannickroger force-pushed the ezp-26751-translatable_fields branch from 8833c25 to 4a643b9 Compare February 22, 2017 13:36
@yannickroger yannickroger changed the base branch from master to 1.7 February 22, 2017 13:37
@yannickroger yannickroger force-pushed the ezp-26751-translatable_fields branch from 4a643b9 to fa52c1c Compare February 22, 2017 13:41
@yannickroger
Copy link
Contributor Author

yannickroger commented Feb 22, 2017

Feedback by @dpobel taken into account. Base branch is now 1.7.

Copy link
Contributor

@andrerom andrerom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (side: ping @sunpietro, maybe check if there is something on studio side that needs to be adapted for this, I doubt it but I ping anyway ;))

@sunpietro
Copy link
Contributor

Looks good 👍 it should not break anything in Studio

@yannickroger yannickroger force-pushed the ezp-26751-translatable_fields branch from e6476d9 to fbfa46f Compare March 14, 2017 08:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants