mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Adding culture selector to Admin theme
This commit is contained in:
@@ -212,7 +212,7 @@ form.link button:hover, button.link:hover {
|
|||||||
ol.decimal {list-style:decimal inside; margin:12px 0;}
|
ol.decimal {list-style:decimal inside; margin:12px 0;}
|
||||||
ul.disc {list-style:disc inside; margin:12px 0;}
|
ul.disc {list-style:disc inside; margin:12px 0;}
|
||||||
|
|
||||||
/* Header - Branding and Login
|
/* Header - Branding, Login and Culture Selection
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
#header {
|
#header {
|
||||||
height:50px;
|
height:50px;
|
||||||
@@ -226,6 +226,10 @@ ul.disc {list-style:disc inside; margin:12px 0;}
|
|||||||
height:50px;
|
height:50px;
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
#culture-selection {
|
||||||
|
float: right;
|
||||||
|
margin: 10px 20px 0 0;
|
||||||
|
}
|
||||||
#header #app {
|
#header #app {
|
||||||
float:left;
|
float:left;
|
||||||
font-size:2.4em;
|
font-size:2.4em;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@model dynamic
|
@model dynamic
|
||||||
|
@using Orchard.Environment.Descriptor.Models
|
||||||
@using Orchard.Security;
|
@using Orchard.Security;
|
||||||
@using Orchard.DisplayManagement.Descriptors;
|
@using Orchard.DisplayManagement.Descriptors;
|
||||||
@using Orchard.UI.Resources;
|
@using Orchard.UI.Resources;
|
||||||
@@ -27,6 +28,10 @@
|
|||||||
Model.Header.Add(Display.Header());
|
Model.Header.Add(Display.Header());
|
||||||
|
|
||||||
Model.Header.Add(Display.User(CurrentUser: WorkContext.CurrentUser));
|
Model.Header.Add(Display.User(CurrentUser: WorkContext.CurrentUser));
|
||||||
|
|
||||||
|
var shellDescriptor = WorkContext.Resolve<ShellDescriptor>();
|
||||||
|
if (shellDescriptor.Features.Any(x => x.Name == "Orchard.Localization.CutlureSelector")) { Model.Header.Add(Display.UICultureSelector()); }
|
||||||
|
|
||||||
Model.Footer.Add(Display.OrchardVersion());
|
Model.Footer.Add(Display.OrchardVersion());
|
||||||
|
|
||||||
if (Model.Title != null) {
|
if (Model.Title != null) {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
@using System.Globalization
|
||||||
|
@using Orchard.Localization.Services
|
||||||
|
@{
|
||||||
|
var currentCulture = WorkContext.CurrentCulture;
|
||||||
|
var supportedCultures = WorkContext.Resolve<ICultureManager>().ListCultures();
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (supportedCultures.Count() > 1) {
|
||||||
|
<div id="culture-selection">
|
||||||
|
<select>
|
||||||
|
@foreach (var supportedCulure in supportedCultures) {
|
||||||
|
var cultureInfo = CultureInfo.GetCultureInfo(supportedCulure);
|
||||||
|
var url = Url.Action("SetCulture", "CutlureSelector", new { area = "Orchard.Localization", culture = supportedCulure, returnUrl = Html.ViewContext.HttpContext.Request.RawUrl });
|
||||||
|
|
||||||
|
<option @if (supportedCulure.Equals(currentCulture)) { <text> selected="selected" </text> } value="@url">
|
||||||
|
@cultureInfo.DisplayName
|
||||||
|
</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@using (Script.Foot()) {
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
(function ($) {
|
||||||
|
$("#culture-selection").change(function (e) {
|
||||||
|
window.location = $("#culture-selection > select > option:selected")[0].value;
|
||||||
|
});
|
||||||
|
})(jQuery);
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
}
|
||||||
@@ -169,6 +169,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="TheAdmin\Views\ErrorPage.cshtml" />
|
<Content Include="TheAdmin\Views\ErrorPage.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="TheAdmin\Views\UICultureSelector.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
|||||||
Reference in New Issue
Block a user