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
EZP-29182/EZP-29187: Improvements in Universal Discovery Widget single and multi selection #94
Conversation
…e and multi selection
const contentType = contentTypesMap ? contentTypesMap[item.ContentType._href] : false; | ||
const contentTypeName = contentType ? contentType.names.value[0]['#text'] : labels.contentTableItem.notAvailable; | ||
const onClick = !!onItemClick ? onItemClick.bind(null, data) : null; | ||
export default class ContentTableItemComponent extends Component { |
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 go back to stateless component. The renderSelectContentBtn
can be defined outside of const ContentTableItemComponent
definition, just pass the props to it.
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.
Good catch. During development I changed this to component with state and then removed the state :)
<button | ||
className="c-finder-tree-branch__load-more" | ||
onClick={() => this.props.onLoadMore(this.props.parentLocation)}> | ||
<button className="c-finder-tree-branch__load-more" onClick={() => this.props.onLoadMore(this.props.parentLocation)}> |
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.
Please, create a class method for handling onClick
it wil prevent additional re-renderings on each update.
.c-select-content-button { | ||
position: absolute; | ||
right: 1.3rem; | ||
top: 50%; |
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.
It shouldn't be here. Because it's an information about block position. It should go to parent container style definitions.
} | ||
|
||
handleSelect(event) { | ||
event.stopPropagation(); |
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.
Why not preventDefault()
?
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.
Because I don't want to bubble this event to the parent.
@@ -175,6 +187,13 @@ export default class UniversalDiscoveryModule extends Component { | |||
this.props.onConfirm(this.addContentTypeInfo(this.state.selectedContent)); | |||
} | |||
|
|||
handleSingleConfirm() { | |||
this.setState( | |||
(state) => ({ ...state, selectedContent: [this.state.contentMeta] }), |
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.
(state) => ({ selectedContent: [state.contentMeta] }),
@dew326 did you cover bookmarks as well? |
@lserwatka Yes, I covered everything. |
@dew326 ok, clear. Well done! |
@@ -106,6 +108,16 @@ export default class UniversalDiscoveryModule extends Component { | |||
if (!!contentMeta && !isPreviewMetaReady) { | |||
this.props.loadContentInfo(this.props.restInfo, contentMeta.ContentInfo.Content._id, this.updateContentMetaWithCurrentVersion); | |||
} | |||
|
|||
if (!this.props.multiple) { | |||
this.canSelectContent(contentMeta, (canSelectContent) => { |
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.
Do you think it would be a good idea to extract the callback into a method like setCanSelectContentState
?
|
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.
-
While embedding a content item in a rich text field, when I launch the UDW to select a content item, title should be:
Select a content **item** to embed
and now there is:Select a content to embed
(according to scenario 2.2.1.2 from https://ezno.sharepoint.com/:w:/r/sites/ProductTeam/_layouts/15/Doc.aspx?sourcedoc=%7B0623259a-d7fa-4365-9807-207e44697563%7D&action=default) -
Scenario 2.2.1.3 Title of the UDW when adding an image should be
Select an image
and now there isSelect an image to embed
-
Scenario 2.2.2.3 Disabling the ‘Confirm’ button - there is no tooltip for disabled Confirm button. Tooltips message required by scenario:
The Content Type is not allowed for selection
-
Group of scenarios 2.2.3 - similar like in point 3 - is it included in this PR?
All points with the incorrect title are out of the scope of this PR (1, 4, 5). Only 2 and 6 are valid. |
@barbaragr fixed |
Jira tickets: https://jira.ez.no/browse/EZP-29187, https://jira.ez.no/browse/EZP-29182
Screenshots