Skip to content

Commit bfc5e3f

Browse files
committed
topbar section added.
1 parent e624330 commit bfc5e3f

File tree

14 files changed

+101
-100
lines changed

14 files changed

+101
-100
lines changed

src/AbpCompanyName.AbpProjectName.EntityFramework/Migrations/SeedData/DefaultLanguagesCreator.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ static DefaultLanguagesCreator()
1515
{
1616
InitialLanguages = new List<ApplicationLanguage>
1717
{
18-
new ApplicationLanguage(null, "en", "English", "famfamfam-flag-gb"),
19-
new ApplicationLanguage(null, "tr", "Türkçe", "famfamfam-flag-tr"),
20-
new ApplicationLanguage(null, "zh-CN", "简体中文", "famfamfam-flag-cn"),
21-
new ApplicationLanguage(null, "pt-BR", "Português-BR", "famfamfam-flag-br"),
22-
new ApplicationLanguage(null, "es", "Español", "famfamfam-flag-es"),
23-
new ApplicationLanguage(null, "fr", "Français", "famfamfam-flag-fr"),
24-
new ApplicationLanguage(null, "it", "Italiano", "famfamfam-flag-it"),
25-
new ApplicationLanguage(null, "ja", "日本語", "famfamfam-flag-jp"),
18+
new ApplicationLanguage(null, "en", "English", "famfamfam-flags gb"),
19+
new ApplicationLanguage(null, "tr", "Türkçe", "famfamfam-flags tr"),
20+
new ApplicationLanguage(null, "zh-CN", "简体中文", "famfamfam-flags cn"),
21+
new ApplicationLanguage(null, "pt-BR", "Português-BR", "famfamfam-flags br"),
22+
new ApplicationLanguage(null, "es", "Español", "famfamfam-flags es"),
23+
new ApplicationLanguage(null, "fr", "Français", "famfamfam-flags fr"),
24+
new ApplicationLanguage(null, "it", "Italiano", "famfamfam-flags it"),
25+
new ApplicationLanguage(null, "ja", "日本語", "famfamfam-flags jp"),
2626
};
2727
}
2828

src/AbpCompanyName.AbpProjectName.Web/Controllers/LayoutController.cs

Lines changed: 0 additions & 77 deletions
This file was deleted.

src/AbpCompanyName.AbpProjectName.Web/Views/About/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ViewBag.ActiveMenu = "About"; //The menu item will be active for this page.
2+
ViewBag.CurrentPageName = "About"; //The menu item will be active for this page.
33
}
44
<div>
55
<div class="row">

src/AbpCompanyName.AbpProjectName.Web/Views/Home/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ViewBag.ActiveMenu = "Home"; //The menu item will be active for this page.
2+
ViewBag.CurrentPageName = "Home"; //The menu item will be active for this page.
33
}
44
<h1>@L("WellcomeMessage")</h1>
55
<div class="row">

src/AbpCompanyName.AbpProjectName.Web/Views/Layout/_LanguageSelection.cshtml renamed to src/AbpCompanyName.AbpProjectName.Web/Views/Shared/Components/LanguageSelection/Default.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@model AbpCompanyName.AbpProjectName.WebMpa.Models.Layout.LanguageSelectionViewModel
1+
@model AbpCompanyName.AbpProjectName.Web.Views.Shared.Components.LanguageSelection.LanguageSelectionViewModel
22
<li class="dropdown">
33
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
44
<i class="@Model.CurrentLanguage.Icon"></i>
@@ -10,7 +10,7 @@
1010
{
1111
if (language.Name != Model.CurrentLanguage.Name)
1212
{
13-
<li><a href="@(ApplicationPath)AbpLocalization/ChangeCulture?cultureName=@(language.Name)&returnUrl=@(Request.Url)"><i class="@language.Icon"></i> @language.DisplayName</a></li>
13+
<li><a href="@(ApplicationPath)AbpLocalization/ChangeCulture?cultureName=@(language.Name)&returnUrl=@(Context.Request.Path)"><i class="@language.Icon"></i> @language.DisplayName</a></li>
1414
}
1515
}
1616
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Abp.Localization;
6+
using Microsoft.AspNetCore.Mvc;
7+
8+
namespace AbpCompanyName.AbpProjectName.Web.Views.Shared.Components.LanguageSelection
9+
{
10+
public class LanguageSelectionViewComponent: ViewComponent
11+
{
12+
private readonly ILocalizationManager _localizationManager;
13+
14+
public LanguageSelectionViewComponent(ILocalizationManager localizationManager)
15+
{
16+
_localizationManager = localizationManager;
17+
}
18+
19+
public IViewComponentResult Invoke()
20+
{
21+
var model = new LanguageSelectionViewModel
22+
{
23+
CurrentLanguage = _localizationManager.CurrentLanguage,
24+
Languages = _localizationManager.GetAllLanguages()
25+
};
26+
27+
return View(model);
28+
}
29+
}
30+
}

