From 496b403fcf9ed73f434043abde3eedcb6bf59102 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 27 Apr 2023 17:19:36 -0700 Subject: [PATCH] tooltips: Add new central tooltip template store. We should migrate all the static content tooltip templates to this file to avoid duplicate DOM elements. --- templates/zerver/app/index.html | 1 + web/src/tippyjs.js | 3 +++ web/templates/message_body.hbs | 4 ---- web/templates/tooltip_templates.hbs | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 web/templates/tooltip_templates.hbs diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html index e33027d35b..e18b33c39b 100644 --- a/templates/zerver/app/index.html +++ b/templates/zerver/app/index.html @@ -106,6 +106,7 @@ +
diff --git a/web/src/tippyjs.js b/web/src/tippyjs.js index 3439727bcd..1facc181b7 100644 --- a/web/src/tippyjs.js +++ b/web/src/tippyjs.js @@ -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_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 {$t} from "./i18n"; @@ -107,6 +108,8 @@ tippy.setDefaultProps({ }); export function initialize() { + $("#tooltip-templates-container").html(render_tooltip_templates()); + // Our default tooltip configuration. For this, one simply needs to: // * Set `class="tippy-zulip-tooltip"` on an element for enable this. // * Set `data-tippy-content="{{t 'Tooltip content' }}"`, often diff --git a/web/templates/message_body.hbs b/web/templates/message_body.hbs index afa17b532e..3ff5620c13 100644 --- a/web/templates/message_body.hbs +++ b/web/templates/message_body.hbs @@ -7,10 +7,6 @@ {{msg/sender_full_name}}{{> status_emoji msg/status_emoji_info}} - {{#if sender_is_bot}} {{/if}} diff --git a/web/templates/tooltip_templates.hbs b/web/templates/tooltip_templates.hbs new file mode 100644 index 0000000000..6d65c8a2a8 --- /dev/null +++ b/web/templates/tooltip_templates.hbs @@ -0,0 +1,4 @@ +