From 867370c9a7034daf17ba48f72bc612e4d668ad8a Mon Sep 17 00:00:00 2001 From: sk-ys Date: Sun, 3 Nov 2024 08:57:39 +0000 Subject: [PATCH] Fix RTL design in calendar view --- .../calendars/_custom_calendar.html.erb | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/app/views/enhanced_ux/calendars/_custom_calendar.html.erb b/app/views/enhanced_ux/calendars/_custom_calendar.html.erb index 29d2962..14dbed7 100644 --- a/app/views/enhanced_ux/calendars/_custom_calendar.html.erb +++ b/app/views/enhanced_ux/calendars/_custom_calendar.html.erb @@ -29,6 +29,8 @@ ...(resourcesAll[document.documentElement.lang] || {}), }; + const isRtl = $('head link[rel="stylesheet"][href*="/rtl"]').length > 0; + const csrfToken = $('meta[name="csrf-token"]').attr("content"); const homeUrl = $("link[href*='favicon.ico']") @@ -406,7 +408,13 @@ }); } $("#countdown_timer .countdown_timer_label").text( - direction === "next" ? "⇨" : "⇦" + isRtl + ? direction === "next" + ? "⇦" + : "⇨" + : direction === "next" + ? "⇨" + : "⇦" ); $("#countdown_timer").show(); $(document).on("mousemove.countdown_timer", (e) => { @@ -705,7 +713,7 @@ background-repeat: no-repeat; padding-left: 20px; cursor: pointer; - margin-left: 10px; + margin: 0 10px; font-weight: normal; } @@ -922,4 +930,25 @@ } } } + + /* Support RTL */ + html[dir="rtl"], + html:has(head link[rel="stylesheet"][href*="/rtl"]) { + @media screen and (min-width: 900px) { + #content { + & > div.contextual { + left: 15px; + right: auto; + } + } + } + #dSwitchNext { + left: 0; + right: auto; + } + #dSwitchPrev { + left: auto; + right: 0; + } + }