Skip to content

Issue #97, add explanation box - 2nd PR #454

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

Merged
merged 5 commits into from
Mar 11, 2020
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: 7 additions & 0 deletions frontend/src/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ <h2>
{{#filters}}
<input type="checkbox" name="{{ key }}" id="{{ key }}" {{#checked}}checked="checked"{{/checked}}>
<label for="{{ key }}">{{ message }}</label>
{{#needs_explanation}}
<div class="tooltip">
<span class="questionbox">?</span>
<span class="tooltiptext">For <strong>JavaScript</strong>, files with at least one function where all functions are uncovered.
<br />For <strong>C/C++/other languages</strong>, files which have no covered lines.</span>
</div>
{{/needs_explanation}}
{{/filters}}

<select name="last_push" id="last_push">
Expand Down
53 changes: 53 additions & 0 deletions frontend/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,56 @@ $samp_size: 20px;
float: right;
}
}

// Tooltip container for explanation (issue #97 enhancement)
#menu .tooltip {
position: relative;
display: inline-block;

// Question mark container
.questionbox {
text-align: center;
border-bottom: 1px dotted black;
cursor: default;
}

// Show the tooltip text when you mouse over the tooltip container
&:hover .tooltiptext {
visibility: visible;
opacity: 1;
}

.tooltiptext {
visibility: hidden;
line-height: 120%;
background-color: $default_color;
color: white;
text-align: left;
padding: 1vh 1vw;
border-radius: 6px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);

// Position the tooltip
position: absolute;
z-index: 1;
width: 30vw;
top: 100%;
left: 50%;
margin-left: -16vw; // Use half of the width including left horizontal padding size i.e 30vw/2 + 1vw

&::after {
content: " ";
position: absolute;
bottom: 100%; /* At the top of the tooltip */
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent $default_color transparent;
}

// Transition animation
opacity: 0;
transition: opacity 1s;
}
}
3 changes: 2 additions & 1 deletion frontend/src/zero_coverage_report.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export function zeroCoverageMenu(route) {
return {
key,
message: filter.name,
checked: isEnabled(key)
checked: isEnabled(key),
needs_explanation: key === "completely_uncovered"
};
}),
last_pushes: Object.entries(ZERO_COVERAGE_PUSHES).map(
Expand Down