|  | 
| 3 | 3 | @model SetSectionContentViewModel | 
| 4 | 4 | 
 | 
| 5 | 5 | @{ | 
| 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() } }; | 
| 8 | 9 | } | 
| 9 | 10 | 
 | 
| 10 | 11 | <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> | 
| 13 | 14 | 
 | 
| 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" /> | 
| 15 | 16 | 
 | 
| 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" /> | 
| 18 | 19 | 
 | 
| 19 |  | -      <partial name="../CourseContent/_EditSectionContentFormInputs" model="Model" /> | 
|  | 20 | +            <partial name="../CourseContent/_EditSectionContentFormInputs" model="Model" /> | 
| 20 | 21 | 
 | 
| 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 | +                < Go back | 
|  | 32 | +            </a> | 
|  | 33 | +        } | 
|  | 34 | +    </div> | 
| 32 | 35 | </div> | 
| 33 | 36 | 
 | 
| 34 | 37 | @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> | 
| 36 | 39 | } | 
0 commit comments