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-31236: Added tooltips as new UI component #1176

Merged
merged 15 commits into from
Feb 24, 2020

Conversation

lucasOsti
Copy link
Contributor

@lucasOsti lucasOsti commented Dec 27, 2019

Question Answer
Tickets https://jira.ez.no/browse/EZP-31236
Bug fix? no
New feature? yes
BC breaks? no
Tests pass? yes
Doc needed? yes
License GPL-2.0

Added tooltips as new UI Component. Usage like bootstrap tooltip but ez-tooltip have 3 extra parameters added to tooltip caller node:

  • data-extra-classes - additional class added to tooltip node .tooltip
  • data-delay-show - show delay
  • data-delay-hide - hide delay

All PR’s to this ticket:
ezsystems/ezplatform-matrix-fieldtype#30
https://github.com/ezsystems/ezplatform-form-builder/pull/205
ezsystems/ezplatform-user#58
https://github.com/ezsystems/ezplatform-workflow/pull/106
https://github.com/ezsystems/date-based-publisher/pull/148
ezsystems/ezplatform-admin-ui-modules#246
#1176
https://github.com/ezsystems/ezplatform-page-builder/pull/499

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

color: $ez-black;
font-weight: 700;
text-align: left;
box-shadow: 0 4px 6px rgba(135,135,135,0.35);
Copy link
Contributor

Choose a reason for hiding this comment

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

calculateRem

@lucasOsti lucasOsti requested a review from GrabowskiM December 27, 2019 14:14
@lucasOsti
Copy link
Contributor Author

Zrzut ekranu 2019-12-27 o 15 08 52

