mirror of https://github.com/abpframework/eventhub
8 changed files with 116 additions and 26 deletions
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Text; |
|||
|
|||
namespace EventHub.Web.Pages.Events |
|||
{ |
|||
public static class EventDateHelper |
|||
{ |
|||
public static string GetDateRangeText(DateTime startTime, DateTime endTime) |
|||
{ |
|||
var sb = new StringBuilder(); |
|||
sb.Append(startTime.ToLongDateString()); |
|||
sb.Append(", "); |
|||
sb.Append(startTime.ToString("hh:mm")); |
|||
sb.Append(" - "); |
|||
if (startTime.Day != endTime.Day) |
|||
{ |
|||
sb.Append(endTime.ToLongDateString()); |
|||
sb.Append(", "); |
|||
} |
|||
|
|||
sb.Append(endTime.ToString("hh:mm")); |
|||
|
|||
return sb.ToString(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,19 +1,53 @@ |
|||
@page "/organizations/{name}" |
|||
@inject IHtmlLocalizer<EventHubResource> L |
|||
@using EventHub.Localization |
|||
@using EventHub.Web.Pages.Events |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@model EventHub.Web.Pages.Organizations.ProfilePageModel |
|||
<h1>@Model.Organization.DisplayName <small class="text-muted">@Model.Organization.Name</small></h1> |
|||
<img class="img-fluid mb-3" src="https://picsum.photos/seed/@Model.Name/1920/400?blur=8"> |
|||
<p class="lead"> |
|||
@Model.Organization.Description |
|||
</p> |
|||
<abp-row> |
|||
<abp-column size-lg="_12"> |
|||
<abp-card class="mb-3"> |
|||
<img abp-card-image="Top" src="https://picsum.photos/seed/@Model.Name/1920/400?blur=8" alt="@Model.Organization.DisplayName"/> |
|||
<abp-card-body> |
|||
<abp-card-title> |
|||
<h2>@Model.Organization.DisplayName</h2> |
|||
</abp-card-title> |
|||
<abp-card-text class="mt-3"> |
|||
@Model.Organization.Description |
|||
</abp-card-text> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
</abp-column> |
|||
</abp-row> |
|||
|
|||
<abp-tabs> |
|||
<abp-tab title="@L["Events"].Value"> |
|||
TODO |
|||
</abp-tab> |
|||
<abp-tab title="@L["Members"].Value"> |
|||
TODO |
|||
</abp-tab> |
|||
</abp-tabs> |
|||
@if (Model.Events.Any()) |
|||
{ |
|||
<h3>Upcoming Events</h3> |
|||
|
|||
<abp-row> |
|||
@foreach (var eventItem in Model.Events) |
|||
{ |
|||
<abp-column size-lg="_4" size-md="_6"> |
|||
<abp-card class="mb-3"> |
|||
<img abp-card-image="Top" src="https://picsum.photos/seed/@eventItem.Id.ToString()/400/160?blur=8" alt="@eventItem.Title"/> |
|||
<abp-card-body> |
|||
<abp-card-title>@eventItem.Title</abp-card-title> |
|||
<abp-card-subtitle> |
|||
@EventDateHelper.GetDateRangeText(eventItem.StartTime, eventItem.EndTime) |
|||
</abp-card-subtitle> |
|||
<abp-card-text> |
|||
@eventItem.Description.TruncateWithPostfix(100) |
|||
</abp-card-text> |
|||
<a abp-button="Primary" href="@Url.Page("/Events/Detail", new { url = eventItem.Url })"> @L["SeeEvent"]</a> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
</abp-column> |
|||
} |
|||
</abp-row> |
|||
} |
|||
else |
|||
{ |
|||
<abp-alert alert-type="Info"> |
|||
@L["NoEventOrganizedByThisOrganizationYet"] |
|||
</abp-alert> |
|||
} |
|||
|
|||
@ -1,27 +1,43 @@ |
|||
using System.Threading.Tasks; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Events; |
|||
using EventHub.Organizations; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.RazorPages; |
|||
|
|||
namespace EventHub.Web.Pages.Organizations |
|||
{ |
|||
public class ProfilePageModel : PageModel |
|||
public class ProfilePageModel : EventHubPageModel |
|||
{ |
|||
[BindProperty(SupportsGet = true)] |
|||
public string Name { get; set; } |
|||
|
|||
public OrganizationProfileDto Organization { get; set; } |
|||
public IReadOnlyList<EventInListDto> Events { get; private set; } |
|||
|
|||
private readonly IEventAppService _eventAppService; |
|||
private readonly IOrganizationAppService _organizationAppService; |
|||
|
|||
public ProfilePageModel(IOrganizationAppService organizationAppService) |
|||
public ProfilePageModel( |
|||
IOrganizationAppService organizationAppService, |
|||
IEventAppService eventAppService) |
|||
{ |
|||
_organizationAppService = organizationAppService; |
|||
_eventAppService = eventAppService; |
|||
} |
|||
|
|||
public async Task OnGetAsync() |
|||
{ |
|||
Organization = await _organizationAppService.GetProfileAsync(Name); |
|||
|
|||
var result = await _eventAppService.GetListAsync( |
|||
new EventListFilterDto |
|||
{ |
|||
MinDate = Clock.Now, |
|||
OrganizationId = Organization.Id |
|||
} |
|||
); |
|||
|
|||
Events = result.Items; |
|||
} |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue