diff --git a/Childrens-Social-Care-CPD/Configuration/Features/Features.cs b/Childrens-Social-Care-CPD/Configuration/Features/Features.cs index db36f1e5..d7d91512 100644 --- a/Childrens-Social-Care-CPD/Configuration/Features/Features.cs +++ b/Childrens-Social-Care-CPD/Configuration/Features/Features.cs @@ -5,4 +5,5 @@ public static class Features public const string ResourcesAndLearning = "resources-learning"; public const string FeedbackControl = "feedback-control"; public const string EmployerStandards = "employer-standards"; + public const string AgencyResources = "agency-resources"; } diff --git a/Childrens-Social-Care-CPD/Views/Shared/_ErrorLayout.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_ErrorLayout.cshtml index 1e95d26c..c425d009 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_ErrorLayout.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_ErrorLayout.cshtml @@ -103,6 +103,17 @@ } + @if (featuresConfig.IsEnabled(Features.AgencyResources)) + { +
  • + + Agency Resources + + +
  • + } diff --git a/Childrens-Social-Care-CPD/Views/Shared/_Header.cshtml b/Childrens-Social-Care-CPD/Views/Shared/_Header.cshtml index 21f47a98..d659d206 100644 --- a/Childrens-Social-Care-CPD/Views/Shared/_Header.cshtml +++ b/Childrens-Social-Care-CPD/Views/Shared/_Header.cshtml @@ -66,6 +66,10 @@ { RenderMenuItem("employerStandards", "Employer standards", "employer-standards", category == "Employer standards"); } + if (featuresConfig.IsEnabled(Features.AgencyResources)) + { + RenderMenuItem("agencyResources", "Agency resources", "agency-resources", category == "Agency resources"); + } } diff --git a/Contentful-Schema/migrations/0011-create-agency-standards-page-category.cjs b/Contentful-Schema/migrations/0011-create-agency-standards-page-category.cjs new file mode 100644 index 00000000..c931e9e7 --- /dev/null +++ b/Contentful-Schema/migrations/0011-create-agency-standards-page-category.cjs @@ -0,0 +1,28 @@ +module.exports = async function (migration, { makeRequest }) { + + const contentTypeId = 'content', + categoryFieldId = 'category', + agencyResourcesString = 'Agency resources'; + + const response = await makeRequest({ + method: 'GET', + url: `/content_types?sys.id[in]=${contentTypeId}` + }); + + var update = false; + const validations = response.items[0].fields + .filter(field => field.id == categoryFieldId)[0] + .validations.map(rule => { + if (rule.in && !rule.in.includes(agencyResourcesString)) { + rule.in.push(agencyResourcesString); + update = true; + } + return rule; + }); + + if (update) { + migration + .editContentType(contentTypeId) + .editField(categoryFieldId).validations(validations); + } + }; \ No newline at end of file diff --git a/Contentful-Schema/migrations/manifest.txt b/Contentful-Schema/migrations/manifest.txt index 84c9cef8..279c875f 100644 --- a/Contentful-Schema/migrations/manifest.txt +++ b/Contentful-Schema/migrations/manifest.txt @@ -7,4 +7,5 @@ 0007-add-header-field-to-navigation-menu.cjs 0008-details-component.cjs 0009-asset-download-component.cjs -0010-breadcrumbs.cjs \ No newline at end of file +0010-breadcrumbs.cjs +0011-create-agency-standards-page-category.cjs \ No newline at end of file diff --git a/Contentful-Schema/migrations/migrations.tar.gz b/Contentful-Schema/migrations/migrations.tar.gz index 33648297..843908a3 100644 Binary files a/Contentful-Schema/migrations/migrations.tar.gz and b/Contentful-Schema/migrations/migrations.tar.gz differ