From 87b2e19f2bef016b6f5c413f88a2fd8164ab7775 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Tue, 18 May 2021 11:11:35 +0300 Subject: [PATCH] Add default cover image if there is no picture on Organizations and Events --- .../EventHub/Components/Footer/Default.cshtml | 22 +++++++---- .../wwwroot/themes/eventhub/style.css | 39 +++++++++++++++++++ src/EventHub.Web/Helpers/CoverImageHelper.cs | 30 ++++++++++++++ .../EventsArea/_eventListSection.cshtml | 5 ++- src/EventHub.Web/Pages/Index.cshtml | 9 ++++- .../_organizationListSection.cshtml | 7 +++- 6 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 src/EventHub.Web/Helpers/CoverImageHelper.cs diff --git a/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml b/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml index ff0b15b..6b3521c 100644 --- a/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml +++ b/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml @@ -11,16 +11,18 @@ EventHub +
-
Account
- + }
Follow Us
@@ -50,6 +52,12 @@ © 2021 EventHub
+ + Help + + + + @* ToDo: The content of the page will be edited *@ Terms of Service diff --git a/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css b/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css index 1dabd4d..01cdd13 100644 --- a/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css +++ b/src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css @@ -566,6 +566,45 @@ nav.breadcrumb-container .breadcrumb a,nav.breadcrumb-container .breadcrumb li{ width: 40px; height: 40px; } + +.list-span { + line-height: 168px; } +.list-span span { + font-size: 1em; + color: #fff; + opacity: 0.5; + line-height: 1; + font-weight: 100; + text-shadow: 0 0 35px rgba(0, 0, 0, 0.5); } +@media screen and (max-width: 767px) { + .list-span { + width: 100%; + height: 150px; + line-height: 150px; + margin-bottom: 1em; } + .list-span span { + font-size: 1em; + line-height: 150px; } } + +.carousel-list-span { + line-height: 215px; } +.carousel-list-span span { + font-size: 1em; + color: #fff; + opacity: 0.5; + line-height: 1; + font-weight: 100; + text-shadow: 0 0 35px rgba(0, 0, 0, 0.5); } +@media screen and (max-width: 767px) { + .carousel-list-span { + width: 100%; + height: 150px; + line-height: 150px; + margin-bottom: 1em; } + .carousel-list-spann span { + font-size: 1em; + line-height: 150px; } } + .detail-head { font-weight: normal; font-size: 18px; diff --git a/src/EventHub.Web/Helpers/CoverImageHelper.cs b/src/EventHub.Web/Helpers/CoverImageHelper.cs new file mode 100644 index 0000000..3de86c7 --- /dev/null +++ b/src/EventHub.Web/Helpers/CoverImageHelper.cs @@ -0,0 +1,30 @@ +using System; +using System.Linq; +using Volo.Abp; + +namespace EventHub.Web.Helpers +{ + public class CoverImageHelper + { + private static readonly string[] ImageColors = + { + "linear-gradient(135deg, #41003d 0%, #a10097 100%)", + "linear-gradient(135deg, #163e4b 0%, #297791 100%)", + "linear-gradient(135deg, #660040 0%, #aa006b 100%)", + "linear-gradient(135deg, #240d88 0%, #571fff 100%)", + }; + + public static string GetRandomColor(string articleTitle) + { + long total = articleTitle.Truncate(32).ToCharArray().Sum(c => c); + return ImageColors[total % ImageColors.Length]; + } + + public static string GetTitle(string title) + { + title = Check.NotNullOrWhiteSpace(title, nameof(title)); + + return title.ToUpper(); + } + } +} \ No newline at end of file diff --git a/src/EventHub.Web/Pages/Events/Components/EventsArea/_eventListSection.cshtml b/src/EventHub.Web/Pages/Events/Components/EventsArea/_eventListSection.cshtml index 7771422..1307ed5 100644 --- a/src/EventHub.Web/Pages/Events/Components/EventsArea/_eventListSection.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/EventsArea/_eventListSection.cshtml @@ -1,4 +1,5 @@ @using System.Globalization +@using EventHub.Web.Helpers @using EventHub.Web.Pages.Events @model List @@ -8,7 +9,9 @@
@if (eventDto.CoverImageContent is null) { - @eventDto.Title +
+ @CoverImageHelper.GetTitle(eventDto.Title).TruncateWithPostfix(40) +
} else { diff --git a/src/EventHub.Web/Pages/Index.cshtml b/src/EventHub.Web/Pages/Index.cshtml index 20e744e..a2a6c63 100644 --- a/src/EventHub.Web/Pages/Index.cshtml +++ b/src/EventHub.Web/Pages/Index.cshtml @@ -4,6 +4,7 @@ @using Microsoft.AspNetCore.Mvc.Localization @using EventHub.Localization @using EventHub.Web +@using EventHub.Web.Helpers @using EventHub.Web.Pages.Events.Components.EventsArea @using Volo.Abp.Timing @using Volo.Abp.Users @@ -120,7 +121,9 @@