mirror of https://github.com/zulip/zulip.git
tooltips: Add new central tooltip template store.
We should migrate all the static content tooltip templates to this file to avoid duplicate DOM elements.
This commit is contained in:
parent
ea6ae50326
commit
496b403fcf
|
@ -106,6 +106,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="tooltip-templates-container"></div>
|
||||||
<div id="streams_overlay_container"></div>
|
<div id="streams_overlay_container"></div>
|
||||||
<div id="groups_overlay_container"></div>
|
<div id="groups_overlay_container"></div>
|
||||||
<div id="drafts_table"></div>
|
<div id="drafts_table"></div>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import tippy, {delegate} from "tippy.js";
|
||||||
|
|
||||||
import render_message_inline_image_tooltip from "../templates/message_inline_image_tooltip.hbs";
|
import render_message_inline_image_tooltip from "../templates/message_inline_image_tooltip.hbs";
|
||||||
import render_narrow_to_compose_recipients_tooltip from "../templates/narrow_to_compose_recipients_tooltip.hbs";
|
import render_narrow_to_compose_recipients_tooltip from "../templates/narrow_to_compose_recipients_tooltip.hbs";
|
||||||
|
import render_tooltip_templates from "../templates/tooltip_templates.hbs";
|
||||||
|
|
||||||
import * as compose_state from "./compose_state";
|
import * as compose_state from "./compose_state";
|
||||||
import {$t} from "./i18n";
|
import {$t} from "./i18n";
|
||||||
|
@ -107,6 +108,8 @@ tippy.setDefaultProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
export function initialize() {
|
export function initialize() {
|
||||||
|
$("#tooltip-templates-container").html(render_tooltip_templates());
|
||||||
|
|
||||||
// Our default tooltip configuration. For this, one simply needs to:
|
// Our default tooltip configuration. For this, one simply needs to:
|
||||||
// * Set `class="tippy-zulip-tooltip"` on an element for enable this.
|
// * Set `class="tippy-zulip-tooltip"` on an element for enable this.
|
||||||
// * Set `data-tippy-content="{{t 'Tooltip content' }}"`, often
|
// * Set `data-tippy-content="{{t 'Tooltip content' }}"`, often
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
<span class="sender_name_padding view_user_card_tooltip" data-tooltip-template-id="view-user-card-tooltip-template"></span>
|
<span class="sender_name_padding view_user_card_tooltip" data-tooltip-template-id="view-user-card-tooltip-template"></span>
|
||||||
<span class="view_user_card_tooltip" data-tooltip-template-id="view-user-card-tooltip-template">{{msg/sender_full_name}}{{> status_emoji msg/status_emoji_info}}</span>
|
<span class="view_user_card_tooltip" data-tooltip-template-id="view-user-card-tooltip-template">{{msg/sender_full_name}}{{> status_emoji msg/status_emoji_info}}</span>
|
||||||
</span>
|
</span>
|
||||||
<template id="view-user-card-tooltip-template">
|
|
||||||
{{t 'View user card' }}
|
|
||||||
{{tooltip_hotkey_hints "U"}}
|
|
||||||
</template>
|
|
||||||
{{#if sender_is_bot}}
|
{{#if sender_is_bot}}
|
||||||
<i class="zulip-icon zulip-icon-bot" aria-label="{{t 'Bot' }}"></i>
|
<i class="zulip-icon zulip-icon-bot" aria-label="{{t 'Bot' }}"></i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<template id="view-user-card-tooltip-template">
|
||||||
|
{{t 'View user card' }}
|
||||||
|
{{tooltip_hotkey_hints "U"}}
|
||||||
|
</template>
|
Loading…
Reference in New Issue