Browse Source

Change IdentityServer base theme

pull/41/head
Berkan Sasmaz 5 years ago
parent
commit
b2de501b33
  1. 1
      src/EventHub.IdentityServer/EventHub.IdentityServer.csproj
  2. 21
      src/EventHub.IdentityServer/EventHubIdentityServerModule.cs
  3. 33
      src/EventHub.IdentityServer/Pages/Index.cshtml
  4. 5
      src/EventHub.IdentityServer/Pages/Index.cshtml.cs
  5. 3
      src/EventHub.IdentityServer/wwwroot/assets/dropdown-arrow.svg
  6. BIN
      src/EventHub.IdentityServer/wwwroot/assets/seperator.png
  7. 3
      src/EventHub.IdentityServer/wwwroot/assets/seperator2.svg
  8. 4
      src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml
  9. 69
      src/EventHub.Web.Theme/Themes/EventHub/Components/MainNavbar/Default.cshtml

1
src/EventHub.IdentityServer/EventHub.IdentityServer.csproj

@ -46,6 +46,7 @@
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="4.2.1" />
<PackageReference Include="Volo.Abp.Account.Application" Version="4.2.1" />
<ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" />
<ProjectReference Include="..\EventHub.Web.Theme\EventHub.Web.Theme.csproj" />
</ItemGroup>
</Project>

21
src/EventHub.IdentityServer/EventHubIdentityServerModule.cs

@ -9,13 +9,13 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using EventHub.EntityFrameworkCore;
using EventHub.Localization;
using EventHub.Web.Theme;
using EventHub.Web.Theme.Bundling;
using StackExchange.Redis;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Auditing;
@ -35,7 +35,7 @@ namespace EventHub
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAccountWebIdentityServerModule),
typeof(AbpAccountApplicationModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(EventHubWebThemeModule),
typeof(EventHubEntityFrameworkCoreDbMigrationsModule),
typeof(AbpAspNetCoreSerilogModule)
)]
@ -56,25 +56,13 @@ namespace EventHub
typeof(AbpUiResource)
);
options.Languages.Add(new LanguageInfo("ar", "ar", "العربية"));
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština"));
options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)"));
options.Languages.Add(new LanguageInfo("fr", "fr", "Français"));
options.Languages.Add(new LanguageInfo("hu", "hu", "Magyar"));
options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português"));
options.Languages.Add(new LanguageInfo("ru", "ru", "Русский"));
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文"));
options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsch", "de"));
options.Languages.Add(new LanguageInfo("es", "es", "Español", "es"));
});
Configure<AbpBundlingOptions>(options =>
{
options.StyleBundles.Configure(
BasicThemeBundles.Styles.Global,
EventHubThemeBundles.Styles.Global,
bundle =>
{
bundle.AddFiles("/global-styles.css");
@ -94,6 +82,7 @@ namespace EventHub
{
options.FileSets.ReplaceEmbeddedByPhysical<EventHubDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}EventHub.Domain.Shared"));
options.FileSets.ReplaceEmbeddedByPhysical<EventHubDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}EventHub.Domain"));
options.FileSets.ReplaceEmbeddedByPhysical<EventHubWebThemeModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}EventHub.Web.Theme"));
});
}

33
src/EventHub.IdentityServer/Pages/Index.cshtml

@ -1,34 +1,3 @@
@page
@using EventHub.Pages
@using Volo.Abp.Users
@model IndexModel
@inject ICurrentUser CurrentUser
@if (CurrentUser.IsAuthenticated)
{
<div>
<abp-row>
<abp-column size-md="_3" class="text-center">
<i class="fa fa-user d-block" style="font-size: 10em; color: #12b900"></i>
<a abp-button="Primary" href="/Account/Logout">Logout</a>
</abp-column>
<abp-column size-md="_9">
<h2>@CurrentUser.UserName</h2>
<h5 class="text-muted">@CurrentUser.Email</h5>
<div>
<strong>Roles</strong>: @CurrentUser.Roles.JoinAsString(", ")
<br />
<strong>Claims</strong>: <br />
@Html.Raw(CurrentUser.GetAllClaims().Select(c => $"{c.Type}={c.Value}").JoinAsString(" <br /> "))
</div>
</abp-column>
</abp-row>
</div>
}
@if (!CurrentUser.IsAuthenticated)
{
<div class="text-center">
<i class="fa fa-user d-block" style="font-size: 10em; color: #aaa"></i><br/><br />
<a abp-button="Primary" asp-page="/Account/Login">Login</a>
</div>
}
@model IndexModel

