referencing courses directly from canvas

This commit is contained in:
2023-07-15 23:19:39 -06:00
parent 5ece8b9d36
commit ed1963c67b
27 changed files with 370 additions and 249 deletions

View File

@@ -4,7 +4,7 @@
[Parameter]
[Required]
public LocalAssignment assignment { get; set; } = new();
private async Task HandleDragStart()
private async Task HandleDragStart()
{
dragContainer.AssignmentBeingDragged = assignment;
System.Console.WriteLine("assignment set");

View File

@@ -1,4 +1,5 @@
@inject IModuleManager moduleManager
@inject CoursePlanner configurationManagement
@code {
@@ -16,6 +17,7 @@
{
var newAssignment = new LocalAssignment
{
id = Guid.NewGuid().ToString(),
name = Name,
description = "testDescription",
published = false,
@@ -26,7 +28,7 @@
points_possible = 10,
submission_types = new SubmissionType[] { SubmissionType.online_text_entry }
};
moduleManager.AddAssignment(ModuleIndex, newAssignment);
configurationManagement.Assignments = configurationManagement.Assignments.Append(newAssignment);
await OnSubmit.InvokeAsync();
}
}

View File

@@ -1,5 +1,5 @@
@using Management.Web.Shared.Module.Assignment
@inject IModuleManager moduleManager
@inject CoursePlanner configurationManagement
@code {
[Parameter, EditorRequired]
@@ -11,7 +11,7 @@
{
get
{
return moduleManager.Modules.ElementAtOrDefault(ModuleIndex);
return configurationManagement.Modules.ElementAtOrDefault(ModuleIndex);
}
}
}

View File

@@ -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>

View File

@@ -1,4 +1,4 @@
@inject IModuleManager moduleManager
@inject CoursePlanner configurationManagement
@code {
@@ -12,7 +12,7 @@
private async Task submitHandler()
{
var module = new CourseModule(Name: Name, Assignments: new LocalAssignment[] { });
moduleManager.AddModule(module);
configurationManagement.Modules = configurationManagement.Modules.Append(module);
Name = "";
await OnSubmit.InvokeAsync();
}