UX: Position topic admin menu next to wrench (#9932)
This commit is contained in:
parent
e1af91f5ae
commit
f2647f1f36
|
@ -90,19 +90,31 @@ createWidget("topic-admin-menu-button", {
|
||||||
$button = $(e.target).closest("button");
|
$button = $(e.target).closest("button");
|
||||||
}
|
}
|
||||||
|
|
||||||
const position = $button.position();
|
const position = $button.position(),
|
||||||
|
SPACING = 3,
|
||||||
|
MENU_WIDTH = 217;
|
||||||
|
|
||||||
const rtl = $("html").hasClass("rtl");
|
const rtl = $("html").hasClass("rtl");
|
||||||
position.outerHeight = $button.outerHeight();
|
position.outerHeight = $button.outerHeight();
|
||||||
|
|
||||||
if (rtl) {
|
if (rtl) {
|
||||||
position.left -= 217 - $button.outerWidth();
|
position.left -= MENU_WIDTH - $button.outerWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.attrs.fixed) {
|
if (this.attrs.fixed) {
|
||||||
position.left += $button.width() - 203;
|
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) {
|
if (this.site.mobileView && !this.attrs.rightSide) {
|
||||||
const headerCloak = document.querySelector(".header-cloak");
|
const headerCloak = document.querySelector(".header-cloak");
|
||||||
if (headerCloak) headerCloak.style.display = "block";
|
if (headerCloak) headerCloak.style.display = "block";
|
||||||
|
|
Loading…
Reference in New Issue