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-29319: I want to know that Confirmed items in UDW are clickable #71

Conversation

tischsoic
Copy link
Contributor

@dew326
Copy link
Member

dew326 commented Jun 20, 2018

I'm not a big fan of unnecessary refactors. It will cause many conflicts when merging a fix up to master.
This ticket is about to add few CSS rules.

@lserwatka
Copy link
Member

@dew326 is right, let's split this up on two PRs

@tischsoic
Copy link
Contributor Author

@dew326 There were also 2 changes to JS needed. Not only to CSS.
e.g. I moved onClick={this.togglePopup.bind(this)} up in JSX structure in selected.content.component.js. Previously you often asked in such cases to refactor bind and so on, so I decided that this time I will refactor the whole file so that everything would be OK.
There is also one change in popup.component.js, thus I also refactored this component.
Split this refactoring?

@tischsoic
Copy link
Contributor Author

tischsoic commented Jun 20, 2018

I think that partial refactoring is good; we should do this when touching some component. It would be rather a bad idea to change e.g. Object.assign to {... in every place in the source code at once because there are no tests. So the other option is to refactor on the go.
What do you think? @lserwatka @dew326 @sunpietro

@sunpietro
Copy link
Contributor

@tischsoic at first, you should focus only on fixing the issue making as little changes as possible. Then in the separate PR, you might do some code refactoring and there we'll discuss your new approach. Is it ok for you?

@tischsoic
Copy link
Contributor Author

@sunpietro I will just remove unnecessary refactoring.

@tischsoic tischsoic force-pushed the EZP-29319-i-want-to-know-that-confirmed-items-in-udw-are-clickable branch 2 times, most recently from ec33f05 to 5fe4ebc Compare June 21, 2018 11:59
const titles = items.map((item) => item.ContentInfo.Content.Name).join(', ');
const anyItemSelected = !!items.length;
const cssClassOnAnyItemSelected = anyItemSelected ? 'c-selected-content--any-item-selected' : '';
const cssClasses = `c-selected-content ${cssClassOnAnyItemSelected}`;
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 would be better to use something like this: https://www.npmjs.com/package/classnames
What do you think, @sunpietro @dew326 ?

@tischsoic tischsoic force-pushed the EZP-29319-i-want-to-know-that-confirmed-items-in-udw-are-clickable branch from 5fe4ebc to 210d9e4 Compare June 21, 2018 13:45
@tischsoic tischsoic force-pushed the EZP-29319-i-want-to-know-that-confirmed-items-in-udw-are-clickable branch from 210d9e4 to 1b75fc3 Compare June 21, 2018 13:46
* @memberof PopupComponent
*/
hidePopup() {
hidePopup(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.

What was the reason to stop event propagation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now there is no exact reason for this, but there was during development.

Popup is rendered within SelectedContentComponent.
So there is that chain of events:

  1. you click on popup.
  2. hidePopup hides popup, and calls onClose from SelectedContentComponent
  3. click event reaches top div of SelectedContentComponent

What is important is that in some point of developement there was togglePopup as onClick on the top div of SelectedContentComponent.
So back then event from point 3 was reaching top div, and in turn togglePopup was called so popup was reopened again. Because of togglePopup being called.

event reaches popup -> hidePopup -> event reaches top div -> togglePopup
hide + toggle === no change

But at the end I moved onClick to another div and there is no longer need for stopPropagation .

Remove this stopPropagation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, now it's not needed here.

{this.renderLimitLabel()}
<div className="c-selected-content__content-names" onClick={this.togglePopup.bind(this)}>
{titles.length ? titles : this.props.labels.selectedContent.noConfirmedContent}
<div className={infoCssClasses} onClick={this.togglePopup.bind(this)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Binding should go to constructor

@lserwatka lserwatka merged commit f0b28fa into ezsystems:master Jun 22, 2018
tischsoic added a commit to tischsoic/ezplatform-admin-ui-modules that referenced this pull request Jun 27, 2018
…zsystems#71)

* EZP-29319: Fix Confirmed items in UDW - improve clickability.

* EZP-29319: Move bind to constructor; remove stopPropagation from popupin hidePopup method
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

4 participants