-
Notifications
You must be signed in to change notification settings - Fork 47
EZP-26751: Value of fields not flagged as Translatable can be updated #788
Conversation
@@ -85,6 +88,7 @@ YUI.add('ez-contenteditformview', function (Y) { | |||
field: field, | |||
config: config, | |||
languageCode: languageCode, | |||
isNotTranslatable: isNotTranslatable, |
There was a problem hiding this comment.
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}}"> |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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')); |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
7e374e7
to
e806c53
Compare
916319c
to
5127239
Compare
@@ -351,7 +357,11 @@ YUI.add('ez-richtext-editview', function (Y) { | |||
* @return {Object} | |||
*/ | |||
_getFieldValue: function () { | |||
var value = this._getXHTML5EditValue(); | |||
var value = ""; |
There was a problem hiding this comment.
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
5a48e0a
to
85c5609
Compare
ddf5c65
to
8833c25
Compare
Feedback taken into account @dpobel and PR is complete fo review. |
As this is support issue this should be against 1.7 branch right? |
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. |
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 ? |
We can provide a patch that applies on 1.7 for users wanting it, but they would have to reapply it after each update. |
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. |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
8833c25
to
4a643b9
Compare
4a643b9
to
fa52c1c
Compare
Feedback by @dpobel taken into account. Base branch is now 1.7. |
There was a problem hiding this 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 ;))
Looks good 👍 it should not break anything in Studio |
e6476d9
to
fbfa46f
Compare
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.
Tests
Manual test and unit test update
TODO