-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TheAdmin & TheTheme for RTL languages (#14486)
- Loading branch information
1 parent
d94059f
commit ef11011
Showing
23 changed files
with
13,366 additions
and
932 deletions.
There are no files selected for viewing
58 changes: 27 additions & 31 deletions
58
src/OrchardCore.Modules/OrchardCore.Localization/Views/AdminCulturePicker.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,38 @@ | ||
@using OrchardCore.Localization | ||
@using OrchardCore.Environment.Shell | ||
|
||
@model AdminCulturePickerViewModel | ||
|
||
@inject ShellSettings ShellSettings | ||
|
||
@{ | ||
var cookieName = AdminCookieCultureProvider.MakeCookieName(ShellSettings); | ||
var cookiePath = AdminCookieCultureProvider.MakeCookiePath(Context); | ||
var selectedCultureName = Model.CurrentCulture.Name; | ||
} | ||
|
||
<li class="nav-item"> | ||
<select id="oc-admin-culture-picker" class="form-select me-3" | ||
data-cookie-name="@cookieName" | ||
data-cookie-path="@cookiePath" | ||
data-selected-culture="@selectedCultureName"> | ||
|
||
@foreach (var culture in Model.SupportedCultures) | ||
{ | ||
<option selected="@(culture.Name == selectedCultureName ? "selected" : null)" value="@culture.Name">@culture.NativeName</option> | ||
} | ||
</select> | ||
<div class="dropdown"> | ||
<button type="button" class="nav-link dropdown-toggle" id="oc-culture-picker" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-language-current-value="@Model.CurrentCulture.Name" data-cookie-name="@AdminCookieCultureProvider.MakeCookieName(ShellSettings)" data-cookie-path="@AdminCookieCultureProvider.MakeCookiePath(Context)">@Model.CurrentCulture.NativeName</button> | ||
<ul class="dropdown-menu dropdown-menu-end position-absolute" aria-labelledby="oc-culture-picker"> | ||
@foreach (var culture in Model.SupportedCultures) | ||
{ | ||
if (culture.Name != Model.CurrentCulture.Name) | ||
{ | ||
<li> | ||
<div class="language-menu-item dropdown-item" data-language-value="@culture.Name">@culture.NativeName</div> | ||
</li> | ||
} | ||
} | ||
</ul> | ||
</div> | ||
</li> | ||
|
||
<script at="Foot" depends-on="jquery"> | ||
$(function () { | ||
$('#oc-admin-culture-picker').change(function () { | ||
var $this = $(this); | ||
var culture = $this.val(); | ||
var selectedCulture = $this.data('selected-culture'); | ||
if (culture != selectedCulture) { | ||
var cookieName = $this.data('cookie-name'); | ||
var cookiePath = $this.data('cookie-path'); | ||
var cookieValue = `${cookieName}=c=${culture}|uic=${culture};path=${cookiePath}`; | ||
document.cookie = cookieValue; | ||
<script at="Foot" asp-name="AdminCultureSelector" depends-on="js-cookie"> | ||
document.addEventListener('DOMContentLoaded', function (e) { | ||
const picker = document.getElementById('oc-culture-picker'); | ||
const cookieName = picker.getAttribute('data-cookie-name'); | ||
const cookiePath = picker.getAttribute('data-cookie-path'); | ||
const items = document.getElementsByClassName('language-menu-item'); | ||
for (let i = 0; i < items.length; i++) { | ||
let item = items[i]; | ||
let culture = item.getAttribute('data-language-value'); | ||
item.addEventListener('click', function () { | ||
Cookies.set(cookieName, `c=${culture}|uic=${culture}`, { path: cookiePath }); | ||
window.location = window.location.href; | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,6 +198,13 @@ ResourceManifest BuildManifest() | |
.SetCdnIntegrity("sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN", "sha384-8dbpXuP2nso7zrhApj0aSxeb0ZitbTeO0hTKxRcXavYE0vv4nhBEqvv+o+0X94A8") | ||
.SetVersion("5.3.2"); | ||
|
||
manifest | ||
.DefineStyle("bootstrap-rtl") | ||
.SetUrl("~/OrchardCore.Resources/Styles/bootstrap.rtl.min.css", "~/OrchardCore.Resources/Styles/bootstrap.rtl.css") | ||
.SetCdn("https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.rtl.min.css", "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.rtl.css") | ||
.SetCdnIntegrity("sha384-nU14brUcp6StFntEOOEBvcJm4huWjB0OcIeQ3fltAfSmuZFrkAif0T+UtNGlKKQv", "sha384-CEku08bnqQAT/vzi6/zxMQmSyxoOTK1jx7mbT8P7etf/YhPbxASCX5BIVuAK9sfy") | ||
.SetVersion("5.3.2"); | ||
|
||
manifest | ||
.DefineStyle("bootstrap-select") | ||
.SetUrl("~/OrchardCore.Resources/Styles/bootstrap-select.min.css", "~/OrchardCore.Resources/Styles/bootstrap-select.css") | ||
|
Oops, something went wrong.