Skip to content

Commit

Permalink
Restore simpler version of Print this Page
Browse files Browse the repository at this point in the history
  • Loading branch information
mattb-hippo committed Nov 14, 2024
1 parent cfcdb87 commit 22a47b2
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 42 deletions.
9 changes: 1 addition & 8 deletions Childrens-Social-Care-CPD/Contentful/Models/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ public static class ContentTypes
public const string Resource = "Resource";
}

public static class PrintThisPageLocations
{
public const string BeforeFeedback = "Before Feedback";
public const string BeforeCreditBlock = "Before Credit Block";
public const string BottomOfPage = "Bottom of Page";
}

public class Content : IContent
{
public string Id { get; set; }
Expand All @@ -31,7 +24,7 @@ public class Content : IContent
public int? EstimatedReadingTime { get; set; }
public List<Content> ParentPages { get; set; }
public string BreadcrumbText { get; set; }
public string PrintThisPageLocation { get; set; }
public bool ShowPrintThisPage { get; set; }

[JsonProperty("$metadata")]
public ContentfulMetadata Metadata { get; set; }
Expand Down
14 changes: 2 additions & 12 deletions Childrens-Social-Care-CPD/Views/Shared/_Content.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,14 @@
continue;
}

switch (item)
if (item is Feedback && Model.ShowPrintThisPage)
{
case Feedback feedback: if (Model.PrintThisPageLocation == PrintThisPageLocations.BeforeFeedback) {
<partial name="_PrintThisPage" />
}; break;

case CreditBlock creditBlock: if (Model.PrintThisPageLocation == PrintThisPageLocations.BeforeCreditBlock) {
<partial name="_PrintThisPage" />
}; break;
<partial name="_PrintThisPage" />
}

await Html.RenderContentfulPartialAsync(item);
}
}

model.ContentStack.Pop();

if (Model.PrintThisPageLocation == PrintThisPageLocations.BottomOfPage) {
<partial name="_PrintThisPage" />
}
}
1 change: 1 addition & 0 deletions Childrens-Social-Care-CPD/styles/scss/overrides/_site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ div#page-feedback a {
cursor: pointer;
margin: 0;
margin-bottom: 40px;
margin-left: 15px;
font-weight: 400;
font-size: 19px;
line-height: 1.1429;
Expand Down
1 change: 1 addition & 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.

32 changes: 13 additions & 19 deletions Contentful-Schema/migrations/0013-print-page-component.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,24 @@ module.exports = async function (migration, { makeRequest }) {

migration
.editContentType(contentTypeId)
.createField("printThisPageLocation")
.name("Print this Page Location")
.type("Symbol")
.createField("showPrintThisPage")
.name("Show Print this Page")
.type("Boolean")
.localized(false)
.required(false)
.validations([
{
in: [
"Before Feedback",
"Before Credit Block",
"Bottom of Page",
"None",
],
},
])
.validations([])
.defaultValue({
"en-US": "None",
"en-US": true,
})
.disabled(false)
.omitted(false);

migration
.editContentType(contentTypeId)
.changeFieldControl("printThisPageLocation", "builtin", "radio", {
helpText: "Where should a Print this Page component be located?",
migration
.editContentType(contentTypeId)
.changeFieldControl("showPrintThisPage", "builtin", "boolean", {
helpText:
"Should this page include a Print this Page component? It requires that a Feedback component is included in the page's items.",
trueLabel: "Yes",
falseLabel: "No",
});
};
};
Binary file modified Contentful-Schema/migrations/migrations.tar.gz
Binary file not shown.

0 comments on commit 22a47b2

Please sign in to comment.