Browse Source

Edit Event Detail page

pull/41/head
Berkan Sasmaz 5 years ago
parent
commit
3efeb04ad8
  1. 2
      src/EventHub.Application.Contracts/Events/Registrations/EventAttendeeDto.cs
  2. 3
      src/EventHub.Domain.Shared/Localization/EventHub/en.json
  3. 20
      src/EventHub.Web/Pages/Events/Components/AttendeesArea/Default.cshtml
  4. 11
      src/EventHub.Web/Pages/Events/Components/AttendeesArea/attendees-area.css
  5. 57
      src/EventHub.Web/Pages/Events/Components/LocationArea/Default.cshtml
  6. 20
      src/EventHub.Web/Pages/Events/Components/RegistrationArea/Default.cshtml
  7. 2
      src/EventHub.Web/Pages/Events/Components/RegistrationArea/registration-area.js
  8. 133
      src/EventHub.Web/Pages/Events/Detail.cshtml
  9. 16
      src/EventHub.Web/Pages/Events/EventDateHelper.cs
  10. 29
      src/EventHub.Web/Pages/Index.cshtml.cs

2
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; }

3
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!",

20
src/EventHub.Web/Pages/Events/Components/AttendeesArea/Default.cshtml

@ -1,14 +1,8 @@
@model EventHub.Web.Pages.Events.Components.AttendeesArea.AttendeesAreaViewComponent.AttendeesAreaViewComponentModel
<abp-card class="mb-3" data-event-id="@Model.EventId">
<abp-card-body>
<abp-card-title>Attendees (@Model.TotalCount)</abp-card-title>
<abp-card-text>
<ul id="EventAttendeeList">
@foreach (var attendee in Model.Attendees)
{
<li class="border p-2 mb-2"><i class="fas fa-user"></i> @Model.GetAttendeeName(attendee)</li>
}
</ul>
</abp-card-text>
</abp-card-body>
</abp-card>
<h5 class="detail-head mt-5 font-weight-bold" data-event-id="@Model.EventId">Attendees (@Model.TotalCount)</h5>
<div>
@foreach (var attendee in Model.Attendees)
{
<img gravatar-email="@attendee.Email" default-image="Wavatar" gravatar-size="60" class="org-avatar rounded-circle"/>
}
</div>

11
src/EventHub.Web/Pages/Events/Components/AttendeesArea/attendees-area.css

@ -1,10 +1 @@
#EventAttendeeList
{
list-style: none;
padding: 0;
}
#EventAttendeeList li
{
}


57
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<EventHubResource> L
@model EventHub.Web.Pages.Events.Components.LocationArea.LocationAreaViewComponent.LocationAreaViewComponentModel
<abp-card class="mb-3" data-event-id="@Model.EventId">
<abp-card-body>
<abp-card-title>@L["Location"] <i class="fas fa-map-marker-alt"></i></abp-card-title>
@if (Model.IsRegistered)
<div data-event-id="@Model.EventId">
@if (Model.IsRegistered)
{
if (Model.IsOnline)
{
if (Model.IsOnline)
if (Model.OnlineLink != null)
{
if (Model.OnlineLink != null)
{
<a href="@Model.OnlineLink">@L["GoToEventAddress"]</a>
}
else
{
<p>@L["LocationHasNotSpecifiedYet", "URL"]</p>
}
}else
<a class="detail-pin" href="@Model.OnlineLink"><img src="/assets/pin.svg"> @L["GoToEventAddress"]</a>
}
else
{
if (Model.Country != null && Model.City != null)
{
<p>@Model.Country/@Model.City</p>
}
else
{
<p>@L["LocationHasNotSpecifiedYet", "location"]</p>
}
<span>@L["LocationHasNotSpecifiedYet", "URL"]</span>
}
}
else
}else
{
if (Model.IsOnline)
if (Model.Country != null && Model.City != null)
{
<p>@L["AttendeesCanSeeEventLocation", "URL"]</p>
<span class="detail-pin"><img src="/assets/pin.svg"> @EventDateHelper.GetLocationInfo(Model.IsOnline, Model.City, Model.Country, ", ")</span>
}
else
{
<p>@L["AttendeesCanSeeEventLocation", "location"]</p>
<span class="detail-pin">@L["LocationHasNotSpecifiedYet", "location"]</span>
}
}
</abp-card-body>
</abp-card>
}
else
{
if (Model.IsOnline)
{
<span class="detail-pin">@L["AttendeesCanSeeEventLocation", "URL"]</span>
}
else
{
<span class="detail-pin">@L["AttendeesCanSeeEventLocation", "location"]</span>
}
}
</div>

20
src/EventHub.Web/Pages/Events/Components/RegistrationArea/Default.cshtml

