Browse Source

Add missing localizations for edit event page

pull/21/head
EngincanV 6 years ago
parent
commit
6a6466e87c
  1. 2
      src/EventHub.Application.Contracts/Events/Registrations/IEventRegistrationAppService.cs
  2. 9
      src/EventHub.Application/Events/Registrations/EventRegistrationAppService.cs
  3. 15
      src/EventHub.Domain.Shared/Localization/EventHub/en.json
  4. 22
      src/EventHub.Web/Pages/Events/Edit.cshtml
  5. 9
      src/EventHub.Web/Pages/Events/Edit.cshtml.cs
  6. 2
      src/EventHub.Web/Pages/Events/Edit.js
  7. 2
      src/EventHub.Web/Pages/Organizations/Edit.cshtml

2
src/EventHub.Application.Contracts/Events/Registrations/IEventRegistrationAppService.cs

@ -14,5 +14,7 @@ namespace EventHub.Events.Registrations
Task<bool> IsRegisteredAsync(Guid eventId);
Task<PagedResultDto<EventAttendeeDto>> GetAttendeesAsync(Guid eventId);
Task<int> GetAttendeeCountAsync(Guid eventId);
}
}

9
src/EventHub.Application/Events/Registrations/EventRegistrationAppService.cs

@ -80,5 +80,14 @@ namespace EventHub.Events.Registrations
ObjectMapper.Map<List<AppUser>, List<EventAttendeeDto>>(users)
);
}
public async Task<int> GetAttendeeCountAsync(Guid eventId)
{
var eventRegistrationQueryable = await _eventRegistrationRepository.GetQueryableAsync();
var query = eventRegistrationQueryable.Where(x => x.EventId == eventId);
return await AsyncExecuter.CountAsync(query);
}
}
}

15
src/EventHub.Domain.Shared/Localization/EventHub/en.json

@ -70,6 +70,19 @@
"ChooseEventCoverImage": "Choose event cover image...",
"EventCoverImageSizeExceedMessage": "The image is too large to upload. Max image size: 1MB.",
"EventCoverImageExtensionNotAllowed": "This image extension is not allowed. Allowed extensions: png, jpg, jpeg",
"ChooseEventCoverImageInfo": "Maximum image size: 1MB."
"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}",
"EventTiming": "Event Timing",
"Note": "Note",
"EventTimingChangeCountWarningMessage": "You can not change the event timing more than two times.",
"EventTimingChangeEmailNotificationMessage": "If you change the event times, an informational email will be sent to all attendees.",
"EventCoverImage": "Event Cover Image",
"EventTimingPreview": "Event Timing Preview",
"CoverImagePreview": "Cover Image Preview",
"EventTimingChangeSuccessMessage": "The time of the event has been changed successfully!"
}
}

22
src/EventHub.Web/Pages/Events/Edit.cshtml

@ -11,10 +11,10 @@
<input type="hidden" value="@Model.Url" id="event-detail-url"/>
<div class="container mb-4">
<h1>Edit Event</h1>
<h1>@L["EditEvent"]</h1>
<abp-tabs tab-style="Pill">
<abp-tab title="Event Information">
<form method="post" class="mt-3">
<abp-tab title="@(L["EventInformation"].Value)">
<form method="post" class="mt-3" id="Event_Information_Form">
<abp-input asp-for="Event.Id"/>
<abp-input asp-for="Event.Title"/>
<abp-input asp-for="Event.Description"/>
@ -30,17 +30,17 @@
</div>
<abp-select asp-for="Event.Language"/>
<abp-input asp-for="Event.Capacity"/>
<abp-input label="@(L["EventCapacityLabel"].Value)" info="@(L["EventCapacityInfo", Model.AttendeeCount].Value)" asp-for="Event.Capacity" name="capacity" min="@Model.AttendeeCount"/>
<abp-button size="Large" button-type="Primary" type="submit" text="@L["Submit"].Value"/>
</form>
</abp-tab>
<abp-tab title="Event Timing">
<abp-tab title="@(L["EventTiming"].Value)">
<div class="alert alert-info mt-3" role="alert" >
Note: You can not change the event timing more than two times.
<b>@L["Note"]</b> : @L["EventTimingChangeCountWarningMessage"]
</div>
<div class="alert alert-warning mt-3" role="alert">
Note: If you change the event times, an informational email will be sent to all attendees
<b>@L["Note"]</b> : @L["EventTimingChangeEmailNotificationMessage"]
</div>
<form method="post" id="Event_Timing_Form">
<abp-input asp-for="EventTiming.Id"/>
@ -50,7 +50,7 @@
<abp-button size="Large" button-type="Primary" type="button" id="btn-event-timing" text="@L["Submit"].Value"/>
</form>
</abp-tab>
<abp-tab title="Event Cover Image">
<abp-tab title="@(L["EventCoverImage"])">
<form method="post" id="cover-image-form" class="mt-3">
<input type="hidden" id="event-id" value="@Model.Event.Id"/>
<abp-row>
@ -71,9 +71,9 @@
</abp-tab>
</abp-tabs>
<abp-modal centered="true" scrollable="true" size="Large" id="event-timing-preview-modal">
<abp-modal-header title="Event Timing Preview"></abp-modal-header>
<abp-modal-header title="@(L["EventTimingPreview"].Value)"></abp-modal-header>
<abp-modal-body>
If you change the event times, an informational email will be sent to all attendees.
@L["EventTimingChangeEmailNotificationMessage"]
</abp-modal-body>
<abp-modal-footer>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
@ -82,7 +82,7 @@
</abp-modal>
<abp-modal centered="true" scrollable="true" size="Small" id="cover-image-preview-modal">
<abp-modal-header title="Cover Image Preview"></abp-modal-header>
<abp-modal-header title="@L["CoverImagePreview"]"></abp-modal-header>
<abp-modal-body>
<img class="img-fluid" id="img-upload" alt="event-cover-image-preview"/>
</abp-modal-body>

9
src/EventHub.Web/Pages/Events/Edit.cshtml.cs

@ -6,6 +6,7 @@ using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using EventHub.Events;
using EventHub.Events.Registrations;
using EventHub.Web.Helpers;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Http;
@ -26,15 +27,19 @@ namespace EventHub.Web.Pages.Events
[BindProperty]
public EditEventTimingViewModel EventTiming { get; set; }
public int AttendeeCount { get; set; }
public List<SelectListItem> Countries { get; private set; }
public List<SelectListItem> Languages { get; private set; }
private readonly IEventAppService _eventAppService;
private readonly IEventRegistrationAppService _eventRegistrationAppService;
public EditPageModel(IEventAppService eventAppService)
public EditPageModel(IEventAppService eventAppService, IEventRegistrationAppService eventRegistrationAppService)
{
_eventAppService = eventAppService;
_eventRegistrationAppService = eventRegistrationAppService;
}
public async Task OnGetAsync()
@ -48,6 +53,8 @@ namespace EventHub.Web.Pages.Events
FillLanguages();
await FillCountriesAsync();
await GetLocationInfoAsync();
AttendeeCount = await _eventRegistrationAppService.GetAttendeeCountAsync(Event.Id);
}
public async Task<IActionResult> OnPostAsync()

2
src/EventHub.Web/Pages/Events/Edit.js

@ -48,7 +48,7 @@ $(function () {
data: data,
success: function (data) {
abp.message
.success("Timing changed successfully!") //TODO: localize it!
.success(l("EventTimingChangeSuccessMessage"))
.then(data => window.location.href = "/events/" + $("#event-detail-url").val());
},
error: function (data) {

2
src/EventHub.Web/Pages/Organizations/Edit.cshtml

@ -40,7 +40,7 @@
</abp-tabs>
<abp-modal centered="true" scrollable="true" size="Large" id="profile-picture">
<abp-modal-header title="Profile Picture Preview"></abp-modal-header>
<abp-modal-header title="@(L["ProfilePicturePreview"].Value)"></abp-modal-header>
<abp-modal-body>
<img class="img-fluid" id="img-upload" alt=""/>
</abp-modal-body>

Loading…
Cancel
Save