From 59276894d3744cd5159179eb72e9eae27006938c Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Thu, 10 Jun 2021 14:22:59 +0300 Subject: [PATCH] Make the desired changes after the review Add tooltip to Gravatars. Set routing of profile page to "/users/{username}". Change "Looking for" to "Language". Put distance between the "Load more" button and the footer section. Block registration for past events. Change "Edit Organization" and "Edit Event" buttons to "Submit". Change the "Share organizations" section to "Links". Modify User Profile page. --- .../IEventRegistrationAppService.cs | 2 + .../EventRegistrationAppService.cs | 7 ++ .../Localization/EventHub/en.json | 4 +- .../Registrations/EventRegistrationManager.cs | 16 ++- .../EventHub/Components/Footer/Default.cshtml | 2 +- .../Components/MainNavbar/Default.cshtml | 2 +- .../Components/AttendeesArea/Default.cshtml | 4 +- .../RegistrationArea/Default.cshtml | 8 ++ .../RegistrationAreaViewComponent.cs | 2 + src/EventHub.Web/Pages/Events/Detail.cshtml | 4 +- src/EventHub.Web/Pages/Events/Edit.cshtml | 2 +- src/EventHub.Web/Pages/Events/Index.cshtml | 2 +- src/EventHub.Web/Pages/Index.cshtml | 2 +- .../MembersArea/_memberListSection.cshtml | 4 +- .../Pages/Organizations/Edit.cshtml | 2 +- .../Pages/Organizations/Profile.cshtml | 6 +- .../{Members/Profile.cshtml => Users.cshtml} | 105 +++++++++--------- .../Profile.cshtml.cs => Users.cshtml.cs} | 0 18 files changed, 103 insertions(+), 71 deletions(-) rename src/EventHub.Web/Pages/{Members/Profile.cshtml => Users.cshtml} (72%) rename src/EventHub.Web/Pages/{Members/Profile.cshtml.cs => Users.cshtml.cs} (100%) diff --git a/src/EventHub.Application.Contracts/Events/Registrations/IEventRegistrationAppService.cs b/src/EventHub.Application.Contracts/Events/Registrations/IEventRegistrationAppService.cs index d7e8cbe..a5c2b68 100644 --- a/src/EventHub.Application.Contracts/Events/Registrations/IEventRegistrationAppService.cs +++ b/src/EventHub.Application.Contracts/Events/Registrations/IEventRegistrationAppService.cs @@ -16,5 +16,7 @@ namespace EventHub.Events.Registrations Task> GetAttendeesAsync(Guid eventId); Task GetAttendeeCountAsync(Guid eventId); + + Task IsPastEventAsync(Guid eventId); } } diff --git a/src/EventHub.Application/Events/Registrations/EventRegistrationAppService.cs b/src/EventHub.Application/Events/Registrations/EventRegistrationAppService.cs index c04b055..20f296e 100644 --- a/src/EventHub.Application/Events/Registrations/EventRegistrationAppService.cs +++ b/src/EventHub.Application/Events/Registrations/EventRegistrationAppService.cs @@ -85,5 +85,12 @@ namespace EventHub.Events.Registrations { return await _eventRegistrationRepository.CountAsync(x => x.EventId == eventId); } + + public async Task IsPastEventAsync(Guid eventId) + { + var @event = await _eventRepository.GetAsync(eventId); + + return _eventRegistrationManager.IsPastEvent(@event); + } } } diff --git a/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/src/EventHub.Domain.Shared/Localization/EventHub/en.json index ee1e8a0..fa2b05b 100644 --- a/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -71,7 +71,6 @@ "EventCoverImageExtensionNotAllowed": "This image extension is not allowed. Allowed extensions: png, jpg, jpeg", "ChooseEventCoverImageInfo": "Maximum image size: 1MB.", "ProfilePicturePreview": "Profile Picture Preview", - "EditEvent": "Edit Event", "EventInformation": "Event Information", "EventCapacityLabel": "Capacity (Optional)", "EventCapacityInfo": "Capacity can not be lower than the currently registered user count : {0}", @@ -82,6 +81,7 @@ "EventCoverImage": "Event Cover Image", "EventTimingPreview": "Event Timing Preview", "CoverImagePreview": "Cover Image Preview", - "EventTimingChangeSuccessMessage": "The time of the event has been changed successfully!" + "EventTimingChangeSuccessMessage": "The time of the event has been changed successfully!", + "PastEvent": "Past Event" } } diff --git a/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs b/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs index 5552d26..6a097f7 100644 --- a/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs +++ b/src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs @@ -20,7 +20,10 @@ namespace EventHub.Events.Registrations Event @event, AppUser user) { - CheckEventEndTime(@event); + if (IsPastEvent(@event)) + { + throw new BusinessException(EventHubErrorCodes.CantRegisterOrUnregisterForAPastEvent); + } if (await IsRegisteredAsync(@event, user)) { @@ -48,7 +51,10 @@ namespace EventHub.Events.Registrations Event @event, AppUser user) { - CheckEventEndTime(@event); + if (IsPastEvent(@event)) + { + throw new BusinessException(EventHubErrorCodes.CantRegisterOrUnregisterForAPastEvent); + } await _eventRegistrationRepository.DeleteAsync( x => x.EventId == @event.Id && x.UserId == user.Id @@ -63,12 +69,14 @@ namespace EventHub.Events.Registrations .AnyAsync(x => x.EventId == @event.Id && x.UserId == user.Id); } - private void CheckEventEndTime(Event @event) + public bool IsPastEvent(Event @event) { if (Clock.Now > @event.EndTime) { - throw new BusinessException(EventHubErrorCodes.CantRegisterOrUnregisterForAPastEvent); + return true; } + + return false; } } } 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 6683925..2cd5616 100644 --- a/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml +++ b/src/EventHub.Web.Theme/Themes/EventHub/Components/Footer/Default.cshtml @@ -3,7 +3,7 @@ @using Volo.Abp.Users @inject ICurrentUser CurrentUser -