From c7245492bbf7445117060d7c7fd5cb57c49ae7af Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Mon, 17 Oct 2022 11:39:18 +0100 Subject: [PATCH 1/7] error vc for collaborator view --- .../Views/Frameworks/Developer/Collaborators.cshtml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml index 7bbba52c64..e9356fed75 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml @@ -1,14 +1,18 @@ @using DigitalLearningSolutions.Web.ViewModels.Frameworks @model CollaboratorsViewModel @{ - ViewData["Title"] = "Framework Collaborators"; - ViewData["Application"] = "Framework Service"; - ViewData["HeaderPathName"] = "Framework Service"; + ViewData["Title"] = "Framework Collaborators"; + ViewData["Application"] = "Framework Service"; + ViewData["HeaderPathName"] = "Framework Service"; } @section NavMenuItems { } +@if (Model.Error) +{ + +} @if ((string)ViewContext.RouteData.Values["actionname"] == "New") { @section NavBreadcrumbs { From 6e5ca4706f1fbebc9b07aac1046096d33a745621 Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Mon, 17 Oct 2022 12:21:16 +0100 Subject: [PATCH 2/7] Error Display Update --- .../FrameworksController/Frameworks.cs | 4 ++-- .../Frameworks/Developer/Collaborators.cshtml | 20 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index 4aac5ee437..2d0ee7da25 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -680,11 +680,11 @@ public IActionResult AddCollaborator(string actionname, string userEmail, bool c } else if (collaboratorId == -2) { - TempData["FrameworkError"] = $"User with the email address {userEmail} has been previously added"; + TempData["FrameworkError"] = $"User with the email address has been previously added"; } else if (collaboratorId == -4) { - TempData["FrameworkError"] = $"The email address {userEmail} must match registered DLS Admin account"; + TempData["FrameworkError"] = $"The email address must match registered DLS Admin account"; } else { diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml index 96fcd4ebdd..8d4fac8f7d 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml @@ -13,7 +13,19 @@ } @if (Model.Error) { - + @**@ + } @if ((string)ViewContext.RouteData.Values["actionname"] == "New") { @@ -65,12 +77,6 @@ else {

Your framework has been created. Use this page to identify individuals who will be working on it with you.

} -@if (Model.Error) -{ - - Error: @errMsg - -}

Working Group Members

From 8bf74b515d3bdc0d00987127ba0b3e77f3c721ca Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Mon, 17 Oct 2022 14:22:15 +0100 Subject: [PATCH 3/7] Wording Tweak --- .../Controllers/FrameworksController/Frameworks.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index 2d0ee7da25..5419ba94cf 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -680,11 +680,11 @@ public IActionResult AddCollaborator(string actionname, string userEmail, bool c } else if (collaboratorId == -2) { - TempData["FrameworkError"] = $"User with the email address has been previously added"; + TempData["FrameworkError"] = $"A user with the email address has been previously added"; } else if (collaboratorId == -4) { - TempData["FrameworkError"] = $"The email address must match registered DLS Admin account"; + TempData["FrameworkError"] = $"The email address must match a registered DLS Admin account"; } else { From 07034dc563924823bd419b93e94a780a260c4081 Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Mon, 17 Oct 2022 15:21:53 +0100 Subject: [PATCH 4/7] Error Summary Display --- .../Controllers/FrameworksController/Frameworks.cs | 4 ++++ .../Frameworks/Developer/Collaborators.cshtml | 14 +------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index 5419ba94cf..187c28aaca 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -658,6 +658,10 @@ public IActionResult AddCollaborators(string actionname, int frameworkId, bool e Collaborators = collaborators, Error = false, }; + if (TempData["FrameworkError"] !=null) + { + ModelState.AddModelError("userEmail", TempData.Peek("FrameworkError").ToString()); + } return View("Developer/Collaborators", model); } diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml index 8d4fac8f7d..7d4320d2dc 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml @@ -13,19 +13,7 @@ } @if (Model.Error) { - @**@ - + } @if ((string)ViewContext.RouteData.Values["actionname"] == "New") { From 3e63f47c377406f151649c7bda6b86802a748bb3 Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Mon, 17 Oct 2022 15:23:15 +0100 Subject: [PATCH 5/7] Formating --- .../Controllers/FrameworksController/Frameworks.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index 187c28aaca..9b4e26d30f 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -658,7 +658,7 @@ public IActionResult AddCollaborators(string actionname, int frameworkId, bool e Collaborators = collaborators, Error = false, }; - if (TempData["FrameworkError"] !=null) + if (TempData["FrameworkError"] != null) { ModelState.AddModelError("userEmail", TempData.Peek("FrameworkError").ToString()); } From b9a63cc4c1acdfd044c8ebe00459cbc6af932196 Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Mon, 17 Oct 2022 15:33:50 +0100 Subject: [PATCH 6/7] Fix for 675 --- .../Controllers/FrameworksController/Competencies.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs index bec49e153d..784197529f 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs @@ -137,6 +137,9 @@ public IActionResult AddEditFrameworkCompetency(int frameworkId, int? frameworkC public IActionResult AddEditFrameworkCompetency(int frameworkId, FrameworkCompetency frameworkCompetency, int? frameworkCompetencyGroupId, int frameworkCompetencyId = 0, int[] selectedFlagIds = null) { frameworkCompetency.Description = SanitizerHelper.SanitizeHtmlData(frameworkCompetency.Description); + frameworkCompetency.Description?.Trim(); + var description = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(frameworkCompetency.Description)); + if (string.IsNullOrWhiteSpace(description)) { frameworkCompetency.Description = null; } if (!ModelState.IsValid) { ModelState.Remove(nameof(FrameworkCompetency.Name)); @@ -161,9 +164,7 @@ public IActionResult AddEditFrameworkCompetency(int frameworkId, FrameworkCompet if (userRole < 2) return StatusCode((int)HttpStatusCode.Forbidden); if (frameworkCompetency.Id > 0) { - frameworkCompetency.Description?.Trim(); - var description = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(frameworkCompetency.Description)); - if (string.IsNullOrWhiteSpace(description)) { frameworkCompetency.Description = null; } + frameworkService.UpdateFrameworkCompetency(frameworkCompetencyId, frameworkCompetency.Name, frameworkCompetency.Description, adminId); frameworkService.UpdateCompetencyFlags(frameworkId, frameworkCompetency.CompetencyID, selectedFlagIds); From 341a7b610dddbb47a2de6dfb1168470245a901e6 Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Mon, 17 Oct 2022 15:34:15 +0100 Subject: [PATCH 7/7] . --- .../Controllers/FrameworksController/Competencies.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs index 784197529f..af44129405 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs @@ -164,7 +164,7 @@ public IActionResult AddEditFrameworkCompetency(int frameworkId, FrameworkCompet if (userRole < 2) return StatusCode((int)HttpStatusCode.Forbidden); if (frameworkCompetency.Id > 0) { - + frameworkService.UpdateFrameworkCompetency(frameworkCompetencyId, frameworkCompetency.Name, frameworkCompetency.Description, adminId); frameworkService.UpdateCompetencyFlags(frameworkId, frameworkCompetency.CompetencyID, selectedFlagIds);