From e5d955370a6a7797e3969c2f09243340d8971c88 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Sun, 22 Jun 2025 12:01:10 +0200 Subject: [PATCH] Edit Form: Move description to the bottom. Add RichTextEditor and AspNetCore.InputDate instead of HTML Input. --- .../Edit.razor | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor index 624afb0..6edc5af 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor @@ -1,6 +1,7 @@ @using Oqtane.Modules.Controls @using SZUAbsolventenverein.Module.EventRegistration.Services @using SZUAbsolventenverein.Module.EventRegistration.Models +@using Microsoft.AspNetCore.Components.Forms @namespace SZUAbsolventenverein.Module.EventRegistration @inherits ModuleBase @@ -17,22 +18,21 @@
- +
- +
- + +
-
- -
- -
+
+ +
@@ -56,13 +56,15 @@ new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } }; + + private RichTextEditor RichTextEditorHtml; private ElementReference form; private bool validated = false; private int _id; private string _name; private string _description; - private DateTime _eventDate; + private DateTime _eventDate = DateTime.Now; private string _location; private string _createdby; @@ -105,6 +107,10 @@ { validated = true; var interop = new Oqtane.UI.Interop(JSRuntime); + + string content = await RichTextEditorHtml.GetHtml(); + content = Utilities.FormatContent(content, PageState.Alias, "save"); + if (await interop.FormValid(form)) { if (PageState.Action == "Add") @@ -112,7 +118,7 @@ Event EventRegistration = new Event(); EventRegistration.ModuleId = ModuleState.ModuleId; EventRegistration.Name = _name; - EventRegistration.Description = _description; + EventRegistration.Description = content; EventRegistration.EventDate = _eventDate.ToUniversalTime(); EventRegistration.Location = _location; EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); @@ -122,7 +128,7 @@ { Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); EventRegistration.Name = _name; - EventRegistration.Description = _description; + EventRegistration.Description = content; EventRegistration.EventDate = _eventDate.ToUniversalTime(); EventRegistration.Location = _location; await EventRegistrationService.UpdateEventAsync(EventRegistration);