mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 05:29:17 -06:00
FIX: Support RTL languages in header menu
This commit is contained in:
parent
d2569f8e77
commit
5358f25fc6
@ -52,6 +52,22 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_isRTL() {
|
||||||
|
return $("html").css("direction") === "rtl";
|
||||||
|
},
|
||||||
|
|
||||||
|
_leftMenuClass() {
|
||||||
|
return this._isRTL() ? ".user-menu" : ".hamburger-panel";
|
||||||
|
},
|
||||||
|
|
||||||
|
_leftMenuAction() {
|
||||||
|
return this._isRTL() ? "toggleUserMenu" : "toggleHamburger";
|
||||||
|
},
|
||||||
|
|
||||||
|
_rightMenuAction() {
|
||||||
|
return this._isRTL() ? "toggleHamburger" : "toggleUserMenu";
|
||||||
|
},
|
||||||
|
|
||||||
_handlePanDone(offset, event) {
|
_handlePanDone(offset, event) {
|
||||||
const $window = $(window);
|
const $window = $(window);
|
||||||
const windowWidth = parseInt($window.width());
|
const windowWidth = parseInt($window.width());
|
||||||
@ -120,7 +136,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||||||
this._panMenuOffset = -SCREEN_OFFSET;
|
this._panMenuOffset = -SCREEN_OFFSET;
|
||||||
this._isPanning = true;
|
this._isPanning = true;
|
||||||
$("header.d-header").removeClass("scroll-down scroll-up");
|
$("header.d-header").removeClass("scroll-down scroll-up");
|
||||||
this.eventDispatched("toggleHamburger", "header");
|
this.eventDispatched(this._leftMenuAction(), "header");
|
||||||
} else if (
|
} else if (
|
||||||
windowWidth - center.x < SCREEN_EDGE_MARGIN &&
|
windowWidth - center.x < SCREEN_EDGE_MARGIN &&
|
||||||
!this.$(".menu-panel").length &&
|
!this.$(".menu-panel").length &&
|
||||||
@ -131,7 +147,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||||||
this._panMenuOffset = -SCREEN_OFFSET;
|
this._panMenuOffset = -SCREEN_OFFSET;
|
||||||
this._isPanning = true;
|
this._isPanning = true;
|
||||||
$("header.d-header").removeClass("scroll-down scroll-up");
|
$("header.d-header").removeClass("scroll-down scroll-up");
|
||||||
this.eventDispatched("toggleUserMenu", "header");
|
this.eventDispatched(this._rightMenuAction(), "header");
|
||||||
} else {
|
} else {
|
||||||
this._isPanning = false;
|
this._isPanning = false;
|
||||||
}
|
}
|
||||||
@ -298,7 +314,7 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
|||||||
$headerCloak.css("opacity", 0);
|
$headerCloak.css("opacity", 0);
|
||||||
if (
|
if (
|
||||||
this.site.mobileView &&
|
this.site.mobileView &&
|
||||||
$panel.parent(".hamburger-panel").length > 0
|
$panel.parent(this._leftMenuClass()).length > 0
|
||||||
) {
|
) {
|
||||||
this._panMenuOrigin = "left";
|
this._panMenuOrigin = "left";
|
||||||
$panel.css("left", -windowWidth);
|
$panel.css("left", -windowWidth);
|
||||||
|
Loading…
Reference in New Issue
Block a user