From 3efeb04ad87c9e750743165b6b86c9d5443082a0 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Wed, 5 May 2021 16:57:06 +0300 Subject: [PATCH] Edit Event Detail page --- .../Events/Registrations/EventAttendeeDto.cs | 2 + .../Localization/EventHub/en.json | 3 +- .../Components/AttendeesArea/Default.cshtml | 20 +-- .../AttendeesArea/attendees-area.css | 11 +- .../Components/LocationArea/Default.cshtml | 57 ++++---- .../RegistrationArea/Default.cshtml | 20 ++- .../RegistrationArea/registration-area.js | 2 +- src/EventHub.Web/Pages/Events/Detail.cshtml | 133 ++++++++++++------ .../Pages/Events/EventDateHelper.cs | 16 +++ src/EventHub.Web/Pages/Index.cshtml.cs | 29 ++-- 10 files changed, 174 insertions(+), 119 deletions(-) diff --git a/src/EventHub.Application.Contracts/Events/Registrations/EventAttendeeDto.cs b/src/EventHub.Application.Contracts/Events/Registrations/EventAttendeeDto.cs index 31d7e5f..47bc90f 100644 --- a/src/EventHub.Application.Contracts/Events/Registrations/EventAttendeeDto.cs +++ b/src/EventHub.Application.Contracts/Events/Registrations/EventAttendeeDto.cs @@ -8,6 +8,8 @@ namespace EventHub.Events.Registrations public string UserName { get; set; } + public string Email { get; set; } + public string Name { get; set; } public string Surname { get; set; } diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index d986d6d..5d4d44f 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -29,8 +29,7 @@ "RegisterNow": "Register Now", "LoginToRegister": "Login to register", "CancelRegistration": "Cancel registration", - "EventRegisterSuccessMessageTitle": "Thanks for registering!", - "EventRegisterSuccessMessage": "We will send a reminder email before the event.", + "EventRegisterSuccessMessage": "Your event registration has been done successfully.", "EventRegistrationCancelledMessage": "Your event registration has been cancelled.", "OrganizedBy": "Organized by", "NoEventOrganizedByThisOrganizationYet": "No event organized by this organization yet!", diff --git a/src/EventHub.Web/Pages/Events/Components/AttendeesArea/Default.cshtml b/src/EventHub.Web/Pages/Events/Components/AttendeesArea/Default.cshtml index 06b62a1..16c3b89 100644 --- a/src/EventHub.Web/Pages/Events/Components/AttendeesArea/Default.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/AttendeesArea/Default.cshtml @@ -1,14 +1,8 @@ @model EventHub.Web.Pages.Events.Components.AttendeesArea.AttendeesAreaViewComponent.AttendeesAreaViewComponentModel - - - Attendees (@Model.TotalCount) - -
    - @foreach (var attendee in Model.Attendees) - { -
  • @Model.GetAttendeeName(attendee)
  • - } -
