Skip to content
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

Merged
merged 5 commits into from Jul 25, 2018

Conversation

dew326
Copy link
Member

@dew326 dew326 commented Jul 18, 2018

@dew326 dew326 self-assigned this Jul 18, 2018
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 {
Copy link
Contributor

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.

Copy link
Member Author

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)}>
Copy link
Contributor

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%;
Copy link
Contributor

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();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not preventDefault()?

Copy link
Member Author

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] }),
Copy link
Contributor

Choose a reason for hiding this comment

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

(state) => ({ selectedContent: [state.contentMeta] }),

@lserwatka
Copy link
Member

@dew326 did you cover bookmarks as well?

@dew326
Copy link
Member Author

dew326 commented Jul 18, 2018

@lserwatka Yes, I covered everything. Browse, Search, Create, Bookmarks in both single and multiple selection. Just didn't want to attach too many screenshots.

@lserwatka
Copy link
Member

@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) => {
Copy link
Contributor

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?

@barbaragr barbaragr self-assigned this Jul 19, 2018
@barbaragr
Copy link

  1. According to the specification UDW title should be:
  • ‘Select content item(s)’ for multi selection
  • ‘Select a content item’ for single selection
    Now there is: Select content
  1. Error message Cannot read property 'identifier' of undefined
  • configure vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/config/universal_discovery_widget.yml: for default configuration in allowed_content_types type article
    allowed_content_types: [article]
  • clear cache
  • create Cotent Type with ezojcetrelationlist
  • go to Content/Content structure and click Create and choose CT from previous step
  • click Select content - UDW is opened for a while, then it disappear and error message is shown: Cannot read property 'identifier' of undefined
  1. Scenario 2.2.2.8 Content item’s name link from spec https://ezno.sharepoint.com/:w:/r/sites/ProductTeam/_layouts/15/Doc.aspx?sourcedoc=%7B137050e3-dd3f-4629-913f-e9e1f2c1dfce%7D&action=default doesn't work at all. Is it included in this PR's scope? Similar question for next scenario Content item’s parent name link - there is no parent name in search results...

Copy link

@barbaragr barbaragr left a comment

Choose a reason for hiding this comment

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

  1. 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)

  2. Scenario 2.2.1.3 Title of the UDW when adding an image should be Select an image and now there is Select an image to embed

  3. 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

  4. Group of scenarios 2.2.3 - similar like in point 3 - is it included in this PR?

@dew326
Copy link
Member Author

dew326 commented Jul 23, 2018

All points with the incorrect title are out of the scope of this PR (1, 4, 5).
3, 7 - switching to browse while searching is also out of scope. This can be done with "large content structure"

Only 2 and 6 are valid.

@dew326
Copy link
Member Author

dew326 commented Jul 24, 2018

@barbaragr fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

5 participants