5
src/EventHub.IdentityServer/Pages/Index.cshtml.cs

@ -1,11 +1,14 @@
using EventHub.Web;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace EventHub.Pages
{
public class IndexModel : AbpPageModel
{
public void OnGet()
public IActionResult OnGet()
{
return Redirect(EventHubExternalUrls.EhWww);
}
}
}

3
src/EventHub.IdentityServer/wwwroot/assets/dropdown-arrow.svg

@ -0,0 +1,3 @@
<svg width="6" height="4" viewBox="0 0 6 4" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.48367 0.0890989L3.00029 2.57308L0.516903 0.0887999C0.398503 -0.0296 0.206976 -0.0296 0.0885757 0.0887999C-0.0295252 0.2072 -0.0295252 0.399027 0.0885757 0.517427L2.78599 3.21573C2.90409 3.33413 3.09591 3.33413 3.21401 3.21573L5.91142 0.517451C6.02953 0.399052 6.02953 0.206926 5.91142 0.0885259C5.79362 -0.0293009 5.60177 -0.029301 5.48367 0.0890989Z" fill="#00044A"/>
</svg>

After

Width:  |  Height:  |  Size: 480 B

BIN
src/EventHub.IdentityServer/wwwroot/assets/seperator.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

3
src/EventHub.IdentityServer/wwwroot/assets/seperator2.svg

@ -0,0 +1,3 @@
<svg width="4" height="4" viewBox="0 0 4 4" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="2" cy="2" r="2" fill="white" fill-opacity="0.5"/>
</svg>

After

Width:  |  Height:  |  Size: 161 B

4
src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml

@ -51,13 +51,13 @@
<span class="copyright">© 2021 EventHub</span>
</div>
<div class="col-md text-center text-md-right">
<a href="@Url.Page("/TermsService")">
<a href="@EventHubExternalUrls.EhWww/terms-service">
Terms of Service
</a>
<span>
<img src="/assets/seperator2.svg" class="mx-3">
</span>
<a href="@Url.Page("/PrivacyPolicy")">
<a href="@EventHubExternalUrls.EhWww/privacy-policy">
Privacy Policy
</a>
</div>

69
src/EventHub.Web.Theme/Themes/EventHub/Components/MainNavbar/Default.cshtml