-
-
-
+
Attendees (@Model.TotalCount)
+
+ @foreach (var attendee in Model.Attendees) + { + + } +
\ No newline at end of file diff --git a/src/EventHub.Web/Pages/Events/Components/AttendeesArea/attendees-area.css b/src/EventHub.Web/Pages/Events/Components/AttendeesArea/attendees-area.css index d7b2944..5f28270 100644 --- a/src/EventHub.Web/Pages/Events/Components/AttendeesArea/attendees-area.css +++ b/src/EventHub.Web/Pages/Events/Components/AttendeesArea/attendees-area.css @@ -1,10 +1 @@ -#EventAttendeeList -{ - list-style: none; - padding: 0; -} - -#EventAttendeeList li -{ - -} + \ No newline at end of file diff --git a/src/EventHub.Web/Pages/Events/Components/LocationArea/Default.cshtml b/src/EventHub.Web/Pages/Events/Components/LocationArea/Default.cshtml index 19f8c38..dcd6e18 100644 --- a/src/EventHub.Web/Pages/Events/Components/LocationArea/Default.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/LocationArea/Default.cshtml @@ -1,45 +1,42 @@ @using EventHub.Localization +@using EventHub.Web.Pages.Events @using Microsoft.AspNetCore.Mvc.Localization @inject IHtmlLocalizer L @model EventHub.Web.Pages.Events.Components.LocationArea.LocationAreaViewComponent.LocationAreaViewComponentModel - - - @L["Location"] - - @if (Model.IsRegistered) +
+ @if (Model.IsRegistered) + { + if (Model.IsOnline) { - if (Model.IsOnline) + if (Model.OnlineLink != null) { - if (Model.OnlineLink != null) - { - @L["GoToEventAddress"] - } - else - { -

@L["LocationHasNotSpecifiedYet", "URL"]

- } - }else + @L["GoToEventAddress"] + } + else { - if (Model.Country != null && Model.City != null) - { -

@Model.Country/@Model.City

- } - else - { -

@L["LocationHasNotSpecifiedYet", "location"]

- } + @L["LocationHasNotSpecifiedYet", "URL"] } - } - else + }else { - if (Model.IsOnline) + if (Model.Country != null && Model.City != null) { -

@L["AttendeesCanSeeEventLocation", "URL"]

+ @EventDateHelper.GetLocationInfo(Model.IsOnline, Model.City, Model.Country, ", ") } else { -

@L["AttendeesCanSeeEventLocation", "location"]

+ @L["LocationHasNotSpecifiedYet", "location"] } } - - + } + else + { + if (Model.IsOnline) + { + @L["AttendeesCanSeeEventLocation", "URL"] + } + else + { + @L["AttendeesCanSeeEventLocation", "location"] + } + } +
diff --git a/src/EventHub.Web/Pages/Events/Components/RegistrationArea/Default.cshtml b/src/EventHub.Web/Pages/Events/Components/RegistrationArea/Default.cshtml index 0bca3d6..60fbc16 100644 --- a/src/EventHub.Web/Pages/Events/Components/RegistrationArea/Default.cshtml +++ b/src/EventHub.Web/Pages/Events/Components/RegistrationArea/Default.cshtml @@ -2,24 +2,23 @@ @using Microsoft.AspNetCore.Mvc.Localization @inject IHtmlLocalizer L @model EventHub.Web.Pages.Events.Components.RegistrationArea.RegistrationAreaViewComponent.RegistrationAreaViewComponentModel - - +
@if (Model.IsLoggedIn) { if (Model.IsRegistered) { - + data-url="@Url.Action("Unregister", "EventRegistration", new {eventId = Model.EventId})"/> } else { - @@ -27,8 +26,7 @@ } else { - @L["LoginToRegister"] } - - +
diff --git a/src/EventHub.Web/Pages/Events/Components/RegistrationArea/registration-area.js b/src/EventHub.Web/Pages/Events/Components/RegistrationArea/registration-area.js index ae335ea..6256b9e 100644 --- a/src/EventHub.Web/Pages/Events/Components/RegistrationArea/registration-area.js +++ b/src/EventHub.Web/Pages/Events/Components/RegistrationArea/registration-area.js @@ -21,7 +21,7 @@ }).then(function (){ widgetManager.refresh(); abp.event.trigger('EventHub.Event.RegistrationStatusChanged'); - abp.message.success(l('EventRegisterSuccessMessage'), l('EventRegisterSuccessMessageTitle')); + abp.message.success(l('EventRegisterSuccessMessage')); }).always(function (){ $registerButton.buttonBusy(false); }); diff --git a/src/EventHub.Web/Pages/Events/Detail.cshtml b/src/EventHub.Web/Pages/Events/Detail.cshtml index a21b4cd..7304331 100644 --- a/src/EventHub.Web/Pages/Events/Detail.cshtml +++ b/src/EventHub.Web/Pages/Events/Detail.cshtml @@ -1,59 +1,104 @@ @page "/events/{url}" @inject IHtmlLocalizer L -@using System.Globalization @using EventHub.Localization @using EventHub.Web.Pages.Events @using EventHub.Web.Pages.Events.Components.AttendeesArea +@using EventHub.Web.Pages.Events.Components.EventsArea @using EventHub.Web.Pages.Events.Components.LocationArea @using EventHub.Web.Pages.Events.Components.RegistrationArea @using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.Timing +@using Volo.Abp.Users +@inject ICurrentUser CurrentUser +@inject IClock Clock @model EventHub.Web.Pages.Events.DetailPageModel - - - - @if (Model.Event.CoverImageContent is null) - { - @Model.Event.Title - } - else - { - @Model.Event.Title - } - - - @if (Model.IsEventOwner) +
+
+
+
+
+ @if (Model.Event.CoverImageContent == null) { -
-
-

@Model.Event.Title

-
- -
+ @Model.Event.Title } else { -

@Model.Event.Title

+ @Model.Event.Title } - - - @EventDateHelper.GetDateRangeText(Model.Event.StartTime, Model.Event.EndTime)
- @L["OrganizedBy"] @Model.Event.OrganizationDisplayName - @if (!Model.Event.Language.IsNullOrWhiteSpace()) - { -

@L["Language"]: @CultureInfo.GetCultureInfo(Model.Event.Language).EnglishName

- } -
- +
+
+ +
+ @if (Model.IsEventOwner) + { +

+ @Model.Event.Title + + + +

+ } + else + { +

@Model.Event.Title

+ } + @await Component.InvokeAsync(typeof(LocationAreaViewComponent), new {eventId = Model.Event.Id}) + +
Organizers
+
+ + + +
+ @await Component.InvokeAsync(typeof(RegistrationAreaViewComponent), new {eventId = Model.Event.Id}) +
+
+
+
+
Event Description
+

