-
Notifications
You must be signed in to change notification settings - Fork 91
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
#1515: Add keywords field to the edit image description slide panel #1605
#1515: Add keywords field to the edit image description slide panel #1605
Conversation
…panel - initial implementation of ui-select for keywords field
@@ -48,6 +50,7 @@ define([ | |||
getDetails(this.imageEditDetailsUrl, [imageId]).then(function (imageDetails) { | |||
this.images[imageId] = imageDetails[imageId]; | |||
this.image(this.images[imageId]); | |||
this.mediaGalleryEditKeywordsDetails().getKeywordsOp(this.image().tags); |
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.
Instead of setting keyword options - let's export the image
from the image-edit component to the keywords-ui-select component
"#media-gallery-image-edit-keywords-details": { | ||
"Magento_Ui/js/core/app": { | ||
"components": { | ||
"mediaGalleryEditKeywordsDetails": { |
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 think it would be better to declare and initialize this component as a child to the edit details component. Please see AdobeStockImageAdminUi/view/adminhtml/web/js/components/grid/column/image-preview.js
- viewConfig
for example
return Select.extend({ | ||
defaults: { | ||
template: 'Magento_MediaGalleryUi/image/edit/keyword-ui-select', | ||
options: [] |
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.
options
property is already declared and observed in the inherited component
…panel - added keyword-ui-select as child component of image-edit, export image to keyword-ui-select, and modified getkeywordsop logic
…panel - modified getkeywordsop logic
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.
Thanks for the updates @joweecaquicla ! See my comments
viewConfig: [ | ||
{ | ||
component: 'Magento_MediaGalleryUi/js/image/edit/keyword-ui-select', | ||
name: '${ $.name }_select' |
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'd use a more specific name for the keywords field/select
name: '${ $.name }_select' | |
name: '${ $.name }_keywords' |
@@ -49,6 +82,7 @@ define([ | |||
this.images[imageId] = imageDetails[imageId]; | |||
this.image(this.images[imageId]); | |||
this.openEditImageDetailsModal(); | |||
this.getKeywordsOp(); |
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.
To avoid this call, simply make sure the keywords component is rendering options based on the imported image
@magento run all tests |
@magento run all tests |
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.
HI @joweecaquicla @sivaschenko, thanks for the PR, please follow below some comments.
MediaGalleryUi/view/adminhtml/templates/image_edit_details_standalone.phtml
Outdated
Show resolved
Hide resolved
MediaGalleryUi/view/adminhtml/templates/image_edit_details.phtml
Outdated
Show resolved
Hide resolved
viewConfig: [ | ||
{ | ||
component: 'Magento_Ui/js/form/element/ui-select', | ||
name: '${ $.name }_keywords' | ||
} | ||
], | ||
exports: { | ||
keywordOptions: '${ $.name }_keywords:options' | ||
}, | ||
links: { | ||
selectedKeywords: '${ $.name }_keywords: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.
I believe we should create a separate component like ui-keywords
that extends ui-select
, the way it is at the moment we have image-edit
component changing linked properties and as consequence changing directly the ui-select
state. By having separate component the component would have its own template and its own methods changing its own properties. What do you think?
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.
That's not actually keywords ui-select responsibility to change it's options/value. We may introduce a separate component for add new keyword field and button. However, in this case image-edit will still needs to be a proxy between ui-select and add-keyword components, so in my opinion that might increase the complexity. I'd postpone extracting additional components from image-edit
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.
As for adding the add keyword field to ui-select component approach - I wouldn't like to rewrite the ui-select component and template as that is a potential for conflicts on upgrades
*/ | ||
getOptionForKeyword: function(keyword) { | ||
return { | ||
'is_active': 1, |
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.
'is_active': 1, | |
is_active: 1, |
@magento run all tests |
…ion into 1515-add-keywords-field-to-edit-image
Extracted task to use form ui component #1690 |
@magento run all tests |
@magento run all tests |
@magento run all tests |
@magento run all tests |
Hi @joweecaquicla, thank you for your contribution! |
Description (*)
This PR will introduce the keywords field on the edit image details panel.
Fixed Issues (if relevant)
Manual testing scenarios (*)