Skip to content

Commit 2f1cdd4

Browse files
authored
Merge pull request #3131 from TechnologyEnhancedLearning/Develop/Fixes/TD-5292-Issuewith'Goback'linkwhencreatingacourseandadding'Coursecontent'on'Coursesetup'screen
TD-5292 Issue with 'Go back' link when creating a course and adding 'Course content' on 'Course set up' screen
2 parents 252a582 + 28cf777 commit 2f1cdd4

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

DigitalLearningSolutions.Web/Views/TrackingSystem/CourseSetup/AddNewCentreCourse/SetSectionContent.cshtml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,37 @@
33
@model SetSectionContentViewModel
44

55
@{
6-
ViewData["Title"] = "Set section content";
7-
var backLinkRouteData = new Dictionary<string, string> { { "index", Model.Index.ToString() } };
6+
ViewData["Title"] = "Set section content";
7+
var sectionIndex = Model.Index == 0 ? Model.Index : Model.Index - 1;
8+
var backLinkRouteData = new Dictionary<string, string> { { "index", Model.Index.ToString() } };
89
}
910

1011
<div class="nhsuk-grid-row">
11-
<div class="nhsuk-grid-column-full">
12-
<h1 class="nhsuk-heading-xl">@ViewData["Title"]</h1>
12+
<div class="nhsuk-grid-column-full">
13+
<h1 class="nhsuk-heading-xl">@ViewData["Title"]</h1>
1314

14-
<vc:field-name-value-display display-name="Section" field-value="@Model.SectionName" />
15+
<vc:field-name-value-display display-name="Section" field-value="@Model.SectionName" />
1516

16-
<form method="post" novalidate asp-action="SetSectionContent">
17-
<input type="hidden" asp-for="Index" />
17+
<form method="post" novalidate asp-action="SetSectionContent">
18+
<input type="hidden" asp-for="Index" />
1819

19-
<partial name="../CourseContent/_EditSectionContentFormInputs" model="Model" />
20+
<partial name="../CourseContent/_EditSectionContentFormInputs" model="Model" />
2021

21-
<button name="action" class="nhsuk-button" type="submit" value="@CourseSetupController.SaveAction">Next</button>
22-
</form>
23-
@if (Model.Index == 0)
24-
{
25-
<vc:back-link asp-controller="CourseSetup" asp-action="SetCourseContent" link-text="Go back" />
26-
}
27-
else
28-
{
29-
<vc:back-link asp-controller="CourseSetup" asp-action="SetSectionContent" asp-all-route-data="@backLinkRouteData" link-text="Go back" />
30-
}
31-
</div>
22+
<button name="action" class="nhsuk-button" type="submit" value="@CourseSetupController.SaveAction">Next</button>
23+
</form>
24+
@if (Model.Index == 0)
25+
{
26+
<vc:back-link asp-controller="CourseSetup" asp-action="SetCourseContent" link-text="Go back" />
27+
}
28+
else
29+
{
30+
<a asp-controller="CourseSetup" asp-action="SetSectionContent" asp-route-sectionIndex="@sectionIndex">
31+
&lt; Go back
32+
</a>
33+
}
34+
</div>
3235
</div>
3336

3437
@section scripts {
35-
<script src="@Url.Content("~/js/trackingSystem/editCourseContent.js")" asp-append-version="true"></script>
38+
<script src="@Url.Content("~/js/trackingSystem/editCourseContent.js")" asp-append-version="true"></script>
3639
}

0 commit comments

Comments
 (0)