Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stats: Show tooltips using tippyjs.

Aman Agrawal2e2ff568ba91
diff --git a/static/js/stats/stats.js b/static/js/stats/stats.js
index 0708d54af0e..0cc76e9c8bc 100644
--- a/static/js/stats/stats.js
+++ b/static/js/stats/stats.js
@@ -2,6 +2,7 @@ import $ from "jquery";
import PlotlyBar from "plotly.js/lib/bar";
import Plotly from "plotly.js/lib/core";
import PlotlyPie from "plotly.js/lib/pie";
+import tippy from "tippy.js";
import {i18n} from "../i18n";
import {page_params} from "../page_params";
@@ -86,18 +87,14 @@ function update_last_full_update(end_times) {
}
$(() => {
- $('span[data-toggle="tooltip"]').tooltip({
+ tippy(".last_update_tooltip", {
+ // Same defaults as set in our tippyjs module.
+ maxWidth: 300,
+ delay: [100, 20],
animation: false,
+ touch: ["hold", 750],
placement: "top",
- trigger: "manual",
});
- $("#id_last_update_question_sign")
- .on("mouseenter", () => {
- $("span.last_update_tooltip").tooltip("show");
- })
- .on("mouseleave", () => {
- $("span.last_update_tooltip").tooltip("hide");
- });
// Add configuration for any additional tooltips here.
});
diff --git a/templates/analytics/stats.html b/templates/analytics/stats.html
index f74929a8779..d47ed5f737a 100644
--- a/templates/analytics/stats.html
+++ b/templates/analytics/stats.html
@@ -122,7 +122,7 @@
<div class="last-update">
{{ _("Last update") }}: <span id="id_last_full_update"></span>
- <span data-toggle="tooltip" class="last_update_tooltip" data-html="true" 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="last_update_tooltip" data-tippy-content="{% trans %}A full update of all the graphs happens once a day. 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>