Skip to content

magento/magento2#39481: Completely removing a gallery-image from be k… #39680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2013 Adobe
* All Rights Reserved.
*/

/**
Expand Down Expand Up @@ -355,6 +355,14 @@ define([
imageData.isRemoved = true;
$imageContainer.addClass('removed').hide().find('.is-removed').val(1);

// Reset all image role/type selections to 'no_selection' value
// For each role (like base image, small image, etc.), clears both
// the UI select element and the internal types data structure
$.each(this.options.types, $.proxy(function (index, type) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggesting to add an comment for this newly added code block, so that in future developer can relate with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a comment for the new code block.

this.element.find('.image-' + type.code).val('no_selection');
this.options.types[index].value = 'no_selection';
}, this));

this._contentUpdated();
},

Expand Down