Browse Source
Add option to support adding `base` element to layout page.
pull/22598/head
maliming
10 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
6 changed files with
35 additions and
4 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/AbpThemingOptions.cs
-
framework/src/Volo.Abp.Swashbuckle/wwwroot/swagger/ui/abp.js
-
modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
-
modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
-
modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
-
npm/packs/core/src/abp.js
|
|
|
@ -6,6 +6,12 @@ public class AbpThemingOptions |
|
|
|
|
|
|
|
public string? DefaultThemeName { get; set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// If set, the <c>base</c> element will be added to the <c>head</c> element of the page.
|
|
|
|
/// eg: <base href="/BaseUrl/" />
|
|
|
|
/// </summary>
|
|
|
|
public string? BaseUrl { get; set; } |
|
|
|
|
|
|
|
public AbpThemingOptions() |
|
|
|
{ |
|
|
|
Themes = new ThemeDictionary(); |
|
|
|
|
|
|
|
@ -4,7 +4,9 @@ var abp = abp || {}; |
|
|
|
/* Application paths *****************************************/ |
|
|
|
|
|
|
|
//Current application root path (including virtual directory if exists).
|
|
|
|
abp.appPath = abp.appPath || '/'; |
|
|
|
var baseElement = document.querySelector('base'); |
|
|
|
var baseHref = baseElement ? baseElement.getAttribute('href') : null; |
|
|
|
abp.appPath = baseHref || abp.appPath || '/'; |
|
|
|
|
|
|
|
/* UTILS ***************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
@ -18,6 +18,7 @@ |
|
|
|
@inject ICurrentTenant CurrentTenant |
|
|
|
@inject IStringLocalizer<AbpUiMultiTenancyResource> MultiTenancyStringLocalizer |
|
|
|
@inject ITenantResolveResultAccessor TenantResolveResultAccessor |
|
|
|
@inject IOptions<AbpThemingOptions> ThemingOptions |
|
|
|
|
|
|
|
@{ |
|
|
|
Layout = null; |
|
|
|
@ -34,6 +35,10 @@ |
|
|
|
<meta charset="utf-8"> |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
|
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge"> |
|
|
|
@if (!ThemingOptions.Value.BaseUrl.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
<base href="@ThemingOptions.Value.BaseUrl" /> |
|
|
|
} |
|
|
|
|
|
|
|
<title>@(ViewBag.Title == null ? BrandingProvider.AppName : ViewBag.Title)</title> |
|
|
|
|
|
|
|
|
|
|
|
@ -1,4 +1,6 @@ |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook |
|
|
|
@using Microsoft.Extensions.Options |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.ContentTitle |
|
|
|
@ -12,6 +14,8 @@ |
|
|
|
@using Volo.Abp.Ui.LayoutHooks |
|
|
|
@inject IBrandingProvider BrandingProvider |
|
|
|
@inject IPageLayout PageLayout |
|
|
|
@inject IOptions<AbpThemingOptions> ThemingOptions |
|
|
|
|
|
|
|
@{ |
|
|
|
Layout = null; |
|
|
|
var containerClass = ViewBag.FluidLayout == true ? "container-fluid" : "container"; //TODO: Better and type-safe options |
|
|
|
@ -40,6 +44,10 @@ |
|
|
|
<meta charset="utf-8"> |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
|
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge"> |
|
|
|
@if (!ThemingOptions.Value.BaseUrl.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
<base href="@ThemingOptions.Value.BaseUrl" /> |
|
|
|
} |
|
|
|
|
|
|
|
<title>@pageTitle</title> |
|
|
|
|
|
|
|
|
|
|
|
@ -1,4 +1,6 @@ |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook |
|
|
|
@using Microsoft.Extensions.Options |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.PageAlerts |
|
|
|
@ -10,6 +12,8 @@ |
|
|
|
@using Volo.Abp.Ui.LayoutHooks |
|
|
|
@inject IBrandingProvider BrandingProvider |
|
|
|
@inject IPageLayout PageLayout |
|
|
|
@inject IOptions<AbpThemingOptions> ThemingOptions |
|
|
|
|
|
|
|
@{ |
|
|
|
Layout = null; |
|
|
|
var containerClass = ViewBag.FluidLayout == true ? "container-fluid" : "container"; //TODO: Better and type-safe options |
|
|
|
@ -38,6 +42,10 @@ |
|
|
|
<meta charset="utf-8"> |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
|
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge"> |
|
|
|
@if (!ThemingOptions.Value.BaseUrl.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
<base href="@ThemingOptions.Value.BaseUrl" /> |
|
|
|
} |
|
|
|
|
|
|
|
<title>@pageTitle</title> |
|
|
|
@if (ViewBag.Description != null) |
|
|
|
|
|
|
|
@ -4,7 +4,9 @@ var abp = abp || {}; |
|
|
|
/* Application paths *****************************************/ |
|
|
|
|
|
|
|
//Current application root path (including virtual directory if exists).
|
|
|
|
abp.appPath = abp.appPath || '/'; |
|
|
|
var baseElement = document.querySelector('base'); |
|
|
|
var baseHref = baseElement ? baseElement.getAttribute('href') : null; |
|
|
|
abp.appPath = baseHref || abp.appPath || '/'; |
|
|
|
|
|
|
|
abp.pageLoadTime = new Date(); |
|
|
|
|
|
|
|
|