Skip to content

Commit

Permalink
added credit block as optional setting on training content pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mattb-hippo committed Dec 17, 2024
1 parent e5de7a9 commit cc74cd8
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ public class PathwaysModule: IContent
public Content DeclarationPage { get; set; }
public Content CertificatePage { get; set; }
public List<PathwaysModuleSection> Sections { get; set; }
public CreditBlock CreditBlock { get; set; }
}
44 changes: 31 additions & 13 deletions Childrens-Social-Care-CPD/Views/Shared/_PathwaysContent.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,37 @@

@model Content

<div class="govuk-button-group">
@{
ContextModel contextModel = (ContextModel)ViewBag.ContextModel;
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<hr />
<div class="govuk-button-group pathways-nav">
@{
ContextModel contextModel = (ContextModel)ViewBag.ContextModel;

<a href="@contextModel.NavigationHelper.Previous.Url" button type="submit"
class="govuk-button govuk-button--secondary" data-module="govuk-button" draggable="false">
@contextModel.NavigationHelper.Previous.Name
</a>
<a href="@contextModel.NavigationHelper.Previous.Url" button type="submit"
class="govuk-button govuk-button--secondary" data-module="govuk-button" draggable="false">
@contextModel.NavigationHelper.Previous.Name
</a>

<a href="@contextModel.NavigationHelper.Next.Url" button type="submit" class="govuk-button govuk-button"
data-module="govuk-button" draggable="false">
@contextModel.NavigationHelper.Next.Name
</a>
<a href="@contextModel.NavigationHelper.Next.Url" button type="submit" class="govuk-button govuk-button"
data-module="govuk-button" draggable="false">
@contextModel.NavigationHelper.Next.Name
</a>

}
</div>
}
</div>
</div>
</div>
@if (Model.PathwaysModule.CreditBlock != null)
{
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<hr />
</div>
</div>
<div class="govuk-grid-row pathways-nav">
<div class="govuk-grid-column-three-quarters">
<partial name="_CreditBlock" model="Model.PathwaysModule.CreditBlock" />
</div>
</div>
}
4 changes: 4 additions & 0 deletions Childrens-Social-Care-CPD/styles/scss/overrides/_site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -627,4 +627,8 @@ section.completed {

.pathways-location-info .pathways-location-section-title {
font-weight: 700;
}

.pathways-nav {
padding-top: 25px;
}
4 changes: 4 additions & 0 deletions Childrens-Social-Care-CPD/wwwroot/css/application.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/wwwroot/css/application.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/wwwroot/css/application.min.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions Contentful-Schema/migrations/0016-pathways-module.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ module.exports = async function (migration) {
linkType: "Entry",
});

pathwaysModule
.createField("creditBlock")
.name("Training Page Credit Block")
.type("Link")
.localized(false)
.required(false)
.validations([
{
linkContentType: ["creditBlock"],
},
])
.disabled(false)
.omitted(false)
.linkType("Entry");

pathwaysModule.changeFieldControl("name", "builtin", "singleLine", {
helpText: "What is this module called? E.g. 'Pathway 1'",
});
Expand Down Expand Up @@ -121,6 +136,18 @@ module.exports = async function (migration) {
showCreateEntityAction: false,
});

pathwaysModule.changeFieldControl(
"creditBlock",
"builtin",
"entryLinkEditor",
{
helpText:
"Which credit block entry should be displayed at the foot of training pages in this Pathway?",
showLinkEntityAction: true,
showCreateEntityAction: false,
}
);

// Add content type to fields on Content content type: approach 2
const contentTypeId = "content";
migration
Expand Down
Binary file modified Contentful-Schema/migrations/migrations.tar.gz
Binary file not shown.

0 comments on commit cc74cd8

Please sign in to comment.