@ -8,6 +8,13 @@
@inject ILanguageProvider LanguageProvider
@inject IStringLocalizer<EventHubResource> L
@{
var returnUrl = System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery());
if (returnUrl.IsNullOrWhiteSpace())
{
returnUrl = "/";
}
}
<nav class="navbar navbar-expand-lg navbar-light bg-light static-top">
<div class="container">
<a class="navbar-brand font-weight-bold" href="@Url.Page("/index")">EventHub</a>
@ -17,22 +24,25 @@
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav mx-auto">
<li class="nav-item @(GetPageActiveClassOrEmpty(ViewContext, "/index"))">
<a class="nav-link" href="@Url.Page("/index")">
<a class="nav-link" href="@EventHubExternalUrls.EhWww@Url.Page("/index")">
Home
</a>
</li>
<li class="nav-item @(GetPageActiveClassOrEmpty(ViewContext, "/events/index"))">
<a class="nav-link" href="@Url.Page("/events/index")">Events</a>
<a class="nav-link" href="@EventHubExternalUrls.EhWww/events">Events</a>
</li>
<li class="nav-item @(GetPageActiveClassOrEmpty(ViewContext, "/organizations/index"))">
<a class="nav-link" href="@Url.Page("/organizations/index")">Organizations</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link event-link" href="@Url.Page("/events/new")">+ Create an Event</a>
<a class="nav-link" href="@EventHubExternalUrls.EhWww/organizations">Organizations</a>
</li>
</ul>
@if (EventHubExternalUrls.EhWww.Contains(Context.Request.Host.ToString()))
{
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link event-link" href="@EventHubExternalUrls.EhWww@Url.Page("/events/new")">+ Create an Event</a>
</li>
</ul>
}
<ul class="navbar-nav">
@if (CurrentUser.IsAuthenticated)
@ -56,53 +66,25 @@
</span>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="@(EventHubExternalUrls.EhAccount.EnsureEndsWith('/') + "account/manage")" target="_blank" title="@L["Account"]">
<a class="dropdown-item" href="@(EventHubExternalUrls.EhAccount.EnsureEndsWith('/') + "account/manage")" title="@L["Account"]">
<i class="fas fa-cog"></i> @L["Account"]
</a>
<a class="dropdown-item" href="/users/@CurrentUser.UserName" title="@L["Profile"]">
<a class="dropdown-item" href="@EventHubExternalUrls.EhWww/users/@CurrentUser.UserName" title="@L["Profile"]">
<i class="fas fa-user"></i> @L["Profile"]
</a>
<a class="dropdown-item" href="/account/logout?returnUrl=@EventHubExternalUrls.EhWww@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))" title="@L["Logout"]">
<a class="dropdown-item" href="/account/logout?returnUrl=@returnUrl" title="@L["Logout"]">
<i class="fas fa-sign-out-alt"></i> @L["Logout"]
</a>
</div>
</li>
var languages = await LanguageProvider.GetLanguagesAsync();
@if (languages.Count >= 2)
{
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
@* ToDo: Write language specific code find solution here (if block) *@
@if (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "en")
{
<span class="flag-icon flag-icon flag-icon-gb" data-toggle="tooltip" title="" data-original-title="@CultureInfo.CurrentUICulture.DisplayName"></span>
<span class="current-language-name">@CultureInfo.CurrentUICulture.DisplayName</span>
}
else
{
<span class="flag-icon flag-icon flag-icon-@CultureInfo.CurrentUICulture.TwoLetterISOLanguageName" data-toggle="tooltip" title="" data-original-title="@CultureInfo.CurrentUICulture.DisplayName"></span>
<span class="current-language-name">@CultureInfo.CurrentUICulture.DisplayName</span>
}
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuLink">
@foreach (var language in languages)
{
<a class="dropdown-item" href="/abp/languages/switch?culture=@language.CultureName&uiCulture=@language.UiCultureName&returnUrl=@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))">
<span class="flag-icon flag-icon mr-2 flag-icon-@language.FlagIcon"></span>@language.DisplayName
</a>
}
</div>
</li>
}
}
else
{
<li class="nav-item">
<a class="nav-link" href="/account/login?returnUrl=@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))">Log In</a>
<a class="nav-link" href="/account/login?returnUrl=@returnUrl">Log In</a>
</li>
<li class="nav-item">
<a class="btn btn-primary ml-lg-2" href="@EventHubExternalUrls.EhAccount/account/register?returnUrl=@EventHubExternalUrls.EhWww@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))">Sign Up</a>
<a class="btn btn-primary ml-lg-2" href="@EventHubExternalUrls.EhAccount/account/register?returnUrl=@returnUrl">Sign Up</a>
</li>
}
</ul>
@ -113,6 +95,11 @@
@functions{
public string GetPageActiveClassOrEmpty(ViewContext viewContext, string pageUrl)
{
if (!EventHubExternalUrls.EhWww.Contains(Context.Request.Host.ToString()))
{
return "";
}
var activeRoute = viewContext?.RouteData.Values["page"]?.ToString()?.ToLowerInvariant();
pageUrl = pageUrl.ToLowerInvariant();

Loading…
Cancel
Save