added quiz popup form and displaying on month

This commit is contained in:
2023-08-11 20:13:55 -06:00
parent d16cd53392
commit 93c1c754cd
12 changed files with 160 additions and 68 deletions

View File

@@ -15,8 +15,6 @@
if (assignmentContext.Assignment != null)
{
Description = assignmentContext.Assignment.Description;
Console.WriteLine("loaded description");
Console.WriteLine(Description);
Preview = Markdown.ToHtml(Description);
TemplateId = assignmentContext.Assignment.TemplateId;
UseTemplate = TemplateId != null && TemplateId != "";

View File

@@ -118,39 +118,37 @@
<Body>
@if (assignmentContext.Assignment != null)
{
<form @onsubmit:preventDefault="true">
<div class="m-1">
<label class="form-label">
Name
</label>
<input
class="form-control"
@bind="name"
@oninput="handleNameChange"
/>
</div>
<div class="m-1">
<AssignmentDescriptionEditor />
</div>
<div class="m-1">
<label class="form-label">
Name
</label>
<input
class="form-control"
@bind="name"
@oninput="handleNameChange"
/>
</div>
<div class="m-1">
<AssignmentDescriptionEditor />
</div>
<div class="form-check m-1">
<input
class="form-check-input"
id="lockAtDueDate"
type="checkbox"
@bind="lockAtDueDate"
@oninput="handleLockAtDueDateChange"
/>
<label
class="form-check-label"
for="lockAtDueDate"
>
Lock At Due Date
</label>
</div>
<RubricEditor />
<SubmissionTypeSelector />
</form>
<div class="form-check m-1">
<input
class="form-check-input"
id="lockAtDueDate"
type="checkbox"
@bind="lockAtDueDate"
@oninput="handleLockAtDueDateChange"
/>
<label
class="form-check-label"
for="lockAtDueDate"
>
Lock At Due Date
</label>
</div>
<RubricEditor />
<SubmissionTypeSelector />
}
</Body>
<Footer>

View File

@@ -1,42 +1,41 @@
@using Management.Web.Shared.Components
@inject QuizEditorContext quizContext
@code {
public LocalModule Module { get; set; } = default!;
private Modal? modal { get; set; }
[Parameter]
[EditorRequired]
public LocalQuiz Quiz
protected override void OnInitialized()
{
get;
set;
} = default!;
[Parameter]
[EditorRequired]
public bool Show { get; set; }
[Parameter]
public Action OnHide { get; set; } = () => { };
private Modal? Modal { get; set; }
private void submitHandler ()
quizContext.StateHasChanged += reload;
}
private void reload()
{
if (quizContext.Quiz != null)
{
//initialize
modal?.Show();
this.InvokeAsync(this.StateHasChanged);
}
}
public void Dispose()
{
quizContext.StateHasChanged -= reload;
}
}
<Modal @ref="Modal" OnHide="@(() => OnHide())">
<Modal @ref="modal" OnHide="() => quizContext.Quiz = null" >
<Title>
@Quiz.Name
@quizContext.Quiz?.Name
</Title>
<Body>
<form @onsubmit:preventDefault="true" @onsubmit="submitHandler">
</form>
</Body>
<Footer>
<button class="btn btn-primary" @onclick="submitHandler">
Save
<button
class="btn btn-primary"
@onclick="() => modal?.Hide()"
>
Done
</button>
</Footer>
</Modal>