mirror of https://github.com/abpframework/eventhub
21 changed files with 2742 additions and 5 deletions
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EventHub.Events |
|||
{ |
|||
public class EventLocationDto : EntityDto<Guid> |
|||
{ |
|||
public bool IsOnline { get; set; } |
|||
|
|||
public string Link { get; set; } |
|||
|
|||
public bool IsRegistered { get; set; } |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,24 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EventHub.Migrations |
|||
{ |
|||
public partial class Added_Link_To_Event : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "Link", |
|||
table: "AppEvents", |
|||
type: "nvarchar(2000)", |
|||
maxLength: 2000, |
|||
nullable: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "Link", |
|||
table: "AppEvents"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
@using EventHub.Localization |
|||
@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) |
|||
{ |
|||
if (Model.IsOnline && Model.Link != null) |
|||
{ |
|||
<a href="@Model.Link">@L["GoToEventAddress"]</a> |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (Model.IsOnline) |
|||
{ |
|||
<p>@L["AttendeesCanSeeEventLocation", "URL"]</p> |
|||
} |
|||
else |
|||
{ |
|||
<p>@L["AttendeesCanSeeEventLocation", "location"]</p> |
|||
} |
|||
} |
|||
</abp-card-body> |
|||
</abp-card> |
|||
@ -0,0 +1,64 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Events; |
|||
using EventHub.Events.Registrations; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace EventHub.Web.Pages.Events.Components.LocationArea |
|||
{ |
|||
[Widget( |
|||
AutoInitialize = true, |
|||
RefreshUrl = "/Widgets/EventLocationArea", |
|||
ScriptFiles = new[] {"/Pages/Events/Components/LocationArea/location-area.js"} |
|||
)] |
|||
public class LocationAreaViewComponent : AbpViewComponent |
|||
{ |
|||
private readonly IEventAppService _eventAppService; |
|||
private readonly IEventRegistrationAppService _eventRegistrationAppService; |
|||
private readonly ICurrentUser _currentUser; |
|||
|
|||
public LocationAreaViewComponent( |
|||
IEventAppService eventAppService, |
|||
IEventRegistrationAppService eventRegistrationAppService, |
|||
ICurrentUser currentUser) |
|||
{ |
|||
_eventAppService = eventAppService; |
|||
_eventRegistrationAppService = eventRegistrationAppService; |
|||
_currentUser = currentUser; |
|||
} |
|||
|
|||
public async Task<IViewComponentResult> InvokeAsync(Guid eventId) |
|||
{ |
|||
var isLoggedIn = _currentUser.IsAuthenticated; |
|||
|
|||
var model = new LocationAreaViewComponentModel |
|||
{ |
|||
EventId = eventId, |
|||
IsLoggedIn = isLoggedIn, |
|||
}; |
|||
|
|||
if (isLoggedIn) |
|||
{ |
|||
var @event = await _eventAppService.GetLocationAsync(eventId); |
|||
|
|||
model.IsOnline = @event.IsOnline; |
|||
model.IsRegistered = @event.IsRegistered; |
|||
model.Link = @event.Link; |
|||
} |
|||
|
|||
return View("~/Pages/Events/Components/LocationArea/Default.cshtml", model); |
|||
} |
|||
|
|||
public class LocationAreaViewComponentModel |
|||
{ |
|||
public Guid EventId { get; set; } |
|||
public bool IsLoggedIn { get; set; } |
|||
public bool IsRegistered { get; set; } |
|||
public bool IsOnline { get; set; } |
|||
public string Link { get; set; } |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
(function () { |
|||
abp.widgets.LocationArea = function ($wrapper) { |
|||
var eventId = $wrapper.find('[data-event-id]').attr('data-event-id'); |
|||
return { |
|||
getFilters: function () { |
|||
return { |
|||
eventId: eventId |
|||
}; |
|||
} |
|||
}; |
|||
}; |
|||
|
|||
abp.event.on("EventHub.Event.RegistrationStatusChanged", function(){ |
|||
$('[data-widget-name="LocationArea"]') |
|||
.data('abp-widget-manager') |
|||
.refresh(); |
|||
}); |
|||
})(); |
|||
@ -0,0 +1,9 @@ |
|||
$(function () { |
|||
$('#Event_IsOnline').click(function() { |
|||
if ($(this).is(':checked')) { |
|||
$("#event-link-form").show(); |
|||
}else{ |
|||
$("#event-link-form").hide(); |
|||
} |
|||
}); |
|||
}); |
|||
Loading…
Reference in new issue