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:
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user