Skip to content

Commit 5407a45

Browse files
committed
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.3.0
2 parents a20cb10 + a3bed08 commit 5407a45

File tree

10 files changed

+65
-74
lines changed

10 files changed

+65
-74
lines changed

DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,7 @@ Competencies AS c INNER JOIN
24352435
CompetencyGroups AS cg ON fcg.CompetencyGroupID = cg.ID
24362436
WHERE (fc.FrameworkID = @frameworkId)
24372437
GROUP BY fc.ID, c.ID, cg.Name, cg.Description, c.Name, c.Description, c.AlwaysShowDescription, fcg.Ordering, fc.Ordering
2438-
ORDER BY COALESCE(fcg.Ordering,99999), fc.Ordering",
2438+
ORDER BY COALESCE(fcg.Ordering,99999), fc.Ordering, fc.ID",
24392439
new { frameworkId }
24402440
);
24412441
}
@@ -2448,7 +2448,7 @@ public List<int> GetFrameworkCompetencyOrder(int frameworkId, List<int> framewor
24482448
FROM FrameworkCompetencies AS fc LEFT JOIN
24492449
FrameworkCompetencyGroups AS fcg ON fc.FrameworkCompetencyGroupID = fcg.ID
24502450
WHERE (fc.FrameworkID = @frameworkId) AND (fc.ID IN @frameworkCompetencyIds)
2451-
ORDER BY COALESCE(fcg.Ordering,99999), fc.Ordering",
2451+
ORDER BY COALESCE(fcg.Ordering,99999), fc.Ordering, fc.ID",
24522452
new { frameworkId, frameworkCompetencyIds }
24532453
).ToList();
24542454
}

DigitalLearningSolutions.Web/Controllers/Support/RequestSupportTicketController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public IActionResult SetRequestSummary(DlsSubApplication dlsSubApplication, Requ
137137
// Check if RequestDescription is null or contains any default empty tags ("<p><br></p>").
138138
// This ensures that when a user navigates to the submit page and returns to SetRequestSummary,
139139
// removing the description completely results in an actual empty value rather than leftover HTML tags.
140-
if (requestDetailsmodel.RequestDescription == "<p><br></p>")
140+
if (string.IsNullOrEmpty(StringHelper.StripHtmlTags(requestDetailsmodel.RequestDescription)))
141141
{
142142
ModelState.AddModelError("RequestDescription", "Please enter request description");
143143
}
@@ -246,7 +246,7 @@ public IActionResult SupportSummary(DlsSubApplication dlsSubApplication, Support
246246
var data = multiPageFormService.GetMultiPageFormData<RequestSupportTicketData>(
247247
MultiPageFormDataFeature.AddCustomWebForm("RequestSupportTicketCWF"),
248248
TempData
249-
).GetAwaiter().GetResult();
249+
).GetAwaiter().GetResult();
250250
var model = new SupportSummaryViewModel(data);
251251
return View("SupportTicketSummaryPage", model);
252252
}
@@ -262,7 +262,7 @@ public IActionResult SubmitSupportSummary(DlsSubApplication dlsSubApplication, S
262262
var data = multiPageFormService.GetMultiPageFormData<RequestSupportTicketData>(
263263
MultiPageFormDataFeature.AddCustomWebForm("RequestSupportTicketCWF"),
264264
TempData
265-
).GetAwaiter().GetResult();
265+
).GetAwaiter().GetResult();
266266
data.GroupId = configuration.GetFreshdeskCreateTicketGroupId();
267267
data.ProductId = configuration.GetFreshdeskCreateTicketProductId();
268268
List<RequestAttachment> RequestAttachmentList = new List<RequestAttachment>();
@@ -354,7 +354,7 @@ private void setRequestSupportTicketData(RequestSupportTicketData requestSupport
354354
{
355355
foreach (var item in requestAttachmentmodel.RequestAttachment)
356356
{
357-
totalFileSize = totalFileSize + item.SizeMb??0;
357+
totalFileSize = totalFileSize + item.SizeMb ?? 0;
358358
}
359359
}
360360
foreach (var item in requestAttachmentmodel.ImageFiles)

DigitalLearningSolutions.Web/Helpers/StringHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public static string StripHtmlTags(string input)
2626

2727
// Remove HTML tags
2828
string result = Regex.Replace(input, "<.*?>", string.Empty).Trim();
29-
30-
return string.IsNullOrEmpty(result) ? string.Empty : result;
29+
result = System.Net.WebUtility.HtmlDecode(result);
30+
return string.IsNullOrEmpty(result.Trim()) ? string.Empty : result;
3131
}
3232
}
3333
}

DigitalLearningSolutions.Web/Scripts/frameworks/htmleditor.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Jodit } from 'jodit';
1+
import { Jodit } from 'jodit';
22
import DOMPurify from 'dompurify';
33

44
let jodited = false;
@@ -70,5 +70,31 @@ if (jodited === false) {
7070
const clean = DOMPurify.sanitize(editor.editor.innerHTML);
7171
editor.editor.innerHTML = clean;
7272
});
73+
const textarea = document.querySelector('.nhsuk-textarea.html-editor.nhsuk-input--error') as HTMLTextAreaElement | null;
74+
if (textarea) {
75+
const editorDiv = document.querySelector('.jodit-container.jodit.jodit_theme_default.jodit-wysiwyg_mode') as HTMLDivElement | null;
76+
editorDiv?.classList.add('jodit-container', 'jodit', 'jodit_theme_default', 'jodit-wysiwyg_mode', 'jodit-error');
77+
}
78+
79+
const summary = document.querySelector('.nhsuk-list.nhsuk-error-summary__list') as HTMLDivElement | null;
80+
81+
if (summary) {
82+
summary.addEventListener('click', (e: Event) => {
83+
if (textarea) {
84+
const textareaId = textarea.id.toString();
85+
const target = e.target as HTMLElement;
86+
if (target.tagName.toLowerCase() === 'a') {
87+
const href = (target as HTMLAnchorElement).getAttribute('href');
88+
89+
if (href && href.includes(textareaId)) {
90+
const editorArea = document.querySelector('.jodit-wysiwyg') as HTMLDivElement | null;
91+
editorArea?.focus();
92+
editorArea?.scrollIntoView({ behavior: 'smooth', block: 'center' });
93+
e.preventDefault();
94+
}
95+
}
96+
}
97+
});
98+
}
7399
}
74100
}

DigitalLearningSolutions.Web/Services/ImportCompetenciesFromFileService.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ImportCompetenciesResult PreProcessCompetenciesTable(IXLWorkbook workbook
4141
.Select(row => row.Name)
4242
.Distinct()
4343
.ToList();
44-
var newGroups = competencyRows.Select(row => row.CompetencyGroup ?? "").ToList();
44+
var newGroups = competencyRows.Select(row => row.CompetencyGroup ?? "").Distinct().ToList();
4545
foreach (var competencyRow in competencyRows)
4646
{
4747
PreProcessCompetencyRow(competencyRow, newCompetencyIds, existingIds, existingGroups, newGroups);
@@ -74,11 +74,14 @@ private void PreProcessCompetencyRow(CompetencyTableRow competencyRow, List<int>
7474
else
7575
{
7676
var groupName = (string)(competencyRow?.CompetencyGroup);
77-
originalIndex = existingGroups.IndexOf(groupName);
78-
newIndex = newGroups.IndexOf(groupName);
79-
if (originalIndex != newIndex)
77+
if (!string.IsNullOrWhiteSpace(groupName))
8078
{
81-
competencyRow.Reordered = true;
79+
originalIndex = existingGroups.IndexOf(groupName);
80+
newIndex = newGroups.IndexOf(groupName);
81+
if (originalIndex != newIndex)
82+
{
83+
competencyRow.Reordered = true;
84+
}
8285
}
8386
}
8487
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
@use "jodit/build/jodit.min";
2+
3+
.jodit-error {
4+
border: 2px solid red !important;
5+
border-radius: 4px;
6+
}

DigitalLearningSolutions.Web/ViewModels/Support/RequestSupportTicket/RequestSummaryViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public RequestSummaryViewModel(RequestSupportTicketData data)
2121
[Required(ErrorMessage = "Please enter request summary")]
2222
public string? RequestSubject { get; set; }
2323

24-
[Required(ErrorMessage = "Please enter request description")]
2524
public string? RequestDescription { get; set; }
2625

2726
public int? RequestTypeId { get; set; }

DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/UploadResults.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<li>@Model.CompetencyGroupsInsertedCount new @(Model.CompetencyGroupsInsertedCount == 1 ? $"{Model.FrameworkVocabularySingular.ToLower()} group" : $"{Model.FrameworkVocabularySingular.ToLower()} groups") inserted</li>
3838
<li>@Model.CompetenciesInsertedCount new @(Model.CompetenciesInsertedCount == 1 ? Model.FrameworkVocabularySingular.ToLower() : Model.FrameworkVocabularyPlural.ToLower()) inserted</li>
3939
<li>@Model.CompetenciesUpdatedCount existing @(Model.CompetenciesUpdatedCount == 1 ? Model.FrameworkVocabularySingular.ToLower() : Model.FrameworkVocabularyPlural.ToLower()) updated</li>
40-
<li>@(Model.CompetenciesReorderedCount == 0 ? "No existing " + Model.FrameworkVocabularyPlural.ToLower() : Model.CompetenciesReorderedCount == 1 ? "An existing " + Model.FrameworkVocabularySingular.ToLower() : "Some existing " + Model.FrameworkVocabularyPlural.ToLower())) reordered</li>
40+
<li>@(Model.CompetenciesReorderedCount == 0 ? "No existing " + Model.FrameworkVocabularyPlural.ToLower() : Model.CompetenciesReorderedCount == 1 ? "An existing " + Model.FrameworkVocabularySingular.ToLower() : "Some existing " + Model.FrameworkVocabularyPlural.ToLower()) reordered</li>
4141
<li>@Model.SkippedCount rows @(Model.SkippedCount == 1 ? "line" : "lines") skipped (nothing inserted or updated but no errors)</li>
4242
<li>@Model.ErrorCount @(Model.ErrorCount == 1 ? "line" : "lines") skipped due to errors</li>
4343
</ul>

DigitalLearningSolutions.Web/Views/Support/RequestSupportTicket/RequestSummary.cshtml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,15 @@
4040
autocomplete="given-name"
4141
css-class=""
4242
required="true" />
43-
<nhs-form-group nhs-validation-for="RequestDescription">
44-
<vc:text-area asp-for="RequestDescription"
45-
label="Describe your problem or request"
46-
populate-with-current-value="true"
47-
rows="5"
48-
spell-check="false"
49-
hint-text="If you are reporting a problem, please tell us exactly where it occurs and steps to recreate it. If you need to add screenshots, you will be able to do this in the next step."
50-
css-class=""
51-
character-count="null">
52-
</vc:text-area>
53-
</nhs-form-group>
43+
<vc:text-area asp-for="RequestDescription"
44+
label="Describe your problem or request"
45+
populate-with-current-value="true"
46+
rows="5"
47+
spell-check="false"
48+
hint-text="If you are reporting a problem, please tell us exactly where it occurs and steps to recreate it. If you need to add screenshots, you will be able to do this in the next step."
49+
css-class="html-editor"
50+
character-count="null">
51+
</vc:text-area>
5452
<button class="nhsuk-button" type="submit">Next</button>
5553
</form>
5654

DigitalLearningSolutions.Web/yarn.lock

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,6 @@
7474
dependencies:
7575
"@babel/types" "^7.25.9"
7676

77-
"@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.25.9", "@babel/helper-compilation-targets@^7.26.5":
78-
version "7.26.5"
79-
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz#75d92bb8d8d51301c0d49e52a65c9a7fe94514d8"
80-
integrity sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==
81-
dependencies:
82-
83-
"@babel/types" "^7.22.5"
84-
85-
"@babel/helper-annotate-as-pure@^7.25.9":
86-
version "7.25.9"
87-
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz#d8eac4d2dc0d7b6e11fa6e535332e0d3184f06b4"
88-
integrity sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==
89-
dependencies:
90-
"@babel/types" "^7.25.9"
91-
9277
"@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.25.9", "@babel/helper-compilation-targets@^7.26.5":
9378
version "7.26.5"
9479
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz#75d92bb8d8d51301c0d49e52a65c9a7fe94514d8"
@@ -326,6 +311,13 @@
326311
dependencies:
327312
"@babel/types" "^7.27.0"
328313

314+
"@babel/parser@^7.27.0":
315+
version "7.27.0"
316+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.0.tgz#3d7d6ee268e41d2600091cbd4e145ffee85a44ec"
317+
integrity sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==
318+
dependencies:
319+
"@babel/types" "^7.27.0"
320+
329321
"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.25.9":
330322
version "7.25.9"
331323
resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.9.tgz#cc2e53ebf0a0340777fff5ed521943e253b4d8fe"
@@ -3575,11 +3567,6 @@ gopd@^1.0.1, gopd@^1.1.0, gopd@^1.2.0:
35753567
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1"
35763568
integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==
35773569

3578-
gopd@^1.1.0:
3579-
version "1.2.0"
3580-
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1"
3581-
integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==
3582-
35833570
graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9:
35843571
version "4.2.11"
35853572
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
@@ -5313,13 +5300,6 @@ regenerate-unicode-properties@^10.1.0, regenerate-unicode-properties@^10.2.0:
53135300
dependencies:
53145301
regenerate "^1.4.2"
53155302

5316-
regenerate-unicode-properties@^10.2.0:
5317-
version "10.2.0"
5318-
resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz#626e39df8c372338ea9b8028d1f99dc3fd9c3db0"
5319-
integrity sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==
5320-
dependencies:
5321-
regenerate "^1.4.2"
5322-
53235303
regenerate@^1.4.2:
53245304
version "1.4.2"
53255305
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a"
@@ -5373,18 +5353,6 @@ regexpu-core@^6.2.0:
53735353
unicode-match-property-ecmascript "^2.0.0"
53745354
unicode-match-property-value-ecmascript "^2.1.0"
53755355

5376-
regexpu-core@^6.2.0:
5377-
version "6.2.0"
5378-
resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-6.2.0.tgz#0e5190d79e542bf294955dccabae04d3c7d53826"
5379-
integrity sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==
5380-
dependencies:
5381-
regenerate "^1.4.2"
5382-
regenerate-unicode-properties "^10.2.0"
5383-
regjsgen "^0.8.0"
5384-
regjsparser "^0.12.0"
5385-
unicode-match-property-ecmascript "^2.0.0"
5386-
unicode-match-property-value-ecmascript "^2.1.0"
5387-
53885356
regjsgen@^0.8.0:
53895357
version "0.8.0"
53905358
resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.8.0.tgz#df23ff26e0c5b300a6470cad160a9d090c3a37ab"
@@ -5398,14 +5366,6 @@ regjsparser@^0.12.0:
53985366
dependencies:
53995367
jsesc "~3.0.2"
54005368

5401-
regjsparser@^0.9.1:
5402-
version "0.9.1"
5403-
resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709"
5404-
integrity sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==
5405-
5406-
dependencies:
5407-
jsesc "~3.0.2"
5408-
54095369
regjsparser@^0.9.1:
54105370
version "0.9.1"
54115371
resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709"

0 commit comments

Comments
 (0)