diff --git a/Management.Web/Shared/Module/ModuleDetail.razor b/Management.Web/Shared/Module/ModuleDetail.razor index 6d06808..8feb213 100644 --- a/Management.Web/Shared/Module/ModuleDetail.razor +++ b/Management.Web/Shared/Module/ModuleDetail.razor @@ -1,4 +1,3 @@ - @using Management.Web.Shared.Components @using Management.Web.Shared.Components.Quiz @using Management.Web.Shared.Module.Assignment @@ -13,28 +12,29 @@ @code { [Parameter, EditorRequired] public LocalModule Module { get; set; } = default!; - private bool dragging {get; set;} = false; + private bool dragging { get; set; } = false; + private bool publishing = false; private string _notes { get; set; } = ""; private string notes { get => _notes; set { - if(value != _notes) + if (value != _notes) { _notes = value; - if(planner.LocalCourse != null) + if (planner.LocalCourse != null) { var newModule = Module with { Notes = _notes }; var newModules = planner.LocalCourse.Modules.Select( - m => m.Name == newModule.Name - ? newModule - : m + m => m.Name == newModule.Name + ? newModule + : m ); - planner.LocalCourse = planner.LocalCourse with - { - Modules = newModules - }; + planner.LocalCourse = planner.LocalCourse with + { + Modules = newModules + }; } } } @@ -43,7 +43,7 @@ protected override void OnInitialized() { - if(_notes == string.Empty) + if (_notes == string.Empty) { _notes = Module.Notes; } @@ -59,21 +59,25 @@ planner.StateHasChanged -= reload; } - private string accordionId { + private string accordionId + { get => Module.Name.Replace(" ", "").Replace("#", "") + "-AccordionItem"; } - void OnDragEnter() { + void OnDragEnter() + { dragging = true; - } - void OnDragLeave() { + } + void OnDragLeave() + { dragging = false; } void OnDrop() { dragging = false; - if(dragContainer.DropCallback == null){ + if (dragContainer.DropCallback == null) + { System.Console.WriteLine("no drop callback set"); return; } @@ -85,76 +89,84 @@ .FirstOrDefault( cm => cm.Name == Module.Name ) != null; + private async Task Publish() + { + publishing = true; + await planner.CreateModule(Module); + publishing = false; + } } -
+

-

- + -
+
@*