mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
more component refactoring
This commit is contained in:
50
Management.Web/Pages/Course/Module/Modules.razor
Normal file
50
Management.Web/Pages/Course/Module/Modules.razor
Normal file
@@ -0,0 +1,50 @@
|
||||
@using Management.Web.Pages.Course.Module
|
||||
@using System.Linq
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
|
||||
@inject CoursePlanner planner
|
||||
|
||||
@code {
|
||||
private bool showNewModule { get; set; } = false;
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
planner.StateHasChanged += reload;
|
||||
}
|
||||
private void reload()
|
||||
{
|
||||
this.InvokeAsync(this.StateHasChanged);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
planner.StateHasChanged -= reload;
|
||||
}
|
||||
}
|
||||
|
||||
<div class="row justify-content-end mb-1">
|
||||
<div class="col-auto">
|
||||
@if (!showNewModule)
|
||||
{
|
||||
<button class="btn btn-outline-secondary" @onclick="() => showNewModule = true">New Module</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-outline-secondary" @onclick="() => showNewModule = false">Hide New Module</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (showNewModule)
|
||||
{
|
||||
<NewModule OnSubmit="() => showNewModule = false" />
|
||||
}
|
||||
|
||||
@if (planner.LocalCourse != null)
|
||||
{
|
||||
<div class="accordion" id="modulesAccordion">
|
||||
|
||||
@foreach (var module in planner.LocalCourse.Modules)
|
||||
{
|
||||
<ModuleDetail Module="module" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
Reference in New Issue
Block a user