mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
referencing courses directly from canvas
This commit is contained in:
@@ -2,31 +2,22 @@
|
||||
@using System.Linq
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
|
||||
@inject IModuleManager moduleManager
|
||||
@inject CoursePlanner configurationManagement
|
||||
@inject ProtectedLocalStorage BrowserStorage
|
||||
@inject StorageManagement storage
|
||||
|
||||
@code {
|
||||
private bool showNewModule { get; set; } = false;
|
||||
private string moduleStorageKey = "module storage key";
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
await BrowserStorage.SetAsync(moduleStorageKey, moduleManager.Modules);
|
||||
|
||||
}
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if(firstRender)
|
||||
{
|
||||
var storedModules = await BrowserStorage.GetAsync<IEnumerable<CourseModule>>(moduleStorageKey);
|
||||
if (storedModules.Success) {
|
||||
moduleManager.Modules = storedModules.Value ?? throw new Exception("stored modules was null, it shouldn't have been");
|
||||
} else {
|
||||
Console.WriteLine("no stored modules");
|
||||
}
|
||||
await storage.LoadStoredConfig();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@if (!showNewModule)
|
||||
@@ -43,7 +34,7 @@ else
|
||||
<NewModule OnSubmit="() => showNewModule = false" />
|
||||
}
|
||||
|
||||
@foreach (var i in moduleManager.Modules.Select((_value, i) => i))
|
||||
@foreach (var i in configurationManagement.Modules.Select((_value, i) => i))
|
||||
{
|
||||
<hr>
|
||||
<ModuleDetail ModuleIndex="i" />
|
||||
@@ -53,7 +44,7 @@ else
|
||||
<div class="text-center">
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
@onclick="Save"
|
||||
@onclick="@(async () => await storage.Save())"
|
||||
>
|
||||
Save Modules
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user