mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-27 07:58:31 -06:00
before i get in a deeper hole
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
@using Markdig
|
||||
|
||||
@inject CoursePlanner planner
|
||||
|
||||
@@ -29,6 +30,7 @@
|
||||
.LocalCourse?
|
||||
.AssignmentTemplates
|
||||
.FirstOrDefault(t => t.Id == TemplateId);
|
||||
public string Preview => Markdown.ToHtml(Description);
|
||||
|
||||
}
|
||||
|
||||
@@ -109,17 +111,35 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<label
|
||||
for="description"
|
||||
class="form-label"
|
||||
>
|
||||
Description
|
||||
</label>
|
||||
<textarea
|
||||
id="description"
|
||||
class="form-control"
|
||||
value="@Description"
|
||||
@oninput="async (e) =>
|
||||
await DescriptionChanged.InvokeAsync(e.Value?.ToString() ?? String.Empty)"
|
||||
/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<label
|
||||
for="description"
|
||||
class="form-label"
|
||||
>
|
||||
Description
|
||||
</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
HTML Preview
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<textarea
|
||||
id="description"
|
||||
class="form-control"
|
||||
value="@Description"
|
||||
rows=12
|
||||
@oninput="async (e) =>
|
||||
await DescriptionChanged.InvokeAsync(e.Value?.ToString() ?? String.Empty)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
@((MarkupString) Preview)
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -3,8 +3,6 @@
|
||||
@inject CoursePlanner planner
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
[EditorRequired]
|
||||
public LocalModule Module { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
@@ -94,6 +92,11 @@
|
||||
rubric = newRubric;
|
||||
StateHasChanged();
|
||||
}
|
||||
private void SetTypes(IEnumerable<string> newTypes)
|
||||
{
|
||||
submissionTypes = newTypes;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
<Modal @ref="AssignmentModal" OnHide="@(() => OnHide())">
|
||||
@@ -139,7 +142,7 @@
|
||||
<RubricEditor Rubric="rubric" SetRubric="updateRubric" />
|
||||
<SubmissionTypeSelector
|
||||
Types="submissionTypes"
|
||||
SetTypes="(newTypes) => submissionTypes = newTypes"
|
||||
SetTypes="SetTypes"
|
||||
/>
|
||||
</form>
|
||||
</Body>
|
||||
|
||||
@@ -22,6 +22,13 @@
|
||||
);
|
||||
StateHasChanged();
|
||||
}
|
||||
private void removeItem()
|
||||
{
|
||||
SetRubric(
|
||||
Rubric.Take(Rubric.Count() - 1)
|
||||
);
|
||||
StateHasChanged();
|
||||
}
|
||||
private void editItem(RubricItem newItem)
|
||||
{
|
||||
var newRubric = Rubric.Select(i => i.Id == newItem.Id ? newItem : i);
|
||||
@@ -71,6 +78,14 @@
|
||||
</ul>
|
||||
|
||||
<div class="text-end my-1">
|
||||
<button
|
||||
@onclick:preventDefault="true"
|
||||
@onclick="removeItem"
|
||||
type="button"
|
||||
class="btn btn-outline-danger"
|
||||
>
|
||||
- rubric item
|
||||
</button>
|
||||
<button
|
||||
@onclick:preventDefault="true"
|
||||
@onclick="addItem"
|
||||
|
||||
@@ -2,8 +2,16 @@
|
||||
|
||||
@code
|
||||
{
|
||||
private IEnumerable<string> _types { get; set; } = Enumerable.Empty<string>();
|
||||
[Parameter, EditorRequired]
|
||||
public IEnumerable<string> Types { get; set; } = Enumerable.Empty<string>();
|
||||
public IEnumerable<string> Types {
|
||||
get => _types;
|
||||
set
|
||||
{
|
||||
_types = value;
|
||||
renderKey++;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter, EditorRequired]
|
||||
public Action<IEnumerable<string>> SetTypes { get; set; } = (_) => {};
|
||||
@@ -11,36 +19,47 @@
|
||||
{
|
||||
return type.ToString().Replace("_", "") + "switch";
|
||||
}
|
||||
|
||||
private bool discussionIsSelected
|
||||
{
|
||||
get => Types.FirstOrDefault(
|
||||
t => t == SubmissionType.discussion_topic
|
||||
) != null;
|
||||
}
|
||||
private int renderKey {get; set; } = 1;
|
||||
}
|
||||
|
||||
<h5>Submission Types</h5>
|
||||
<div class="row">
|
||||
<div class="row" @key="Types">
|
||||
|
||||
@foreach (var submissionType in SubmissionType.AllTypes)
|
||||
{
|
||||
<div class="col-4">
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="@getLabel(submissionType)"
|
||||
checked="@Types.Contains(submissionType)"
|
||||
@onchange="(e) => {
|
||||
var isChecked = (bool)(e.Value ?? false);
|
||||
if(isChecked)
|
||||
SetTypes(Types.Append(submissionType));
|
||||
else
|
||||
SetTypes(Types.Where(t => t != submissionType));
|
||||
}"
|
||||
>
|
||||
<label
|
||||
class="form-check-label"
|
||||
for="@getLabel(submissionType)"
|
||||
>
|
||||
@submissionType
|
||||
</label>
|
||||
@foreach (var submissionType in SubmissionType.AllTypes)
|
||||
{
|
||||
var isDiscussion = submissionType == SubmissionType.discussion_topic;
|
||||
var allowedToBeChecked = !discussionIsSelected || isDiscussion;
|
||||
<div class="col-4">
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="@getLabel(submissionType)"
|
||||
checked="@(Types.Contains(submissionType) && allowedToBeChecked)"
|
||||
@onchange="(e) => {
|
||||
var isChecked = (bool)(e.Value ?? false);
|
||||
if(isChecked)
|
||||
SetTypes(Types.Append(submissionType));
|
||||
else
|
||||
SetTypes(Types.Where(t => t != submissionType));
|
||||
}"
|
||||
disabled="@(discussionIsSelected && !isDiscussion)"
|
||||
>
|
||||
<label
|
||||
class="form-check-label"
|
||||
for="@getLabel(submissionType)"
|
||||
>
|
||||
@submissionType
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
Reference in New Issue
Block a user