mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
restructured components so that there are more components in the pages
This commit is contained in:
74
Management.Web/Pages/Course/Course.razor
Normal file
74
Management.Web/Pages/Course/Course.razor
Normal file
@@ -0,0 +1,74 @@
|
||||
@page "/course/{CourseName}"
|
||||
@using CanvasModel.EnrollmentTerms
|
||||
@using CanvasModel.Courses
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@using LocalModels
|
||||
@using Management.Web.Shared.Module.Assignment
|
||||
@using Management.Web.Shared.Components
|
||||
|
||||
@inject FileStorageManager fileStorageManager
|
||||
@inject CanvasService canvas
|
||||
@inject CoursePlanner planner
|
||||
@inject NavigationManager navigtion
|
||||
@inject IConfiguration config
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string? CourseName { get; set; }
|
||||
|
||||
private bool loading = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (planner.LocalCourse == null)
|
||||
{
|
||||
var courses = await fileStorageManager.LoadSavedCourses();
|
||||
planner.LocalCourse = courses.First(c => c.Settings.Name == CourseName);
|
||||
}
|
||||
base.OnInitialized();
|
||||
loading = false;
|
||||
}
|
||||
|
||||
private void selectNewCourse()
|
||||
{
|
||||
planner.Clear();
|
||||
navigtion.NavigateTo("/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<PageTitle>@CourseName</PageTitle>
|
||||
<div style="height: 100vh;">
|
||||
|
||||
|
||||
@if (loading)
|
||||
{
|
||||
<Spinner />
|
||||
}
|
||||
|
||||
@if (planner.LocalCourse != null)
|
||||
{
|
||||
<div class="pb-3 d-flex justify-content-between" style="height: 4em;">
|
||||
<div class="my-auto">
|
||||
<button @onclick="selectNewCourse" class="btn btn-primary">
|
||||
Select New Course
|
||||
</button>
|
||||
<CourseSettings />
|
||||
<a class="btn btn-outline-secondary" target="_blank"
|
||||
href="@($"{config["CANVAS_URL"]}/courses/{planner.LocalCourse.Settings.CanvasId}")">
|
||||
View In Canvas
|
||||
</a>
|
||||
<div class="my-auto ms-2 d-inline">
|
||||
@planner.LocalCourse.Settings.Name
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (planner.LoadingCanvasData)
|
||||
{
|
||||
<Spinner />
|
||||
}
|
||||
</div>
|
||||
<CourseDetails />
|
||||
}
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user