mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38: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();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@inject AssignmentDragContainer dragContainer
|
||||
@inject CoursePlanner configurationManagement
|
||||
|
||||
@code
|
||||
{
|
||||
|
||||
4
Management.Web/Shared/Spinner.razor
Normal file
4
Management.Web/Shared/Spinner.razor
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
<div class="text-center m-3">
|
||||
<span class="loader"></span>
|
||||
</div>
|
||||
56
Management.Web/Shared/Spinner.razor.css
Normal file
56
Management.Web/Shared/Spinner.razor.css
Normal file
@@ -0,0 +1,56 @@
|
||||
.loader {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
border: 3px solid;
|
||||
border-color: #6c757d #6c757d transparent transparent;
|
||||
box-sizing: border-box;
|
||||
animation: rotation 2s linear infinite;
|
||||
}
|
||||
.loader::after,
|
||||
.loader::before {
|
||||
content: '';
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
border: 3px solid;
|
||||
border-color: transparent transparent #092565 #092565;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
animation: rotationBack 1s linear infinite;
|
||||
transform-origin: center center;
|
||||
}
|
||||
/* #092565 */
|
||||
/* #3a0647 */
|
||||
.loader::before {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-color: #6c757d #6c757d transparent transparent;
|
||||
animation: rotation 3s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotation {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@keyframes rotationBack {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(-360deg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user