signup: Show realm name in a tooltip on signup page.

This is needed to make sure that user can see the realm
name in case it does not fits into the UI and is shown
with ellipsis.

Fixes #31676.
This commit is contained in:
Sahil Batra 2024-09-20 14:37:55 +05:30 committed by Tim Abbott
parent 9b67164270
commit 6ddaaa4ef9
2 changed files with 15 additions and 1 deletions

View File

@ -72,7 +72,7 @@ Form is validated both client-side using jquery-validation (see signup.js) and s
{% if realm_name and not creating_new_realm %} {% if realm_name and not creating_new_realm %}
<img class="avatar inline-block" src="{{ realm_icon }}" alt="" /> <img class="avatar inline-block" src="{{ realm_icon }}" alt="" />
<div class="info-box inline-block"> <div class="info-box inline-block">
<div class="organization-name">{{ realm_name }}</div> <div class="organization-name organization-name-delayed-tooltip">{{ realm_name }}</div>
<div class="organization-path">{{ realm_url }}</div> <div class="organization-path">{{ realm_url }}</div>
</div> </div>
{% endif %} {% endif %}

View File

@ -1,6 +1,8 @@
import $ from "jquery"; import $ from "jquery";
import * as tippy from "tippy.js"; import * as tippy from "tippy.js";
const LONG_HOVER_DELAY: [number, number] = [750, 20];
function initialize(): void { function initialize(): void {
tippy.default("[data-tippy-content]", { tippy.default("[data-tippy-content]", {
// Same defaults as set in web app tippyjs module. // Same defaults as set in web app tippyjs module.
@ -11,6 +13,18 @@ function initialize(): void {
animation: true, animation: true,
placement: "bottom", placement: "bottom",
}); });
tippy.default(".organization-name-delayed-tooltip", {
maxWidth: 300,
delay: LONG_HOVER_DELAY,
touch: ["hold", 750],
animation: true,
placement: "bottom",
onShow(instance) {
const content = $(instance.reference).text();
instance.setContent(content);
},
});
} }
$(() => { $(() => {