Skip to content

Commit

Permalink
bs4 fix sep tooltips (#4207)
Browse files Browse the repository at this point in the history
* fix tooltip hide, update qle tooltip for bs4 to be right aligned, update js to hide tooltip on click

* use template instead of style to override broken fade
  • Loading branch information
charlienparker authored Aug 6, 2024
1 parent a89ecdf commit 2eed7d7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/qle.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ $(function () {
if (bs4) {
$('#qle_submit').attr('disabled', 'disabled');
$("#qle-details").get(0).scrollIntoView({behavior: 'smooth'});
$('.tooltip').remove();
}
});

Expand Down
5 changes: 3 additions & 2 deletions app/helpers/insured/families_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def render_product_type_details(metal_level_kind, nationwide)
end

def qle_link_generator(qle, index)
options = {class: 'qle-menu-item'}
options = {class: "qle-menu-item #{'pr-3' if @bs4}"}
data = {
title: qle.title, id: qle.id.to_s, label: qle.event_kind_label,
is_self_attested: qle.is_self_attested,
Expand All @@ -127,7 +127,8 @@ def qle_link_generator(qle, index)
}

if qle.tool_tip.present?
data.merge!(toggle: 'tooltip', placement: index > 2 ? 'top' : 'bottom')
legacy_placement = index > 2 ? 'top' : 'bottom'
data.merge!(toggle: 'tooltip', placement: @bs4 ? 'right' : legacy_placement, trigger: 'hover')
options.merge!(data: data, title: qle.tool_tip)
else
options.merge!(data: data)
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -675,4 +675,4 @@ a.disabled {
pointer-events: none;
color: var(--grey-100);
}
}
}
6 changes: 6 additions & 0 deletions app/views/insured/families/find_sep.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
</div>
</div>
</div>
<script>
$(".qle-menu-item ").tooltip({
// need to define template to add 'show' class to override the tooltip's default 'fade' class which sets opacity: 0
template: '<div class="tooltip show" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
});
</script>
<% else %>
<div class="container">
<div class="row">
Expand Down

0 comments on commit 2eed7d7

Please sign in to comment.