Browse Source

Add default cover image if there is no picture on Organizations and Events

pull/41/head
Berkan Sasmaz 5 years ago
parent
commit
87b2e19f2b
  1. 22
      src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml
  2. 39
      src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css
  3. 30
      src/EventHub.Web/Helpers/CoverImageHelper.cs
  4. 5
      src/EventHub.Web/Pages/Events/Components/EventsArea/_eventListSection.cshtml
  5. 9
      src/EventHub.Web/Pages/Index.cshtml
  6. 7
      src/EventHub.Web/Pages/Organizations/Components/OrganizationsArea/_organizationListSection.cshtml

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

@ -11,16 +11,18 @@
EventHub
</a>
</div>
<div class="col-md">
<h5>Account</h5>
<div class="footer-links">
@if (!CurrentUser.IsAuthenticated)
{
@if (!CurrentUser.IsAuthenticated)
{
<h5>Account</h5>
<div class="footer-links">
<a href="@EventHubExternalUrls.EhAccount/account/register?returnUrl=@EventHubExternalUrls.EhWww@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))" class="d-block">Sign Up</a>
<a href="/account/login?returnUrl=@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))" class="d-block">Log In</a>
}
<a href="@Url.Page("/help")" class="d-block">Help</a>
</div>
</div>
}
</div>
<div class="col-md">
<h5>Follow Us</h5>
@ -50,6 +52,12 @@
<span class="copyright">© 2021 EventHub</span>
</div>
<div class="col-md text-center text-md-right">
<a href="@Url.Page("/help")">
Help
</a>
<span>
<img src="/assets/seperator2.svg" class="mx-3">
</span>
<a href="@Url.Page("/TermsService")">
@* ToDo: The content of the page will be edited *@
Terms of Service

39
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;

30
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();
}
}
}

5
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<EventHub.Events.EventInListDto>
@ -8,7 +9,9 @@
<div class="card">
@if (eventDto.CoverImageContent is null)
{
<img abp-card-image="Top" src="/assets/card-img.png" alt="@eventDto.Title"/>
<div class="rounded list-span text-center" style="background: @(CoverImageHelper.GetRandomColor(eventDto.Title))">
<span>@CoverImageHelper.GetTitle(eventDto.Title).TruncateWithPostfix(40)</span>
</div>
}
else
{

9
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 @@
<div class="col-md-5">
@if (Model.OnlineEvents[i].CoverImageContent is null)
{
<img src="/assets/card-left-image.png" class="card-img-left" alt="@Model.OnlineEvents[i].Title">
<div class="rounded carousel-list-span text-center" style="background: @(CoverImageHelper.GetRandomColor(@Model.OnlineEvents[i].Title))">
<small>@CoverImageHelper.GetTitle(Model.OnlineEvents[i].Title).TruncateWithPostfix(30)</small>
</div>
}
else
{
@ -148,7 +151,9 @@
<div class="col-md-5">
@if (Model.OnlineEvents[i + 1].CoverImageContent is null)
{
<img src="/assets/card-left-image.png" class="card-img-left" alt="@Model.OnlineEvents[i + 1].Title">
<div class="rounded carousel-list-span text-center" style="background: @(CoverImageHelper.GetRandomColor(@Model.OnlineEvents[i + 1].Title))">
<small>@CoverImageHelper.GetTitle(Model.OnlineEvents[i + 1].Title).TruncateWithPostfix(30)</small>
</div>
}
else
{

7
src/EventHub.Web/Pages/Organizations/Components/OrganizationsArea/_organizationListSection.cshtml

@ -1,3 +1,4 @@
@using EventHub.Web.Helpers
@model List<EventHub.Organizations.OrganizationInListDto>
@foreach (var organization in Model)
@ -6,7 +7,9 @@
<div class="card">
@if (organization.ProfilePictureContent == null)
{
<img src="assets/card-img.png" class="card-img-top" alt="@organization.Name">
<div class="rounded list-span text-center" style="background: @(CoverImageHelper.GetRandomColor(organization.Name))">
<span>@CoverImageHelper.GetTitle(organization.Name).TruncateWithPostfix(40)</span>
</div>
}
else
{
@ -20,7 +23,7 @@
@organization.Description
</p>
</div>
<a href="@Url.Page("/Organizations/Profile", new {name = organization.Name})" class="btn btn-link p-0">Details <img src="assets/more-btn.svg"></a>
<a href="@Url.Page("/Organizations/Profile", new {name = organization.Name})" class="btn btn-link p-0">Details <img src="/assets/more-btn.svg"></a>
</div>
</div>
</div>

Loading…
Cancel
Save