From f2647f1f36c95db004f6054a8db12311d8b2b890 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Sat, 30 May 2020 15:32:57 -0400 Subject: [PATCH] UX: Position topic admin menu next to wrench (#9932) --- .../discourse/app/widgets/topic-admin-menu.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js b/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js index 4d0ea65734d..2ba85dabc8d 100644 --- a/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js +++ b/app/assets/javascripts/discourse/app/widgets/topic-admin-menu.js @@ -90,19 +90,31 @@ createWidget("topic-admin-menu-button", { $button = $(e.target).closest("button"); } - const position = $button.position(); + const position = $button.position(), + SPACING = 3, + MENU_WIDTH = 217; const rtl = $("html").hasClass("rtl"); position.outerHeight = $button.outerHeight(); if (rtl) { - position.left -= 217 - $button.outerWidth(); + position.left -= MENU_WIDTH - $button.outerWidth(); } if (this.attrs.fixed) { position.left += $button.width() - 203; } + if (this.attrs.openUpwards) { + if (rtl) { + position.left -= $button[0].offsetWidth + SPACING; + } else { + position.left += $button[0].offsetWidth + SPACING; + } + } else { + position.top += $button[0].offsetHeight + SPACING; + } + if (this.site.mobileView && !this.attrs.rightSide) { const headerCloak = document.querySelector(".header-cloak"); if (headerCloak) headerCloak.style.display = "block";