@Model.Event.Description - - - - - - @await Component.InvokeAsync(typeof(RegistrationAreaViewComponent), new {eventId = Model.Event.Id}) - @await Component.InvokeAsync(typeof(AttendeesAreaViewComponent), new {eventId = Model.Event.Id}) - @await Component.InvokeAsync(typeof(LocationAreaViewComponent), new {eventId = Model.Event.Id}) - - +

+ +
Date
+

+ @EventDateHelper.GetDateRangeText(Model.Event.StartTime, Model.Event.EndTime) +

+ + @await Component.InvokeAsync(typeof(AttendeesAreaViewComponent), new {eventId = Model.Event.Id}) + +
+ +
+
Share Event
+ +
+
+
+
+ + +
+
+
+

Events You Will Enjoy

+
+
+ + @await Component.InvokeAsync(typeof(EventsAreaViewComponent), new + { + minDate = Clock.Now.ClearTime(), + MaxResultCount = 6, + isPagination = false + }) +
\ No newline at end of file diff --git a/src/EventHub.Web/Pages/Events/EventDateHelper.cs b/src/EventHub.Web/Pages/Events/EventDateHelper.cs index f324529..0aab7c7 100644 --- a/src/EventHub.Web/Pages/Events/EventDateHelper.cs +++ b/src/EventHub.Web/Pages/Events/EventDateHelper.cs @@ -39,5 +39,21 @@ namespace EventHub.Web.Pages.Events return sb.ToString(); } } + + public static string GetLocationInfo(bool isOnline, string city, string country, string separator) + { + if (isOnline) + { + return "online"; + } + else + { + var sb = new StringBuilder(); + sb.Append(city); + sb.Append(separator); + sb.Append(country); + return sb.ToString(); + } + } } } diff --git a/src/EventHub.Web/Pages/Index.cshtml.cs b/src/EventHub.Web/Pages/Index.cshtml.cs index 3309e68..aa0a7b7 100644 --- a/src/EventHub.Web/Pages/Index.cshtml.cs +++ b/src/EventHub.Web/Pages/Index.cshtml.cs @@ -25,6 +25,18 @@ namespace EventHub.Web.Pages } public async Task OnGetAsync() + { + await FillOnlineEventsAsync(); + await FillCountriesAsync(); + FillLanguages(); + } + + public async Task OnPostLoginAsync() + { + await HttpContext.ChallengeAsync("oidc"); + } + + private async Task FillOnlineEventsAsync() { OnlineEvents = (await _eventAppService.GetListAsync( new EventListFilterDto @@ -34,13 +46,10 @@ namespace EventHub.Web.Pages MaxResultCount = 8 } )).Items; - - Languages = CultureInfo.GetCultures(CultureTypes.NeutralCultures) - .DistinctBy(x => x.EnglishName) - .OrderBy(x => x.EnglishName) - .ToList(); - Languages.Remove(Languages.Single(x => x.TwoLetterISOLanguageName == "iv")); // Invariant Language + } + private async Task FillCountriesAsync() + { Countries = await _eventAppService.GetCountriesLookupAsync(); Countries.Insert(0, new CountryLookupDto { @@ -49,9 +58,13 @@ namespace EventHub.Web.Pages }); } - public async Task OnPostLoginAsync() + private void FillLanguages() { - await HttpContext.ChallengeAsync("oidc"); + Languages = CultureInfo.GetCultures(CultureTypes.NeutralCultures) + .DistinctBy(x => x.EnglishName) + .OrderBy(x => x.EnglishName) + .ToList(); + Languages.Remove(Languages.Single(x => x.TwoLetterISOLanguageName == "iv")); // Invariant Language } } }