Browse Source

Add AbpApplicationPathViewComponent

pull/4101/head
liangshiwei 6 years ago
parent
commit
e35b7c6df0
  1. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/Default.cshtml
  2. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml
  3. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml
  4. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
  5. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
  6. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
  7. 1
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/_ViewImports.cshtml
  8. 19
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpApplicationPath/AbpApplicationPathViewComponent.cs
  9. 7
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpApplicationPath/AbpApplicationPathViewComponentModel.cs
  10. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpApplicationPath/Default.cshtml
  11. 17
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpRazorPage.cs

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/Default.cshtml

@ -5,12 +5,13 @@
var elementId = string.IsNullOrEmpty(menuItem.ElementId) ? string.Empty : $"id=\"{menuItem.ElementId}\"";
var cssClass = string.IsNullOrEmpty(menuItem.CssClass) ? string.Empty : menuItem.CssClass;
var disabled = menuItem.IsDisabled ? "disabled" : string.Empty;
var url = string.IsNullOrEmpty(menuItem.Url) ? "#" : Url.Content(menuItem.Url);
if (menuItem.IsLeaf)
{
if (menuItem.Url != null)
{
<li class="nav-item @cssClass @disabled" @elementId>
<a class="nav-link" href="@Url.Content(menuItem.Url ?? "#")">
<a class="nav-link" href="@url">
@if (menuItem.Icon != null)
{
if (menuItem.Icon.StartsWith("fa"))

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml

@ -4,12 +4,13 @@
var elementId = string.IsNullOrEmpty(Model.ElementId) ? string.Empty : $"id=\"{Model.ElementId}\"";
var cssClass = string.IsNullOrEmpty(Model.CssClass) ? string.Empty : Model.CssClass;
var disabled = Model.IsDisabled ? "disabled" : string.Empty;
var url = string.IsNullOrEmpty(Model.Url) ? "#" : Url.Content(Model.Url);
}
@if (Model.IsLeaf)
{
if (Model.Url != null)
{
<a class="dropdown-item @cssClass @disabled" href="@Url.Content(Model.Url ?? "#")" @Html.Raw(elementId)>
<a class="dropdown-item @cssClass @disabled" href="@url" @Html.Raw(elementId)>
@if (Model.Icon != null)
{
if (Model.Icon.StartsWith("fa"))

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml

@ -27,8 +27,9 @@
var elementId = string.IsNullOrEmpty(menuItem.ElementId) ? string.Empty : $"id=\"{menuItem.ElementId}\"";
var cssClass = string.IsNullOrEmpty(menuItem.CssClass) ? string.Empty : menuItem.CssClass;
var disabled = menuItem.IsDisabled ? "disabled" : string.Empty;
var url = string.IsNullOrEmpty(menuItem.Url) ? "#" : Url.Content(menuItem.Url);
<a class="dropdown-item @cssClass @disabled" href="@Url.Content(menuItem.Url ?? "#")" target="@menuItem.Target" @Html.Raw(elementId)>
<a class="dropdown-item @cssClass @disabled" href="@url" target="@menuItem.Target" @Html.Raw(elementId)>
@if (menuItem.Icon != null)
{
if (menuItem.Icon.StartsWith("fa"))

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml

@ -46,10 +46,6 @@
@await Component.InvokeAsync(typeof(WidgetStylesViewComponent))
<script type="text/javascript">
var abp = abp || {}; abp.appPath = '@ApplicationPath';
</script>
@await Component.InvokeLayoutHookAsync(LayoutHooks.Head.Last, StandardLayouts.Account)
</head>
<body class="abp-account-layout bg-light">

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml

@ -48,10 +48,6 @@
@await RenderSectionAsync("styles", false)
<script type="text/javascript">
var abp = abp || {}; abp.appPath = '@ApplicationPath';
</script>
@await Component.InvokeLayoutHookAsync(LayoutHooks.Head.Last, StandardLayouts.Application)
</head>
<body class="abp-application-layout bg-light">

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml

@ -50,10 +50,6 @@
@await RenderSectionAsync("styles", false)
<script type="text/javascript">
var abp = abp || {}; abp.appPath = '@ApplicationPath';
</script>
@await Component.InvokeLayoutHookAsync(LayoutHooks.Head.Last, StandardLayouts.Empty)
</head>
<body class="abp-empty-layout">

1
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/_ViewImports.cshtml

@ -1,5 +1,4 @@
@using System.Globalization
@inherits Volo.Abp.AspNetCore.Mvc.UI.RazorPages.AbpRazorPage<TModel>
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling

19
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpApplicationPath/AbpApplicationPathViewComponent.cs

@ -0,0 +1,19 @@
using System;
using Microsoft.AspNetCore.Mvc;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpApplicationPath
{
public class AbpApplicationPathViewComponent : AbpViewComponent
{
public IViewComponentResult Invoke()
{
var applicationPath = ViewContext.HttpContext.Request.PathBase.Value;
var model = new AbpApplicationPathViewComponentModel
{
ApplicationPath = applicationPath == null ? "/" : applicationPath.EnsureEndsWith('/')
};
return View("~/Pages/Shared/Components/AbpApplicationPath/Default.cshtml",model);
}
}
}

7
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpApplicationPath/AbpApplicationPathViewComponentModel.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpApplicationPath
{
public class AbpApplicationPathViewComponentModel
{
public string ApplicationPath { get; set; }
}
}

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpApplicationPath/Default.cshtml

@ -0,0 +1,4 @@
@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpApplicationPath.AbpApplicationPathViewComponentModel
<script type="text/javascript">
var abp = abp || {}; abp.appPath = '@Model.ApplicationPath';
</script>

17
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpRazorPage.cs

@ -1,17 +0,0 @@
using System;
using Microsoft.AspNetCore.Mvc.Razor;
namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages
{
public abstract class AbpRazorPage<TModel> : RazorPage<TModel>
{
public string ApplicationPath
{
get
{
string str = ViewContext.HttpContext.Request.PathBase.Value;
return str == null ? "/" : str.EnsureEndsWith('/');
}
}
}
}
Loading…
Cancel
Save