@ -2,24 +2,23 @@
@using Microsoft.AspNetCore.Mvc.Localization
@inject IHtmlLocalizer<EventHubResource> L
@model EventHub.Web.Pages.Events.Components.RegistrationArea.RegistrationAreaViewComponent.RegistrationAreaViewComponentModel
<abp-card class="mb-3" data-event-id="@Model.EventId">
<abp-card-body>
<div data-event-id="@Model.EventId">
@if (Model.IsLoggedIn)
{
if (Model.IsRegistered)
{
<abp-button id="EventCancelRegistrationButton"
button-type="Secondary"
size="Block"
<abp-button class="mt-4" id="EventCancelRegistrationButton"
button-type="Primary"
size="Large"
icon="fas fa-times"
text="@L["CancelRegistration"].Value"
data-url="@Url.Action("Unregister","EventRegistration", new { eventId = Model.EventId })" />
data-url="@Url.Action("Unregister", "EventRegistration", new {eventId = Model.EventId})"/>
}
else
{
<abp-button id="EventRegisterButton"
<abp-button class="mt-4" id="EventRegisterButton"
button-type="Primary"
size="Block"
size="Large"
icon="fas fa-plus"
text="@L["RegisterNow"].Value"
data-url="@Url.Action("Register","EventRegistration", new { eventId = Model.EventId })"/>
@ -27,8 +26,7 @@
}
else
{
<a abp-button="Primary"
<a abp-button="Primary" class="btn btn-primary btn-lg mt-4"
href="@Url.Action("Login", "Account", new { returnUrl = Context.Request.Path.Value })"> @L["LoginToRegister"]</a>
}
</abp-card-body>
</abp-card>
</div>

2
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);
});

133
src/EventHub.Web/Pages/Events/Detail.cshtml

@ -1,59 +1,104 @@
@page "/events/{url}"
@inject IHtmlLocalizer<EventHubResource> 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
<abp-row>
<abp-column size-lg="_8" size-md="_6">
<abp-card class="mb-3">
@if (Model.Event.CoverImageContent is null)
{
<img abp-card-image="Top" src="https://picsum.photos/seed/@Model.Event.Id.ToString()/400/160?blur=8" alt="@Model.Event.Title"/>
}
else
{
<img abp-card-image="Top" style="max-height: 400px; min-height: 160px;" src="@($"data:image/png;base64,{Convert.ToBase64String(Model.Event.CoverImageContent)}")" alt="@Model.Event.Title"/>
}
<abp-card-body>
<abp-card-title>
@if (Model.IsEventOwner)
<div class="bg-white py-5">
<div class="container detail-page pb-4">
<div class="row">
<div class="col-md-7">
<div class="detail-image">
@if (Model.Event.CoverImageContent == null)
{
<div class="row">
<div class="col-9">
<h2>@Model.Event.Title</h2>
</div>
<div class="col-3 text-right">
<a href="/event/edit/@Model.Event.Url" class="btn btn-primary text-white">@L["Edit"] <i class="far fa-edit"></i></a>
</div>
</div>
<img src="/assets/detail.png" alt="@Model.Event.Title">
}
else
{
<h2>@Model.Event.Title</h2>
<img src="@($"data:image/png;base64,{Convert.ToBase64String(Model.Event.CoverImageContent)}")" alt="@Model.Event.Title">
}
</abp-card-title>
<abp-card-subtitle>
@EventDateHelper.GetDateRangeText(Model.Event.StartTime, Model.Event.EndTime) <br/>
<span class="text-muted">@L["OrganizedBy"]</span> <a href="@Url.Page("/Organizations/Profile", new {name = Model.Event.OrganizationName})">@Model.Event.OrganizationDisplayName</a>
@if (!Model.Event.Language.IsNullOrWhiteSpace())
{
<p>@L["Language"]: <span class="text-muted"> @CultureInfo.GetCultureInfo(Model.Event.Language).EnglishName</span></p>
}
</abp-card-subtitle>
<abp-card-text class="mt-3">
</div>
</div>
<div class="col-md-5 pl-md-5">
@if (Model.IsEventOwner)
{
<h1 class="mt-4 mt-md-0">
@Model.Event.Title
<a href="/event/edit/@Model.Event.Url" class="btn btn-primary text-white">
<i class="far fa-edit"></i>
</a>
</h1>
}
else
{
<h1 class="mt-4 mt-md-0">@Model.Event.Title</h1>
}
@await Component.InvokeAsync(typeof(LocationAreaViewComponent), new {eventId = Model.Event.Id})
<h5 class="detail-head mt-4">Organizers</h5>
<div>
<img src="/assets/avatar2.png" class="org-avatar">
<img src="/assets/avatar3.png" class="org-avatar">
<img src="/assets/avatar4.png" class="org-avatar">
</div>
@await Component.InvokeAsync(typeof(RegistrationAreaViewComponent), new {eventId = Model.Event.Id})
</div>
</div>
<div class="row">
<div class="col-md-7">
<h5 class="detail-head mt-5 font-weight-bold">Event Description</h5>
<p>
@Model.Event.Description
</abp-card-text>
</abp-card-body>
</abp-card>
</abp-column>
<abp-column size-lg="_4" size-md="_6">
@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})
</abp-column>
</abp-row>
</p>
<h5 class="detail-head mt-5 font-weight-bold">Date</h5>
<p>
@EventDateHelper.GetDateRangeText(Model.Event.StartTime, Model.Event.EndTime)
</p>
@await Component.InvokeAsync(typeof(AttendeesAreaViewComponent), new {eventId = Model.Event.Id})
</div>
<div class="col-md-5 pl-md-5">
<h5 class="detail-head mt-5 font-weight-bold">Share Event</h5>
<div class="share-container">
<a href="#">
<img src="/assets/twitter2.svg">
</a>
<a href="#">
<img src="/assets/in2.svg">
</a>
<a href="#">
<img src="/assets/facebook2.png">
</a>
</div>
</div>
</div>
</div>
</div>
<div class="container pt-5">
<div class="row py-4">
<div class="col-md">
<h2>Events You Will Enjoy</h2>
</div>
</div>
@await Component.InvokeAsync(typeof(EventsAreaViewComponent), new
{
minDate = Clock.Now.ClearTime(),
MaxResultCount = 6,
isPagination = false
})
</div>

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

29
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
}
}
}

Loading…
Cancel
Save