-
Notifications
You must be signed in to change notification settings - Fork 56
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
EZP-31236: Added tooltips as new UI component #1176
Conversation
color: $ez-black; | ||
font-weight: 700; | ||
text-align: left; | ||
box-shadow: 0 4px 6px rgba(135,135,135,0.35); |
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.
calculateRem
(function(doc) { | ||
jQuery(document).ready(() => { | ||
const tooltipsNode = doc.querySelectorAll('[data-toggle="tooltip"]'); | ||
let delay, extraClass; |
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 can always declare it as consts inside for loop
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(() => { |
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.
We don't do it in any other places so we also shouldn't do it here.
@@ -0,0 +1,22 @@ | |||
(function(doc) { |
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.
(function(doc) { | |
(function(global, doc, $,) { |
}); | ||
} | ||
}); | ||
})(window.document); |
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.
})(window.document); | |
})(window, window.document, window.jQuery); |
}; | ||
extraClass = tooltipNode.getAttribute('data-extra-class') || ''; | ||
|
||
jQuery(tooltipNode).tooltip({ |
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.
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); |
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 use Prettier
show: tooltipNode.getAttribute('data-delay-show') || 150, | ||
hide: tooltipNode.getAttribute('data-delay-hide') || 75, | ||
}; | ||
extraClass = tooltipNode.getAttribute('data-extra-class') || ''; |
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 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, |
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.
delay: delay, | |
delay, |
|
||
&--big &__inner { | ||
padding: calculateRem(8px) calculateRem(16px); | ||
font-size: calculateRem(13px); |
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.
Default is 16px and big is 13px.
@@ -0,0 +1,22 @@ | |||
(function(doc) { | |||
jQuery(document).ready(() => { | |||
const tooltipsNode = doc.querySelectorAll('[data-toggle="tooltip"]'); |
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.
This will not work on our all tooltips with title
@@ -0,0 +1,28 @@ | |||
(function(global, doc, eZ, $) { | |||
eZ.helpers.tooltips = { |
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 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; |
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.
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> |
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.
Indentation is not the best here
}, | ||
}; | ||
|
||
eZ.helpers.tooltips.parse(); |
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.
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.
|
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.
+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') || ''; |
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.
Probably could be replaced by tooltipNode.dataset.extraClasses
. Ref. https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
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. |
The HTML has changed in some places. Comparison of two elements where tests fail: Before:
After:
The value previously found in |
Now every title tag is changed to data-original-title by bootstrap javascript |
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.
- Header in Form Builder is misaligned.
- 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 occursCannot read property 'Location' of undefined
- Widgets are not properly styled - Publish Later/Send to review. Also in Page Builder.
I made rebase, everything should be ok |
b6c114a
to
b58dbd3
Compare
Added tooltips as new UI Component. Usage like bootstrap tooltip but ez-tooltip have 3 extra parameters added to tooltip caller node:
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:
$ composer fix-cs
)