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

Fix EZP-27147: Not translatable binary fields can be updated using drag&drop #828

Merged
merged 1 commit into from
Apr 4, 2017

Conversation

yannickroger
Copy link
Contributor

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

Description

When fixing the fields in #788 I forgot to prevent from drag and dropping on binary fields. So goal of this PR is to fix that.

Tests

Manual test and completed unit tests

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.

besides inline comment, good job :)

@@ -357,6 +357,9 @@ YUI.add('ez-binarybase-editview', function (Y) {
*/
_prepareDrop: function (e) {
e.preventDefault();
if (this.get('isNotTranslatable')) {
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 do this check before preventing the default behavior and not calling e.preventDefault() if drag and drop is not handled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I do that, the browsers reads the image as a file (instead of the page) file://myfile.png

Copy link
Contributor

Choose a reason for hiding this comment

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

that's the default browser's behavior when you drop an image in a page that does not handle the drop event. And indeed, you are right, it makes sense to avoid it, so you can keep the code as it is.

@@ -394,6 +397,10 @@ YUI.add('ez-binarybase-editview', function (Y) {
var files = e._event.dataTransfer.files;

e.preventDefault();
if (this.get('isNotTranslatable')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

@yannickroger yannickroger merged commit cbb59c1 into 1.7 Apr 4, 2017
@yannickroger yannickroger deleted the ezp-27147-drop_image_non_trans_17 branch April 4, 2017 11:38
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants