Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace DigitalLearningSolutions.Data.Migrations
{
using FluentMigrator;
[Migration(202609021546)]
public class Alter_Table_SelfAssessments : Migration
{
public override void Up()
{
Alter.Table("SelfAssessments")
.AlterColumn("ManageOptionalCompetenciesPrompt")
.AsString(2000)
.Nullable();
}

public override void Down()
{
Alter.Table("SelfAssessments")
.AlterColumn("ManageOptionalCompetenciesPrompt")
.AsString(1000)
.Nullable();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -775,9 +775,20 @@ public IActionResult SetOptionalCompetencyLearnerPrompt(int competencyAssessment
}
[HttpPost]
[Route("/Self-Assessment/{competencyAssessmentId}/{vocabularyPlural}/Optional/LearnerPrompt")]
public IActionResult SetOptionalCompetencyLearnerPrompt(SetOptionalCompetencyLearnerPromptFormData model)
public IActionResult SetOptionalCompetencyLearnerPrompt(SetOptionalCompetencyLearnerPromptViewModel model)
{

if (StringHelper.StripHtmlTags(model.ManageOptionalCompetenciesPrompt).Length > 1000)
{
ModelState.AddModelError(nameof(model.ManageOptionalCompetenciesPrompt), "Prompt text cannot exceed 1000 characters.");
return View("SetOptionalCompetencyLearnerPrompt", model);
}

if (model.ManageOptionalCompetenciesPrompt?.Length > 2000)
{
ModelState.AddModelError(nameof(model.ManageOptionalCompetenciesPrompt),
"The formatted content is too large to save.Please reduce the content or formatting.");
return View("SetOptionalCompetencyLearnerPrompt", model);
}
competencyAssessmentService.UpdateManageOptionalCompetenciesPrompt(model.ID, model.ManageOptionalCompetenciesPrompt);
return RedirectToAction("ManageOptionalCompetencies", new { competencyAssessmentId = model.ID, vocabularyPlural = model.VocabularyPlural });
}
Expand Down
3 changes: 3 additions & 0 deletions DigitalLearningSolutions.Web/Scripts/frameworks/htmleditor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Jodit } from 'jodit';
// eslint-disable-next-line import/extensions
import 'jodit/esm/plugins/all.js';
import DOMPurify from 'dompurify';

let jodited = false;
Expand Down Expand Up @@ -59,6 +61,7 @@ if (jodited === false) {
'ol', '|',
'undo', 'redo',
],
countTextSpaces: true,
style: {
backgroundColor: '#FFF',
},
Expand Down
3 changes: 2 additions & 1 deletion DigitalLearningSolutions.Web/Styles/jodit.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
@use "jodit/build/jodit.min";
@use "jodit/es2021/jodit.min.css";

.jodit-error {
border: 2px solid red !important;
border-radius: 4px;
}

.jodit-placeholder {
display: none !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

public class SetOptionalCompetencyLearnerPromptViewModel : SetOptionalCompetencyLearnerPromptFormData
{
public SetOptionalCompetencyLearnerPromptViewModel()
{
}

public SetOptionalCompetencyLearnerPromptViewModel(CompetencyAssessmentBase competencyAssessmentBase, IEnumerable<Competency> competencies)
{
ID = competencyAssessmentBase.ID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@{
ViewData["Title"] = $"Set optional {Model.VocabularyPlural.ToLower()} learner prompt";
ViewData["Application"] = "Framework service";
var errorHasOccurred = !ViewData.ModelState.IsValid && ViewData.ModelState.ContainsKey(nameof(Model.ManageOptionalCompetenciesPrompt));
}
<link rel="stylesheet" href="@Url.Content("~/css/jodit.css")" asp-append-version="true">
<link rel="stylesheet" href="@Url.Content("~/css/frameworks/frameworksShared.css")" asp-append-version="true">
Expand All @@ -24,6 +25,10 @@
</nav>
}
<div class="nhsuk-form-group">
@if (errorHasOccurred)
{
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.ManageOptionalCompetenciesPrompt) })" />
}
<h1 class="app-page-heading">
<span class="nhsuk-caption-xl">
@Model.CompetencyAssessmentName
Expand All @@ -45,12 +50,12 @@
hint-text="This text will be displayed above the optional @Model.VocabularyPlural.ToLower() list."
populate-with-current-value="true"
spell-check="false" />
<span nhs-validation-for="ManageOptionalCompetenciesPrompt"></span>
</nhs-form-group>
<input type="hidden" asp-for="ID" />
<input type="hidden" asp-for="VocabularyPlural" />
<input type="hidden" asp-for="VocabularySingular" />
<input type="hidden" asp-for="PublishStatusID" />
<input type="hidden" asp-for="CompetencyAssessmentName" />

<hr class="nhsuk-section-break nhsuk-section-break--m" />
<button class="nhsuk-button" type="submit">
Expand Down
2 changes: 1 addition & 1 deletion DigitalLearningSolutions.Web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"date-fns": "^2.30.0",
"dompurify": "^2.5.9",
"input-range-scss": "^1.5.3",
"jodit": "^3.24.9",
"jodit": "4.14.2",
"js-cookie": "^3.0.8",
"js-search": "^2.0.1",
"lodash": "^4.18.1",
Expand Down
18 changes: 5 additions & 13 deletions DigitalLearningSolutions.Web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2084,11 +2084,6 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==

autobind-decorator@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/autobind-decorator/-/autobind-decorator-2.4.0.tgz#ea9e1c98708cf3b5b356f7cf9f10f265ff18239c"
integrity sha512-OGYhWUO72V6DafbF8PM8rm3EPbfuyMZcJhtm5/n26IDwO18pohE4eNazLoCGhPiXOCD0gEGmrbU3849QvM8bbw==

available-typed-arrays@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846"
Expand Down Expand Up @@ -2481,7 +2476,7 @@ core-js-compat@^3.48.0:
dependencies:
browserslist "^4.28.1"

core-js@^3.28.0, core-js@^3.49.0:
core-js@^3.49.0:
version "3.49.0"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.49.0.tgz#8b4d520ac034311fa21aa616f017ada0e0dbbddd"
integrity sha512-es1U2+YTtzpwkxVLwAFdSpaIMyQaq0PBgm3YD1W3Qpsn1NAmO3KSgZfu+oGSWVu6NvLHoHCV/aYcsE5wiB7ALg==
Expand Down Expand Up @@ -4431,13 +4426,10 @@ jest@^28.1.3:
import-local "^3.0.2"
jest-cli "^28.1.3"

jodit@^3.24.9:
version "3.24.9"
resolved "https://registry.yarnpkg.com/jodit/-/jodit-3.24.9.tgz#575a0218996f31003c230f81db0f056132dea9b5"
integrity sha512-t2d73v7GFbGI08ZzdCTwrzi8ZtoOG4icGzD6IIN2e+ghlpUKYxcHZ/Rmy6/mc6055172z+tv7QSr9BcOz6IOFQ==
dependencies:
autobind-decorator "^2.4.0"
core-js "^3.28.0"
jodit@4.14.2:
version "4.14.2"
resolved "https://registry.yarnpkg.com/jodit/-/jodit-4.14.2.tgz#bd25cef983fe3d085f63ed1798dab53249aa1048"
integrity sha512-+/VWCJZaRpEOVqVw+20vCf3z7SiE9zxrr6EMoFGa3EKvcDv2HEql3d5TBEWCJzecxA9z5SxPDZUHQiRpyxz98Q==

js-cookie@^3.0.8:
version "3.0.8"
Expand Down
Loading