changed casing of local assets

This commit is contained in:
2023-08-05 17:04:02 -06:00
parent 097bd635a2
commit 1ab0676881
16 changed files with 218 additions and 162 deletions

View File

@@ -6,25 +6,25 @@
{
[Parameter]
public string Description { get; set; } = default!;
[Parameter]
public bool UseTemplate { get; set; }
[Parameter]
public string? TemplateId { get; set; }
[Parameter]
public Dictionary<string, string> VariableValues { get; set; } = new Dictionary<string, string>();
[Parameter]
public EventCallback<string> DescriptionChanged { get; set; }
[Parameter]
public bool UseTemplate { get; set; }
[Parameter]
public EventCallback<bool> UseTemplateChanged { get; set; }
[Parameter]
public string? TemplateId { get; set; }
[Parameter]
public EventCallback<string?> TemplateIdChanged { get; set; }
[Parameter]
public Dictionary<string, string> VariableValues { get; set; } = new Dictionary<string, string>();
[Parameter]
public EventCallback<Dictionary<string, string>> VariableValuesChanged { get; set; }
private AssignmentTemplate? selectedTemplate =>
planner
.LocalCourse?

View File

@@ -19,7 +19,7 @@
[Parameter]
public Action OnHide { get; set; } = () => { };
public Modal AssignmentModal { get; set; } = default!;
public Modal? AssignmentModal { get; set; } = null;
private bool useTemplate { get; set; } = false;
private string? templateId { get; set; }
@@ -35,16 +35,16 @@
{
if(Show)
{
AssignmentModal.Show();
AssignmentModal?.Show();
}
name = Assignment.name;
description = Assignment.description;
lockAtDueDate = Assignment.lock_at_due_date;
rubric = Assignment.rubric;
submissionTypes = Assignment.submission_types;
templateId = Assignment.template_id;
useTemplate = Assignment.use_template;
templateVariables = Assignment.template_variables;
name = Assignment.Name;
description = Assignment.Description;
lockAtDueDate = Assignment.LockAtDueDate;
rubric = Assignment.Rubric;
submissionTypes = Assignment.SubmissionTypes;
templateId = Assignment.TemplateId;
useTemplate = Assignment.UseTemplate;
templateVariables = Assignment.TemplateVariables;
}
private void submitHandler()
@@ -56,15 +56,15 @@
var newAssignment = Assignment with
{
name=name,
description=description,
lock_at_due_date=lockAtDueDate,
rubric=rubric,
points_possible=totalRubricPoints,
submission_types=submissionTypes,
use_template=useTemplate,
template_id=templateId,
template_variables=templateVariables,
Name=name,
Description=description,
LockAtDueDate=lockAtDueDate,
Rubric=rubric,
PointsPossible=totalRubricPoints,
SubmissionTypes=submissionTypes,
UseTemplate=useTemplate,
TemplateId=templateId,
TemplateVariables=templateVariables,
};
if(planner.LocalCourse != null)
@@ -77,7 +77,7 @@
: Module with
{
Assignments=Module.Assignments.Select(a =>
a.id == newAssignment.id
a.Id == newAssignment.Id
? newAssignment
: a
)
@@ -85,7 +85,7 @@
)
};
}
AssignmentModal.Hide();
AssignmentModal?.Hide();
}
private void updateRubric(IEnumerable<RubricItem> newRubric)
{
@@ -101,7 +101,7 @@
<Modal @ref="AssignmentModal" OnHide="@(() => OnHide())">
<Title>
@Assignment.name
@Assignment.Name
</Title>
<Body>
<form @onsubmit:preventDefault="true" @onsubmit="submitHandler">

View File

@@ -23,7 +23,7 @@
private bool discussionIsSelected
{
get => Types.FirstOrDefault(
t => t == SubmissionType.discussion_topic
t => t == SubmissionType.DISCUSSION_TOPIC
) != null;
}
private int renderKey {get; set; } = 1;
@@ -34,7 +34,7 @@
@foreach (var submissionType in SubmissionType.AllTypes)
{
var isDiscussion = submissionType == SubmissionType.discussion_topic;
var isDiscussion = submissionType == SubmissionType.DISCUSSION_TOPIC;
var allowedToBeChecked = !discussionIsSelected || isDiscussion;
<div class="col-4">
<div class="form-check form-switch">

View File

@@ -1,5 +1,3 @@
@using Management.Web.Shared.Components
@code {
[Parameter, EditorRequired]
public RenderFragment? Title { get; set; }

View File

@@ -0,0 +1,42 @@
@using Management.Web.Shared.Components
@code {
public LocalModule Module { get; set; } = default!;
[Parameter]
[EditorRequired]
public LocalQuiz Quiz
{
get;
set;
} = default!;
[Parameter]
[EditorRequired]
public bool Show { get; set; }
[Parameter]
public Action OnHide { get; set; } = () => { };
private Modal? Modal { get; set; }
private void submitHandler ()
{
}
}
<Modal @ref="Modal" OnHide="@(() => OnHide())">
<Title>
@Quiz.Name
</Title>
<Body>
<form @onsubmit:preventDefault="true" @onsubmit="submitHandler">
</form>
</Body>
<Footer>
<button class="btn btn-primary" @onclick="submitHandler">
Save
</button>
</Footer>
</Modal>

View File

@@ -35,8 +35,8 @@
.Modules
.First(m =>
m.Assignments
.Select(a => a.id)
.Contains(Assignment.id)
.Select(a => a.Id)
.Contains(Assignment.Id)
) ?? throw new Exception("in day callback, could not find module");
@@ -52,11 +52,11 @@
var moduleWithUpdatedAssignment = currentModule with
{
Assignments = currentModule.Assignments.Select(a =>
a.id != Assignment.id
a.Id != Assignment.Id
? a
: a with
{
due_at=defaultDueTimeDate
DueAt=defaultDueTimeDate
}
)
};
@@ -79,11 +79,11 @@
m.Name != module.Name
? m with
{
Assignments = m.Assignments.Where(a => a.id != Assignment.id).DistinctBy(a => a.id)
Assignments = m.Assignments.Where(a => a.Id != Assignment.Id).DistinctBy(a => a.Id)
}
: m with
{
Assignments = m.Assignments.Append(Assignment).DistinctBy(a => a.id)
Assignments = m.Assignments.Append(Assignment).DistinctBy(a => a.Id)
}
);
@@ -98,7 +98,7 @@
{
if (module == null)
{
dropOnDate(dropDate ?? Assignment.due_at);
dropOnDate(dropDate ?? Assignment.DueAt);
}
else
{
@@ -119,7 +119,7 @@
planner
.CanvasAssignments?
.FirstOrDefault(
a => a.Id == Assignment.canvasId
a => a.Id == Assignment.CanvasId
) != null;
}
@@ -138,7 +138,7 @@
<div class="row mx-1">
<div class="col offset-2 offset-lg-1 ">
<h4 class="text-center m-0">
@Assignment.name
@Assignment.Name
</h4>
</div>
<div class="col-2 col-lg-1 text-end">
@@ -172,8 +172,8 @@
@if(!showAll)
{
<div class="card-text overflow-hidden p-2" style="max-height: 5rem;">
<div>Points: @Assignment.points_possible</div>
<div>Due At: @Assignment.due_at</div>
<div>Points: @Assignment.PointsPossible</div>
<div>Due At: @Assignment.DueAt</div>
</div>
}
else
@@ -185,12 +185,12 @@
</div>
<section class="px-3">
<div>Points: @Assignment.points_possible</div>
<div>Due At: @Assignment.due_at</div>
<div>Lock At: @Assignment.lock_at</div>
<div>Points: @Assignment.PointsPossible</div>
<div>Due At: @Assignment.DueAt</div>
<div>Lock At: @Assignment.LockAt</div>
<div>Submission Types:</div>
<ul>
@foreach(var type in Assignment.submission_types)
@foreach(var type in Assignment.SubmissionTypes)
{
<li>
@type

View File

@@ -13,22 +13,22 @@
[StringLength(50, ErrorMessage = "Name too long (50 character limit).")]
private string Name { get; set; } = "";
private Modal? modal { get; set; }
private Modal? modal { get; set; } = null;
private void submitHandler()
{
System.Console.WriteLine("new assignment");
var newAssignment = new LocalAssignment
{
id = Guid.NewGuid().ToString(),
name = Name,
description = "",
lock_at_due_date = true,
rubric = new RubricItem[] { },
lock_at = null,
due_at = DateTime.Now,
points_possible = 10,
submission_types = new string[] { SubmissionType.online_text_entry }
Id = Guid.NewGuid().ToString(),
Name = Name,
Description = "",
LockAtDueDate = true,
Rubric = new RubricItem[] { },
LockAt = null,
DueAt = DateTime.Now,
PointsPossible = 10,
SubmissionTypes = new string[] { SubmissionType.ONLINE_TEXT_ENTRY }
};
if(planner.LocalCourse != null)

View File

@@ -30,8 +30,8 @@
.Modules
.First(m =>
m.Assignments
.Select(a => a.id)
.Contains(Assignment.id)
.Select(a => a.Id)
.Contains(Assignment.Id)
) ?? throw new Exception("in day callback, could not find module");
var defaultDueTimeDate = new DateTime(
@@ -46,11 +46,11 @@
var moduleWithUpdatedAssignment = currentModule with
{
Assignments = currentModule.Assignments.Select(a =>
a.id != Assignment.id
a.Id != Assignment.Id
? a
: a with
{
due_at=defaultDueTimeDate
DueAt=defaultDueTimeDate
}
)
};
@@ -73,7 +73,7 @@
m.Name != module.Name
? m with
{
Assignments = m.Assignments.Where(a => a.id != Assignment.id)
Assignments = m.Assignments.Where(a => a.Id != Assignment.Id)
}
: m with
{
@@ -92,7 +92,7 @@
{
if (module == null)
{
dropOnDate(dropDate ?? Assignment.due_at);
dropOnDate(dropDate ?? Assignment.DueAt);
}
else
{
@@ -117,7 +117,7 @@
@onclick="@(() => showUpdateForm = true)"
role="button"
>
@Assignment.name
@Assignment.Name
</div>
<AssignmentForm

View File

@@ -35,7 +35,7 @@
else
return planner.LocalCourse.Modules
.SelectMany(m => m.Assignments)
.Where(a => a.due_at.Date == date?.Date);
.Where(a => a.DueAt.Date == date?.Date);
}
}
private string calculatedClass