Browse Source

Moved layout to bootstrap dll.

pull/81/head
Halil İbrahim Kalkan 10 years ago
parent
commit
a6d406ee8f
  1. 2
      src/AbpDesk/AbpDesk.Web.Mvc/Views/_ViewStart.cshtml
  2. 53
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml
  3. 17
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/_AppLayout.cshtml
  4. 3
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/_AppLayout.css
  5. 1
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/_ViewImports.cshtml
  6. 5
      src/Volo.Abp/Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs

2
src/AbpDesk/AbpDesk.Web.Mvc/Views/_ViewStart.cshtml

@ -1,3 +1,3 @@
@{ @{
Layout = "~/Views/Shared/_Layout.cshtml"; Layout = "~/Views/Shared/_AppLayout.cshtml";
} }

53
src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml

@ -1,22 +1,39 @@
@using System.Threading.Tasks @using System.Threading.Tasks
@model Volo.Abp.UI.Navigation.ApplicationMenu @model Volo.Abp.UI.Navigation.ApplicationMenu
<h2>@Model.DisplayName (BOOTSTRAP)</h2> <nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse fixed-top">
<ul> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
@foreach (var menuItem in Model.Items) <span class="navbar-toggler-icon"></span>
{ </button>
<li> <a class="navbar-brand" href="#"><i>Project</i>Name</a>
<a href="@menuItem.Url">@menuItem.DisplayName</a> <div class="collapse navbar-collapse" id="navbarsExampleDefault">
@if (menuItem.Items.Any()) <ul class="navbar-nav mr-auto">
@foreach (var menuItem in Model.Items)
{ {
<ul> if (menuItem.IsLeaf)
@foreach (var childMenuItem in menuItem.Items) {
{ <li class="nav-item @(menuItem.IsDisabled ? "disabled" : "")">
<li> <!-- active -->
<a href="@childMenuItem.Url">@childMenuItem.DisplayName</a> <a class="nav-link" href="@(menuItem.Url ?? "#")">@menuItem.DisplayName</a> @*<span class="sr-only">(current)</span>*@
</li> </li>
} }
</ul> else
{
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="Menu_@(menuItem.Name)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">@menuItem.DisplayName</a>
<div class="dropdown-menu" aria-labelledby="Menu_@(menuItem.Name)">
@foreach (var childMenuItem in menuItem.Items)
{
<a class="dropdown-item" href="@(childMenuItem.Url ?? "#")">@childMenuItem.DisplayName</a>
}
</div>
</li>
}
} }
</li> </ul>
} <form class="form-inline my-2 my-lg-0">
</ul> <input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>

17
src/AbpDesk/AbpDesk.Web.Mvc/Views/Shared/_Layout.cshtml → src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/_AppLayout.cshtml

@ -5,11 +5,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>title</title> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Fixed top navbar example for Bootstrap</title>
<vc:abp-style-bundle name="GlobalStyles"></vc:abp-style-bundle> <vc:abp-style-bundle name="GlobalStyles"></vc:abp-style-bundle>
<link rel="stylesheet" type="text/css" href="~/Views/Shared/_AppLayout.css"/>
@RenderSection("styles", false) @RenderSection("styles", false)
</head> </head>
@ -18,8 +23,10 @@
<!-- We should pass all optional parapeters because of a bug in MVC --> <!-- We should pass all optional parapeters because of a bug in MVC -->
<vc:abp-menu menu-name="@StandardMenus.Main" view-name="Default"></vc:abp-menu> <vc:abp-menu menu-name="@StandardMenus.Main" view-name="Default"></vc:abp-menu>
@RenderBody() <div class="container">
@RenderBody()
</div>
<vc:abp-script-bundle name="GlobalScripts"></vc:abp-script-bundle> <vc:abp-script-bundle name="GlobalScripts"></vc:abp-script-bundle>
</body> </body>

3
src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/_AppLayout.css

@ -0,0 +1,3 @@
body {
padding-top: 5rem;
}

1
src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/_ViewImports.cshtml

@ -0,0 +1 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

5
src/Volo.Abp/Volo/Abp/Ui/Navigation/ApplicationMenuItem.cs

@ -62,6 +62,11 @@ namespace Volo.Abp.UI.Navigation
[CanBeNull] [CanBeNull]
public string Target { get; set; } public string Target { get; set; }
/// <summary>
/// Can be used to disable this menu item.
/// </summary>
public bool IsDisabled { get; set; }
/// <inheritdoc cref="IHasMenuItems.Items"/> /// <inheritdoc cref="IHasMenuItems.Items"/>
[NotNull] [NotNull]
public IList<ApplicationMenuItem> Items { get; } public IList<ApplicationMenuItem> Items { get; }

Loading…
Cancel
Save