analytics: Refactor to support more than one tooltip on same page.

While we don't actually need another tooltip on /stats right now, this
provides a clear approach for how to do that.  We've since added
tooltips in various other parts of the webapp, and that code is pretty
copy-pasteable, so I think it's reasonable to say this closes #4612.

Cleaned up by tabbott to remove a bunch of unnecessary changes.
This commit is contained in:
Nikhil Kumar Mishra
2018-01-04 01:18:56 +05:30
committed by Tim Abbott
parent 0932a27647
commit 478674a6d6
2 changed files with 4 additions and 4 deletions

View File

@@ -71,7 +71,7 @@ function update_last_full_update(end_times) {
$('#id_last_full_update').closest('.last-update').show();
}
$(function () {
$(function tooltips() {
$('span[data-toggle="tooltip"]').tooltip({
animation: false,
placement: 'top',
@@ -79,8 +79,9 @@ $(function () {
trigger: 'manual',
});
$('#id_last_update_question_sign').hover(function () {
$('span[data-toggle="tooltip"]').tooltip('toggle');
$('span.last_update_tooltip').tooltip('toggle');
});
// Add configuration for any additional tooltips here.
});
function populate_messages_sent_over_time(data) {

View File

@@ -82,7 +82,6 @@
</div>
</div>
</div>
<div class="chart-container">
<h1>{{ _("Active users") }}</h1>
<div class="button-container">
@@ -108,7 +107,7 @@
<div class="last-update">
{{ _("Last update") }}: <span id="id_last_full_update"></span>
<span data-toggle="tooltip" title="{% trans %}A full update of all the graphs happens once a day.<br/>The “Messages Sent Over Time” graph is updated once an hour.{% endtrans %}">
<span data-toggle="tooltip" class="last_update_tooltip" title="{% trans %}A full update of all the graphs happens once a day.<br/>The “Messages Sent Over Time” graph is updated once an hour.{% endtrans %}">
<span class="fa fa-info-circle" id="id_last_update_question_sign"></span>
</span>
<br />