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

Fixed: Fix tooltips display, styles leaks, performance issues #851

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions themes/helveticus/template/macro/HtmlFormMacroLibrary.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ under the License.

<#macro renderTooltip tooltip="" tooltipStyle="">
<#if tooltip?has_content>
<span class="tooltipContainer<#if tooltipStyle?has_content> ${tooltipStyle}<#else> tooltip</#if>">
${tooltip}
</span>
<i class="hidden"></i>
<#rt/>
<i class="hoverTooltip" title="${tooltip}"></i>
<#rt/>
</#if>
</#macro>
120 changes: 17 additions & 103 deletions themes/helveticus/webapp/helveticus/helveticus-main-theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,9 @@ span.label {
}

/*** BUTTON /LINK / NAV STYLES ***/
// * { transition: .5s } is very (too) broad, it causes slowdowns on draggable/resizable elements like modals
// (leads to animations for each new size/position, eventually each pixel...)
// We should invert the logic here : transitions on chosen elements instead of everywhere except some elements.
a, a:hover, *:not(.ui-dialog, .ui-dialog-content) {
a, a:hover, input.buttontext, input[type="submit"] {
text-decoration: none;
-o-transition: .5s;
-ms-transition: .5s;
-moz-transition: .5s;
-webkit-transition: .5s;
transition: .2s;
}

a {
Expand Down Expand Up @@ -1049,36 +1043,6 @@ label.has-checkbox, .has-radio {
position: absolute;
right: 1rem;
}

.tooltip {
position: absolute;
white-space: nowrap;
top: 0.5rem;
margin-left: 1rem;
}

span.tooltip {
margin-top: 0.5rem;
position: static;
display: block;

> p {
position: absolute;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
width: 100%;
padding-bottom: 0.5rem;
}
}
}

span.tooltip {
position: absolute;
left: 0;
opacity: 0.7;
font-style: italic;
line-height: 1rem;
}

.has-checkbox {
Expand Down Expand Up @@ -1160,19 +1124,6 @@ span.tooltip {
td {
padding: 0.5rem;
vertical-align: middle;

&.has-tooltip {
position: relative;

.field-lookup {
padding-bottom: 0;
}

.tooltip {
left: 0.5rem;
top: -2.5rem
}
}
}

.button-col {
Expand Down Expand Up @@ -1292,11 +1243,6 @@ form .basic-table,
padding: 0.5rem;
}

&.has-tooltip td {
padding-bottom: 2.5rem;
position: relative;
}

.label, .group-label {
text-align: right;
padding-right: 0.5rem;
Expand Down Expand Up @@ -1449,54 +1395,22 @@ form .basic-table,
background: url("images/folder-open.svg") no-repeat center center !important;
}

#LevelSwitch td.has-tooltip {
padding: 0;

.has-checkbox {
margin: 0 0.7rem
}

.tooltip {
position: static;
}
}

.has-tooltip {
display: flex;
position: relative;
z-index: 90;

> i {
position: static;
z-index: 100;
height: 1.3rem;
width: 1.3rem;
border-radius: 2rem;
background-color: @border-color;
margin-left: 0.5rem;
font-style: normal;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;

&:before {
display: block;
content: "i";
font-weight: 600
}
}
i.hoverTooltip {
display: inline-flex;
height: 1.3rem;
width: 1.3rem;
border-radius: 2rem;
background-color: @border-color;
margin-left: 0.5rem;
font-style: normal;
cursor: pointer;
justify-content: center;
align-items: center;

> span.tooltipContainer {
position: absolute;
left: 0;
top: -3rem;
opacity: 1;
line-height: 1rem;
background: @grey-light;
padding: 0.8rem 1rem;
border-radius: 0.3rem;
font-weight: 500;
&:before {
display: block;
content: "i";
font-weight: 600
}
}

Expand Down
43 changes: 11 additions & 32 deletions themes/helveticus/webapp/helveticus/js/helveticus.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,33 @@
*/

function showHideUserPref() {
var userPref = document.getElementById("user-details");
const userPref = document.getElementById("user-details");

if(userPref.style.display == "none") {
if (userPref.style.display == "none") {
userPref.style.display = "flex";
}
else {
} else {
userPref.style.display = "none";
}
}

function selectOrgaOK(orgaName){
var selectOrga = document.getElementById("orga"+orgaName);
var currentModal = document.getElementById("selectOrga");
function selectOrgaOK(orgaName) {
const selectOrga = document.getElementById("orga" + orgaName);
const currentModal = document.getElementById("selectOrga");
selectOrga.click();
currentModal.style.visibility = "hidden";
}

document.addEventListener("DOMContentLoaded", function() {
let tooltips = document.querySelectorAll('.tooltip'),
checkboxs = document.querySelectorAll('input[type=checkbox]'),
radios = document.querySelectorAll('input[type=radio]'),
lefts = document.querySelectorAll('.lefthalf');

tooltips.forEach(tooltip => {
tooltip.classList.add('hidden');

let ParentTooltip = tooltip.parentNode;
ParentTooltip.classList.add('has-tooltip');

let infoTooltips = ParentTooltip.querySelectorAll('i');

infoTooltips.forEach(infoTooltip => {
infoTooltip.classList.remove("hidden");
infoTooltip.addEventListener("mouseenter", function( event ) {
tooltip.classList.remove('hidden');
});
infoTooltip.addEventListener("mouseout", function( event ) {
tooltip.classList.add('hidden');
})
})
});
document.addEventListener("DOMContentLoaded", function () {
const checkboxs = document.querySelectorAll('input[type=checkbox]');
const radios = document.querySelectorAll('input[type=radio]');
const lefts = document.querySelectorAll('.lefthalf');

checkboxs.forEach(checkbox => {
checkbox.parentNode.classList.add('has-checkbox');
});
radios.forEach(radio => {
radio.parentNode.classList.add('has-radio');
});
});
lefts.forEach(left => {
left.parentNode.classList.add('screenlet-flex');
});
Expand Down
Loading