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

fixes tooltips on bounty detail pages #4938

Merged
merged 4 commits into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions app/assets/v2/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1581,3 +1581,7 @@ div.busyOverlay {
.g-modal .modal-footer {
border: none;
}

.inner-tooltip {
pointer-events: none;
}
12 changes: 8 additions & 4 deletions app/assets/v2/js/pages/bounty_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ var heads = {
var callbacks = {
'github_url': link_ize,
'value_in_token': function(key, val, result) {
return [ 'amount', token_value_to_display(val) + ' ' + result['token_name'] ];
var title = token_value_to_display(val) + ' ' + result['token_name'];
var title_expand = title + ' in funding from original funder.';
Copy link
Member

Choose a reason for hiding this comment

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

@owocki I'm updating this to const just to be on the safer side + to avoid hoisting


$('#value_in_token').parents('.token').attr('title', title_expand);
return [ 'amount', title ];
},
'avatar_url': function(key, val, result) {
return [ 'avatar', '<a href="/profile/' + result['org_name'] + '"><img class="avatar ' + result['github_org_name'] + '" src="' + val + '"></a>' ];
Expand Down Expand Up @@ -233,9 +237,8 @@ var callbacks = {
if (val === null) {
return [ null, null ];
}
var rates_estimate = get_rates_estimate(val);

$('#value_in_usdt_wrapper').attr('title', '<div class="tooltip-info tooltip-sm">' + rates_estimate + '</div>');
$('#value_in_usdt_wrapper').attr('title', '<div class="tooltip-info">The funding in this bounty adds up to $' + val + ' USD </div>');

return [ 'Amount_usd', val ];
},
Expand Down Expand Up @@ -296,7 +299,7 @@ var callbacks = {
const tokenValue = Math.round(1.0 * ratio);
const timestamp = new Date(obj['timestamp']);
const timePeg = timeDifference(dateNow, timestamp > dateNow ? dateNow : timestamp, false, 60 * 60);
const tooltip = `$ ${Math.round(usd)} USD in crowdfunding`;
const tooltip = `+ ${funding} ${tokenName} in crowdfunding`;

leftHtml += '<p class="m-0">+ ' + funding + ' ' + tokenName + '</p>';
rightHtml += '<p class="m-0">@ $' + tokenValue + ' ' + tokenName + ' as of ' + timePeg + '</p>';
Expand All @@ -307,6 +310,7 @@ var callbacks = {
newTokenTag(funding, tokenName, tooltip, true),
usdTagElement
);

}

$('#value_in_usdt').html(Math.round(totalUSDValue));
Expand Down
7 changes: 2 additions & 5 deletions app/assets/v2/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -1360,14 +1360,11 @@ function newTokenTag(amount, tokenName, tooltipInfo, isCrowdfunded) {
span.innerHTML = amount + ' ' + tokenName +
(isCrowdfunded ? '<i class="fas fa-users ml-1"></i>' : '');

p.className = 'inner-tooltip';
p.appendChild(span);
ele.appendChild(p);

if (tooltipInfo) {
ele.title =
'<div class="tooltip-info tooltip-sm">' +
tooltipInfo +
'</div>';
ele.title = tooltipInfo;
}

return ele;
Expand Down
4 changes: 2 additions & 2 deletions app/dashboard/templates/bounty/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ <h4 id="title" class="font-title"></h4>
<div class="col-12 text-center text-lg-left">
<div class="tags font-caption align-items-center">
<div class="tag token">
<p>
<p class="inner-tooltip">
<span id="value_in_token"></span>
</p>
</div>
<div id="value_in_usdt_wrapper" title="" class="tag usd ml-3">
<p>
<p class="inner-tooltip">
<span id="value_in_usdt"></span>
<span>USD</span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion app/retail/templates/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div class="container">
<h2 class="content-block__title">
${{ universe_total_usd|floatformat:2|intcomma }} of {% blocktrans %}
Total Platform Value
Gross Marketplace Value
{% endblocktrans %}
{% if keyword %}({{keyword}}){%endif%}
</h2>
Expand Down