src/AbpCompanyName.AbpProjectName.Web/Models/Layout/LanguageSelectionViewModel.cs renamed to src/AbpCompanyName.AbpProjectName.Web/Views/Shared/Components/LanguageSelection/LanguageSelectionViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using Abp.Localization;
33

4-
namespace AbpCompanyName.AbpProjectName.Web.Models.Layout
4+
namespace AbpCompanyName.AbpProjectName.Web.Views.Shared.Components.LanguageSelection
55
{
66
public class LanguageSelectionViewModel
77
{

src/AbpCompanyName.AbpProjectName.Web/Views/Shared/Components/TopMenu/TopMenuViewComponent.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Threading.Tasks;
22
using Abp.Application.Navigation;
33
using Abp.Runtime.Session;
4-
using AbpCompanyName.AbpProjectName.Web.Models.Layout;
54
using Microsoft.AspNetCore.Mvc;
65

76
namespace AbpCompanyName.AbpProjectName.Web.Views.Shared.Components.TopMenu

src/AbpCompanyName.AbpProjectName.Web/Views/Layout/_UserMenuOrLoginLink.cshtml renamed to src/AbpCompanyName.AbpProjectName.Web/Views/Shared/Components/UserMenuOrLoginLink/Default.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@model AbpCompanyName.AbpProjectName.WebMpa.Models.Layout.UserMenuOrLoginLinkViewModel
1+
@model AbpCompanyName.AbpProjectName.Web.Views.Shared.Components.UserMenuOrLoginLink.UserMenuOrLoginLinkViewModel
22
@if (Model.LoginInformations != null)
33
{
44
<li class="dropdown">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using System.Threading.Tasks;
2+
using Abp.Configuration.Startup;
3+
using Abp.Runtime.Session;
4+
using AbpCompanyName.AbpProjectName.Sessions;
5+
using Microsoft.AspNetCore.Mvc;
6+
7+
namespace AbpCompanyName.AbpProjectName.Web.Views.Shared.Components.UserMenuOrLoginLink
8+
{
9+
public class UserMenuOrLoginLinkViewComponent : ViewComponent
10+
{
11+
private readonly IAbpSession _abpSession;
12+
private readonly ISessionAppService _sessionAppService;
13+
private readonly IMultiTenancyConfig _multiTenancyConfig;
14+
15+
public UserMenuOrLoginLinkViewComponent(
16+
IAbpSession abpSession,
17+
ISessionAppService sessionAppService,
18+
IMultiTenancyConfig multiTenancyConfig)
19+
{
20+
_abpSession = abpSession;
21+
_sessionAppService = sessionAppService;
22+
_multiTenancyConfig = multiTenancyConfig;
23+
}
24+
25+
public async Task<IViewComponentResult> InvokeAsync()
26+
{
27+
UserMenuOrLoginLinkViewModel model;
28+
29+
if (_abpSession.UserId.HasValue)
30+
{
31+
model = new UserMenuOrLoginLinkViewModel
32+
{
33+
LoginInformations = await _sessionAppService.GetCurrentLoginInformations(),
34+
IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled,
35+
};
36+
}
37+
else
38+
{
39+
model = new UserMenuOrLoginLinkViewModel
40+
{
41+
IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled
42+
};
43+
}
44+
45+
return View(model);
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)