diff --git a/Childrens-Social-Care-CPD/Controllers/ContentController.cs b/Childrens-Social-Care-CPD/Controllers/ContentController.cs index 21ccfaa4..328b200e 100644 --- a/Childrens-Social-Care-CPD/Controllers/ContentController.cs +++ b/Childrens-Social-Care-CPD/Controllers/ContentController.cs @@ -52,15 +52,16 @@ public async Task Index(CancellationToken cancellationToken, stri } var contextModel = new ContextModel( - Id: pageContent.Id, - Title: pageContent.Title, - PageName: pageName, + Id: pageContent.Id, + Title: pageContent.Title, + PageName: pageName, Category: pageContent.Category, - UseContainers: pageContent.SideMenu == null, - PreferenceSet: preferenceSet, + UseContainers: pageContent.SideMenu == null, + PreferenceSet: preferenceSet, BackLink: pageContent.BackLink); ViewData["ContextModel"] = contextModel; + ViewData["StateModel"] = new StateModel(); return View(pageContent); } } \ No newline at end of file diff --git a/Childrens-Social-Care-CPD/Models/StateModel.cs b/Childrens-Social-Care-CPD/Models/StateModel.cs new file mode 100644 index 00000000..01f0a4ed --- /dev/null +++ b/Childrens-Social-Care-CPD/Models/StateModel.cs @@ -0,0 +1,6 @@ +namespace Childrens_Social_Care_CPD.Models; + +public class StateModel +{ + public bool IncludeMediaPlayer { get; set; } = false; +} diff --git a/Childrens-Social-Care-CPD/Views/Content/Index.cshtml b/Childrens-Social-Care-CPD/Views/Content/Index.cshtml index a6eb0240..cadae91b 100644 --- a/Childrens-Social-Care-CPD/Views/Content/Index.cshtml +++ b/Childrens-Social-Care-CPD/Views/Content/Index.cshtml @@ -39,4 +39,15 @@ -@_relatedContentRenderer.Render(Model.RelatedContent) \ No newline at end of file +@_relatedContentRenderer.Render(Model.RelatedContent) + +@section Scripts { + @if (ViewData.TryGetValue("StateModel", out var stateModel)) + { + if (((StateModel)stateModel).IncludeMediaPlayer) + { + + + } + } +} \ No newline at end of file diff --git a/Childrens-Social-Care-CPD/Views/Resources/Search.cshtml b/Childrens-Social-Care-CPD/Views/Resources/Search.cshtml index 470b432a..467ef725 100644 --- a/Childrens-Social-Care-CPD/Views/Resources/Search.cshtml +++ b/Childrens-Social-Care-CPD/Views/Resources/Search.cshtml @@ -7,10 +7,6 @@ Layout = "_SearchPageLayout"; } -@section Scripts { - -} - @section PageBanner { } diff --git a/Childrens-Social-Care-CPD/Views/Shared/_AudioResource.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_AudioResource.cshtml index 9e735125..1e8ab5d3 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_AudioResource.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_AudioResource.cshtml @@ -2,6 +2,10 @@ @model AudioResource +@{ + ((StateModel)ViewData["StateModel"]).IncludeMediaPlayer = true; +} +
-
\ No newline at end of file + + diff --git a/Childrens-Social-Care-CPD/Views/Shared/_DefaultPageLayout.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_DefaultPageLayout.cshtml index b802d447..d4f6adef 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_DefaultPageLayout.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_DefaultPageLayout.cshtml @@ -7,6 +7,10 @@ @await RenderSectionAsync("PageBanner", required: false) } +@section Scripts { + @await RenderSectionAsync("Scripts", required: false) +} + @await RenderSectionAsync("Hero", required: false)
@RenderBody() diff --git a/Childrens-Social-Care-CPD/Views/Shared/_SiteLayout.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_SiteLayout.cshtml index c8626ac4..6204f044 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_SiteLayout.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_SiteLayout.cshtml @@ -32,8 +32,6 @@ - - diff --git a/Childrens-Social-Care-CPD/Views/Shared/_SubPageLayout.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_SubPageLayout.cshtml index c83b2499..072f3bde 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_SubPageLayout.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_SubPageLayout.cshtml @@ -7,6 +7,10 @@ @await RenderSectionAsync("PageBanner", required: false) } +@section Scripts { + @await RenderSectionAsync("Scripts", required: false) +} +
diff --git a/Childrens-Social-Care-CPD/Views/Shared/_VideoResource.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_VideoResource.cshtml index b44025c7..30da1af6 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_VideoResource.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_VideoResource.cshtml @@ -2,6 +2,10 @@ @model VideoResource +@{ + ((StateModel)ViewData["StateModel"]).IncludeMediaPlayer = true; +} +