Spielablauf umgesetzt
This commit is contained in:
1 parent
749bdb5179
commit
1097ab98fc
29 files changed
+828
-148
No files matched your search
@@ -12,6 +12,10 @@
|
||||
<label class="form-label" for="name">Name</label>
|
||||
<input id="name" name="name" type="text" class="form-control" @bind="@SelectedItem.Name" />
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input class="form-check-input" type="checkbox" @bind="@SelectedItem.IsMultipleChoice" id="chkMultipleChoice"/>
|
||||
<label class="form-check-label" for="chkMultipleChoice">Is Multiple-Choice</label>
|
||||
</div>
|
||||
<h3>Question Groups</h3>
|
||||
<div class="input-group m-3">
|
||||
<input id="qgnew" name="qgnew" type="text" class="form-control" @bind="@NewQuestionGroup" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@page "/settings/quizzes/questions/{id}"
|
||||
@using FWLAZ_Web.Data
|
||||
@using FWLAZ_Web.Objects
|
||||
@using Microsoft.EntityFrameworkCore;
|
||||
@inject IDbContextFactory<LocalDbContext> DbFactory;
|
||||
@inject NavigationManager nav;
|
||||
@@ -32,7 +33,14 @@
|
||||
{
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0" type="checkbox" @bind="aw.IsCorrect" @onkeyup="AddQuestion_Enter" />
|
||||
@* @if (SelectedItem.IsMultipleChoice)
|
||||
{ *@
|
||||
<input class="form-check-input mt-0" type="checkbox" @bind="aw.IsCorrect" @onkeyup="AddQuestion_Enter" />
|
||||
@* }
|
||||
else
|
||||
{
|
||||
<input class="form-check-input mt-0" type="radio" @onchange="() => SetSingleChoiceAnswer(NewQuestion, aw)" name="NewQuestion_Answers" @onkeyup="AddQuestion_Enter" />
|
||||
} *@
|
||||
</div>
|
||||
<input class="form-control col-sm" style="max-width:70px;" type="text" @bind="aw.Position" @onkeyup="AddQuestion_Enter" />
|
||||
<input class="form-control" type="text" @bind="aw.Text" @onkeyup="AddQuestion_Enter" />
|
||||
@@ -156,9 +164,11 @@
|
||||
private void PrepareNewQuestion()
|
||||
{
|
||||
NewQuestion = new();
|
||||
if (SelectedItem.Questions.Count > 0) {
|
||||
if (SelectedItem.Questions.Count > 0)
|
||||
{
|
||||
NewQuestion.Number = SelectedItem.Questions.Max(q => q.Number) + 1;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
NewQuestion.Number = 1;
|
||||
}
|
||||
@@ -169,6 +179,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSingleChoiceAnswer(Question question, Answer answer)
|
||||
{
|
||||
question.Answers.ForEach(aw => aw.IsCorrect = false);
|
||||
answer.IsCorrect = true;
|
||||
}
|
||||
|
||||
private async Task AddQuestion_Enter(KeyboardEventArgs e)
|
||||
{
|
||||
if (e.Code == "Enter" || e.Code == "NumpadEnter") await AddQuestion(new MouseEventArgs());
|
||||
@@ -243,17 +259,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
public class QuestionGroupSelect
|
||||
{
|
||||
public bool Checked { get; set; }
|
||||
|
||||
public QuestionGroup questionGroup { get; }
|
||||
|
||||
public QuestionGroupSelect(QuestionGroup questionGroup)
|
||||
{
|
||||
this.questionGroup = questionGroup;
|
||||
}
|
||||
}
|
||||
private async Task SaveQuiz(MouseEventArgs e)
|
||||
{
|
||||
foreach (Question question in SelectedItem.Questions)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<a class="btn btn-primary mb-3" href="/settings/quizzes/edit">Neues Quiz</a>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-bordered table-dark border-dark">
|
||||
<table class="table table-striped table-hover table-bordered">
|
||||
<tbody>
|
||||
@foreach (Quiz q in QuizList)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user