(function(doc) {
jQuery(document).ready(() => {
const tooltipsNode = doc.querySelectorAll('[data-toggle="tooltip"]');
let delay, extraClass;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can always declare it as consts inside for loop

@inakijv
Copy link
Contributor

inakijv commented Jan 8, 2020

Thank you for this contribution @lucasOsti 👍, it is going to improve the UX of the application. Could you please add images of the two different tooltips? (maybe also a gif would be good too)

@@ -0,0 +1,22 @@
(function(doc) {
jQuery(document).ready(() => {
Copy link
Member

Choose a reason for hiding this comment

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

We don't do it in any other places so we also shouldn't do it here.

@@ -0,0 +1,22 @@
(function(doc) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
(function(doc) {
(function(global, doc, $,) {

});
}
});
})(window.document);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
})(window.document);
})(window, window.document, window.jQuery);

};
extraClass = tooltipNode.getAttribute('data-extra-class') || '';

jQuery(tooltipNode).tooltip({
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
jQuery(tooltipNode).tooltip({
$(tooltipNode).tooltip({

color: $ez-black;
font-weight: 700;
text-align: left;
box-shadow: 0 calculateRem(4px) calculateRem(6px) rgba(135,135,135,0.35);
Copy link
Member

Choose a reason for hiding this comment

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

Please use Prettier

show: tooltipNode.getAttribute('data-delay-show') || 150,
hide: tooltipNode.getAttribute('data-delay-hide') || 75,
};
extraClass = tooltipNode.getAttribute('data-extra-class') || '';
Copy link
Member

Choose a reason for hiding this comment

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

I would name it extra-classes to be consistent with other places and this may contain multiple classes

extraClass = tooltipNode.getAttribute('data-extra-class') || '';

jQuery(tooltipNode).tooltip({
delay: delay,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
delay: delay,
delay,


&--big &__inner {
padding: calculateRem(8px) calculateRem(16px);
font-size: calculateRem(13px);
Copy link
Member

Choose a reason for hiding this comment

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

Default is 16px and big is 13px.

@@ -0,0 +1,22 @@
(function(doc) {
jQuery(document).ready(() => {
const tooltipsNode = doc.querySelectorAll('[data-toggle="tooltip"]');
Copy link
Member

Choose a reason for hiding this comment

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

This will not work on our all tooltips with title

@@ -0,0 +1,28 @@
(function(global, doc, eZ, $) {
eZ.helpers.tooltips = {
Copy link
Member

Choose a reason for hiding this comment

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

Please follow the convention of other helpers.
const with method
using the eZ.addConfig and so

eZ.helpers.tooltips = {
parse: () => {
const tooltipsNode = doc.querySelectorAll('[title]');
let delay, extraClasses;
Copy link
Member

Choose a reason for hiding this comment

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

Can be done as const inside the if

$(tooltipNode).tooltip({
delay,
template: `<div class="tooltip ez-tooltip ${extraClasses}">
<div class="arrow ez-tooltip__arrow"></div>
Copy link
Member

Choose a reason for hiding this comment

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

Indentation is not the best here

},
};

eZ.helpers.tooltips.parse();
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if helper itself should invoke the method.
The helper should be included with other helpers but invoked in the other file so we could move it as needed.

@lucasOsti
Copy link
Contributor Author

Thank you for this contribution @lucasOsti 👍, it is going to improve the UX of the application. Could you please add images of the two different tooltips? (maybe also a gif would be good too)

tooltips

@lucasOsti lucasOsti requested review from dew326 and adamwojs and removed request for adamwojs January 13, 2020 09:51
@lucasOsti lucasOsti requested a review from GrabowskiM January 14, 2020 09:38
Copy link
Member

@adamwojs adamwojs left a comment

Choose a reason for hiding this comment

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

+1 for the changes in *.php (besides code style issues)

show: tooltipNode.getAttribute('data-delay-show') || 150,
hide: tooltipNode.getAttribute('data-delay-hide') || 75,
};
const extraClasses = tooltipNode.getAttribute('data-extra-classes') || '';
Copy link
Member

Choose a reason for hiding this comment

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

Probably could be replaced by tooltipNode.dataset.extraClasses. Ref. https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes

@ViniTou
Copy link
Contributor

ViniTou commented Jan 15, 2020

But aside from CS issues, behat test were green two days ago on master, so you should look at them too. Maybe rebase would help.

@adamwojs adamwojs changed the title EZP-31236 Added tooltips as new UI component EZP-31236: Added tooltips as new UI component Jan 15, 2020
@mnocon
Copy link
Member

mnocon commented Jan 15, 2020

The HTML has changed in some places. Comparison of two elements where tests fail:

Before:

<a title="Assign to Users/Groups" href="/admin/role/1/assignment/create" class="btn btn-icon mx-3">
<a href="/admin/role/1/assignment/create" title="Assign to Users/Groups" class="btn btn-secondary">

After:

<a href="/admin/role/1/assignment/create" title="" class="btn btn-secondary" data-original-title="Assign to Users/Groups">
<a title="" href="/admin/role/1/assignment/create" class="btn btn-icon mx-3" data-original-title="Assign to Users/Groups">

The value previously found in title attribute is now in data-original-title. @lucasOsti please let me know if this is ok, if it is I will adjust the selectors (there are some similar to .ez-table-header [title^=Assign], which cannot find the correct elements right now).

@lucasOsti
Copy link
Contributor Author

The HTML has changed in some places. Comparison of two elements where tests fail:

Before:

<a title="Assign to Users/Groups" href="/admin/role/1/assignment/create" class="btn btn-icon mx-3">
<a href="/admin/role/1/assignment/create" title="Assign to Users/Groups" class="btn btn-secondary">

After:

<a href="/admin/role/1/assignment/create" title="" class="btn btn-secondary" data-original-title="Assign to Users/Groups">
<a title="" href="/admin/role/1/assignment/create" class="btn btn-icon mx-3" data-original-title="Assign to Users/Groups">

The value previously found in title attribute is now in data-original-title. @lucasOsti please let me know if this is ok, if it is I will adjust the selectors (there are some similar to .ez-table-header [title^=Assign], which cannot find the correct elements right now).

Now every title tag is changed to data-original-title by bootstrap javascript

Copy link

@katarzynazawada katarzynazawada left a comment

Choose a reason for hiding this comment

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

  1. Header in Form Builder is misaligned.
  2. UDW does not work. Cannot select any location, UDW is empty
    https://res.cloudinary.com/ezplatformtravis/image/upload/v1581073005/screenshots/5e3d426d840c7664459593-vendor_ezsystems_ezplatform-admin-ui_features_personas_subtreeeditor_feature_41_v5ebyr.png
    Error occurs Cannot read property 'Location' of undefined
  3. Widgets are not properly styled - Publish Later/Send to review. Also in Page Builder.

Screenshot 2020-02-07 at 10 24 26

Screenshot 2020-02-07 at 10 25 51

Screenshot 2020-02-07 at 13 26 27

Screenshot 2020-02-07 at 13 26 36

@lucasOsti
Copy link
Contributor Author

lucasOsti commented Feb 7, 2020

I made rebase, everything should be ok

@lucasOsti lucasOsti requested a review from dew326 February 11, 2020 15:40
@lucasOsti lucasOsti force-pushed the EZP-31236-add-tooltips branch from b6c114a to b58dbd3 Compare February 21, 2020 10:47
@lserwatka lserwatka merged commit 958e4e9 into ezsystems:master Feb 24, 2020
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.

9 participants