Merge pull request #244 from creative-commoners/pulls/master/add-cms5

NEW Add CMS 5 sources to user and dev docs (plus some other related changes)
This commit is contained in:
Sabina Talipova 2022-08-11 12:19:09 +12:00 committed by GitHub
commit 95b2ecd799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 707 additions and 475 deletions

View File

@ -20,6 +20,24 @@ Silverstripe CMS 4.x is stored in
The userhelp documentation is stored in the [silverstripe/silverstripe-userhelp-content repo](https://github.com/silverstripe/silverstripe-userhelp-content/). The userhelp documentation is stored in the [silverstripe/silverstripe-userhelp-content repo](https://github.com/silverstripe/silverstripe-userhelp-content/).
## What to update when creating a new pre-release major branch, making a stable major release, or making a major EOL
When **creating a new major branch for a pre-release major version**
- Make sure you've added a new major branch to both `silverstripe/developer-docs` and `silverstripe/silverstripe-userhelp-content`
- You probably need to add new major branches for various modules as defined in `sources-user.js` as well
- Add the new major to `sources-docs.js` and `sources-user.js`
- Add the new major to the version select in `src/components/Header.tsx`
- Add the major to the `PRE_RELEASE` array in the `getVersionMessage` function in `src/utils/nodes.ts`
For **new stable releases**, you will need to do the following
- Remove the major from the `PRE_RELEASE` array in the `getVersionMessage` function in `src/utils/nodes.ts`
- Update the `getDefaultVersion` function's return value to the new stable major in `src/utils/nodes.ts`
- Update redirects in `netlify.toml`
When a **major goes EOL**, add the major to the `EOL` array in the `getVersionMessage` function in `src/utils/nodes.ts`
## Installation ## Installation
To set up a local instance of [doc.silverstripe.org](https://github.com/silverstripe/doc.silverstripe.org): To set up a local instance of [doc.silverstripe.org](https://github.com/silverstripe/doc.silverstripe.org):

View File

@ -14,7 +14,7 @@ class IconExtractor {
const matches = content.match(/icon(Brand)?: ([a-zA-Z0-9_-]+)/); const matches = content.match(/icon(Brand)?: ([a-zA-Z0-9_-]+)/);
if (matches) { if (matches) {
const isBrand = typeof matches[1] !== 'undefined'; const isBrand = typeof matches[1] !== 'undefined';
selectors.push(isBrand ? `fab` : `fas`); selectors.push(isBrand ? 'fab' : 'fas');
selectors.push(`fa-${matches[2]}`); selectors.push(`fa-${matches[2]}`);
} }
return selectors; return selectors;
@ -29,6 +29,12 @@ const whitelist = [
// Syntax highlighting // Syntax highlighting
'pre', 'pre',
'code', 'code',
// Icon classes used in nodes.ts
'far',
'fa-calendar',
'fa-check-circle',
'fa-times-circle',
]; ];
const whitelistPatterns = [ const whitelistPatterns = [

View File

@ -1,20 +1,29 @@
module.exports = [ module.exports = [
{ {
resolve: `gatsby-source-git`, resolve: `gatsby-source-git`,
options: { options: {
name: `docs--4`, name: `docs--5`,
remote: `https://github.com/silverstripe/developer-docs.git`, remote: `https://github.com/silverstripe/developer-docs.git`,
branch: `4.11`, branch: `5`,
patterns: `en/**` patterns: `en/**`
} }
}, },
{ {
resolve: `gatsby-source-git`, resolve: `gatsby-source-git`,
options: { options: {
name: `docs--3`, name: `docs--4`,
remote: `https://github.com/silverstripe/developer-docs.git`, remote: `https://github.com/silverstripe/developer-docs.git`,
branch: `3`, branch: `4.11`,
patterns: `en/**` patterns: `en/**`
} }
}, },
{
resolve: `gatsby-source-git`,
options: {
name: `docs--3`,
remote: `https://github.com/silverstripe/developer-docs.git`,
branch: `3`,
patterns: `en/**`
}
},
]; ];

View File

@ -1,416 +1,484 @@
module.exports = [ module.exports = [
/******* main content *********/ // v5
{
resolve: `gatsby-source-git`,
options: {
name: `user--5`,
remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`,
branch: `5`,
patterns: `docs/en/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/setting_up_advancedworkflow`,
remote: `https://github.com/symbiote/silverstripe-advancedworkflow`,
branch: `6`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/online_databases_and_registries`,
remote: `https://github.com/silverstripe/silverstripe-registry`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/content_review`,
remote: `https://github.com/silverstripe/silverstripe-contentreview`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/blogs`,
remote: `https://github.com/silverstripe/silverstripe-blog`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/forms`,
remote: `https://github.com/silverstripe/silverstripe-userforms`,
branch: `6`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/content_blocks`,
remote: `https://github.com/dnadesign/silverstripe-elemental`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/modules_report`,
remote: `https://github.com/bringyourownideas/silverstripe-maintenance`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/share_draft_content`,
remote: `https://github.com/silverstripe/silverstripe-sharedraftcontent`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/document_converter`,
remote: `https://github.com/silverstripe/silverstripe-documentconverter`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/ckan_registry`,
remote: `https://github.com/silverstripe/silverstripe-ckan-registry`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/multi-factor_authentication`,
remote: `https://github.com/silverstripe/silverstripe-mfa`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `3`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `4`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/managing_devices`,
remote: `https://github.com/silverstripe/silverstripe-session-manager`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
// v4 // v4
{ {
resolve: `gatsby-source-git`, resolve: `gatsby-source-git`,
options: { options: {
name: `user--4`, name: `user--4`,
remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`, remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`,
branch: `4`, branch: `4`,
patterns: `docs/en/**` patterns: `docs/en/**`
} }
}, },
// v3
{ {
resolve: `gatsby-source-git`, resolve: `gatsby-source-git`,
options: { options: {
name: `user--3`, name: `user--4--optional_features/setting_up_advancedworkflow`,
remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`, remote: `https://github.com/symbiote/silverstripe-advancedworkflow`,
branch: `3`, branch: `5`,
patterns: `docs/en/**` patterns: `docs/en/userguide/**`
} }
}, },
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/online_databases_and_registries`,
remote: `https://github.com/silverstripe/silverstripe-registry`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/content_review`,
remote: `https://github.com/silverstripe/silverstripe-contentreview`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/blogs`,
remote: `https://github.com/silverstripe/silverstripe-blog`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/forms`,
remote: `https://github.com/silverstripe/silverstripe-userforms`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/content_blocks`,
remote: `https://github.com/dnadesign/silverstripe-elemental`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/modules_report`,
remote: `https://github.com/bringyourownideas/silverstripe-maintenance`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/share_draft_content`,
remote: `https://github.com/silverstripe/silverstripe-sharedraftcontent`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/document_converter`,
remote: `https://github.com/silverstripe/silverstripe-documentconverter`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/ckan_registry`,
remote: `https://github.com/silverstripe/silverstripe-ckan-registry`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/multi-factor_authentication`,
remote: `https://github.com/silverstripe/silverstripe-mfa`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `2`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `3`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/managing_devices`,
remote: `https://github.com/silverstripe/silverstripe-session-manager`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
// v3 // v3
{ {
resolve: `gatsby-source-git`, resolve: `gatsby-source-git`,
options: { options: {
name: `user--3--optional_features/versionedfiles`, name: `user--3`,
remote: `https://github.com/symbiote/silverstripe-versionedfiles`, remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`,
branch: `master`, branch: `3`,
patterns: `docs/en/userguide/**` patterns: `docs/en/**`
} }
}, },
// v3
{ {
// Running a fork. Switch remote back once merged. resolve: `gatsby-source-git`,
resolve: `gatsby-source-git`, options: {
options: { name: `user--3--optional_features/versionedfiles`,
name: `user--3--optional_features/setting_up_advancedworkflow`, remote: `https://github.com/symbiote/silverstripe-versionedfiles`,
remote: `https://github.com/symbiote/silverstripe-advancedworkflow`, branch: `master`,
branch: `4`, patterns: `docs/en/userguide/**`
patterns: `docs/en/userguide/**` }
} },
}, {
resolve: `gatsby-source-git`,
// v4 options: {
{ name: `user--3--optional_features/setting_up_advancedworkflow`,
resolve: `gatsby-source-git`, remote: `https://github.com/symbiote/silverstripe-advancedworkflow`,
options: { branch: `4`,
name: `user--4--optional_features/setting_up_advancedworkflow`, patterns: `docs/en/userguide/**`
remote: `https://github.com/symbiote/silverstripe-advancedworkflow`, }
branch: `master`, },
patterns: `docs/en/userguide/**` {
} resolve: `gatsby-source-git`,
}, options: {
name: `user--3--optional_features/online_databases_and_registries`,
/******* registry ********/ remote: `https://github.com/silverstripe/silverstripe-registry`,
branch: `1.0`,
// v3 patterns: `docs/en/userguide/**`
{ }
resolve: `gatsby-source-git`, },
options: { {
name: `user--3--optional_features/online_databases_and_registries`, resolve: `gatsby-source-git`,
remote: `https://github.com/silverstripe/silverstripe-registry`, options: {
branch: `1.0`, name: `user--3--optional_features/forums`,
patterns: `docs/en/userguide/**` remote: `https://github.com/silverstripe-archive/silverstripe-forum`,
} branch: `0.8`,
}, patterns: `docs/en/userguide/**`
}
// v4 },
{ {
resolve: `gatsby-source-git`, resolve: `gatsby-source-git`,
options: { options: {
name: `user--4--optional_features/online_databases_and_registries`, name: `user--3--optional_features/blogs`,
remote: `https://github.com/silverstripe/silverstripe-registry`, remote: `https://github.com/silverstripe/silverstripe-blog`,
branch: `master`, branch: `2`,
patterns: `docs/en/userguide/**` patterns: `docs/en/userguide/**`
} }
}, },
{
/******* forum ********/ resolve: `gatsby-source-git`,
options: {
// v3 name: `user--3--optional_features/working_with_translations`,
{ remote: `https://github.com/silverstripe/silverstripe-translatable`,
resolve: `gatsby-source-git`, branch: `2.1`,
options: { patterns: `docs/en/userguide/**`
name: `user--3--optional_features/forums`, }
remote: `https://github.com/silverstripe-archive/silverstripe-forum`, },
branch: `0.8`, {
patterns: `docs/en/userguide/**` resolve: `gatsby-source-git`,
} options: {
}, name: `user--3--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
/******* contentreview ********/ branch: `1.1`,
patterns: `docs/en/userguide/**`
}
// v4 },
{ {
resolve: `gatsby-source-git`, resolve: `gatsby-source-git`,
options: { options: {
name: `user--4--optional_features/content_review`, name: `user--3--optional_features/securing_files`,
remote: `https://github.com/silverstripe/silverstripe-contentreview`, remote: `https://github.com/silverstripe/silverstripe-secureassets`,
branch: `master`, branch: `master`,
patterns: `docs/en/userguide/**` patterns: `docs/en/userguide/**`
} }
}, },
{
/******* blog ********/ resolve: `gatsby-source-git`,
options: {
// v3 name: `user--3--optional_features/taxonomies`,
{ remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
resolve: `gatsby-source-git`, branch: `1`,
options: { patterns: `docs/en/userguide/**`
name: `user--3--optional_features/blogs`, }
remote: `https://github.com/silverstripe/silverstripe-blog`, },
branch: `2`, {
patterns: `docs/en/userguide/**` resolve: `gatsby-source-git`,
} options: {
}, name: `user--3--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
// v4 branch: `1.0`,
{ patterns: `docs/en/userguide/**`
resolve: `gatsby-source-git`, }
options: { },
name: `user--4--optional_features/blogs`, {
remote: `https://github.com/silverstripe/silverstripe-blog`, resolve: `gatsby-source-git`,
branch: `master`, options: {
patterns: `docs/en/userguide/**` name: `user--3--optional_features/site_wide_rss_feeds`,
} remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
}, branch: `master`,
patterns: `docs/en/userguide/**`
/******* userforms ********/ }
},
// v4 {
{ resolve: `gatsby-source-git`,
resolve: `gatsby-source-git`, options: {
options: { name: `user--3--optional_features/document_management_system`,
name: `user--4--optional_features/forms`, remote: `https://github.com/silverstripe/silverstripe-dms`,
remote: `https://github.com/silverstripe/silverstripe-userforms`, branch: `master`,
branch: `master`, patterns: `docs/en/userguide/**`
patterns: `docs/en/userguide/**` }
} },
}, {
resolve: `gatsby-source-git`,
/******* translatable ********/ options: {
name: `user--3--managing_your_website/reports/security_report`,
// v3 remote: `https://github.com/silverstripe/silverstripe-securityreport`,
{ branch: `master`,
resolve: `gatsby-source-git`, patterns: `docs/en/userguide/**`,
options: { }
name: `user--3--optional_features/working_with_translations`, },
remote: `https://github.com/silverstripe/silverstripe-translatable`, {
branch: `2.1`, resolve: `gatsby-source-git`,
patterns: `docs/en/userguide/**` options: {
} name: `user--3--managing_your_website/reports/sitewide_content_report`,
}, remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `2.0`,
/******* subsites ********/ patterns: `docs/en/userguide/**`,
}
// v3 },
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `1.1`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `1.1`,
patterns: `docs/en/userguide/**`
}
},
/******* secureassets ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/securing_files`,
remote: `https://github.com/silverstripe/silverstripe-secureassets`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* taxonomy ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* iframe ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `1.0`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* versionfeed ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* dms ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/document_management_system`,
remote: `https://github.com/silverstripe/silverstripe-dms`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* elemental ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/content_blocks`,
remote: `https://github.com/dnadesign/silverstripe-elemental`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/modules_report`,
remote: `https://github.com/bringyourownideas/silverstripe-maintenance`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
/******* sharedraftcontent ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/share_draft_content`,
remote: `https://github.com/silverstripe/silverstripe-sharedraftcontent`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* documentconverter ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/document_converter`,
remote: `https://github.com/silverstripe/silverstripe-documentconverter`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* ckan-registry ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/ckan_registry`,
remote: `https://github.com/silverstripe/silverstripe-ckan-registry`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* mfa ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/multi-factor_authentication`,
remote: `https://github.com/silverstripe/silverstripe-mfa`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******** securityreport ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `master`,
patterns: `docs/en/userguide/**`,
}
},
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `master`,
patterns: `docs/en/userguide/**`,
}
},
/******** sitewide-content-report ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `master`,
patterns: `docs/en/userguide/**`,
}
},
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `2.0`,
patterns: `docs/en/userguide/**`,
}
},
/******* session-manager ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/managing_devices`,
remote: `https://github.com/silverstripe/silverstripe-session-manager`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
]; ];

View File

@ -61,7 +61,8 @@ const Header: StatelessComponent<HeaderProps> = ({ handleSidebarToggle }): React
</div> </div>
<ul className="social-list list-inline d-flex flex-grow-1 flex-lg-grow-0 align-items-center justify-content-lg-center justify-content-end justify-content-lg-end"> <ul className="social-list list-inline d-flex flex-grow-1 flex-lg-grow-0 align-items-center justify-content-lg-center justify-content-end justify-content-lg-end">
<li className="list-inline-item version-select"> <li className="list-inline-item version-select">
<select id="version-select" value={getCurrentVersion() || '4'} onChange={handleNavigate}> <select id="version-select" value={getCurrentVersion()} onChange={handleNavigate}>
<option value='5'>V5</option>
<option value='4'>V4</option> <option value='4'>V4</option>
<option value='3'>V3</option> <option value='3'>V3</option>
</select> </select>

View File

@ -11,22 +11,23 @@ interface LayoutProps {
} }
} }
const Layout: StatelessComponent<LayoutProps> = ({ children, pageContext: { slug } }) => { const Layout: StatelessComponent<LayoutProps> = ({ children, pageContext: { slug } }) => {
const { setCurrentPath, getVersionPath, getCurrentVersion, getCurrentNode } = useHierarchy(); const { setCurrentPath, getVersionPath, getCurrentVersion, getCurrentNode, getDefaultVersion, getVersionMessage } = useHierarchy();
const [isToggled, setSidebarOpen] = useState(false); const [isToggled, setSidebarOpen] = useState(false);
const handleNavigate = () => setSidebarOpen(false); const handleNavigate = () => setSidebarOpen(false);
setCurrentPath(slug); setCurrentPath(slug);
const ver = getCurrentVersion(); const ver = getCurrentVersion();
const currentNode = getCurrentNode(); const currentNode = getCurrentNode();
const versionMessage = getVersionMessage();
return ( return (
<> <>
{currentNode && ver !== '4' && ( {currentNode && ver !== getDefaultVersion() && (
<Helmet <Helmet
link={[ link={[
{ {
rel: 'canonical', rel: 'canonical',
href: getVersionPath(currentNode, '4'), href: getVersionPath(currentNode, getDefaultVersion()),
} }
]} ]}
/> />
@ -37,7 +38,10 @@ const Layout: StatelessComponent<LayoutProps> = ({ children, pageContext: { slug
<div className="docs-content"> <div className="docs-content">
<div className="container"> <div className="container">
<article role="main" className="docs-article"> <article role="main" className="docs-article">
<>
{versionMessage}
{children} {children}
</>
</article> </article>
</div> </div>
</div> </div>

View File

@ -14,6 +14,8 @@ import {
initialise, initialise,
getVersionPath, getVersionPath,
setCurrentPath, setCurrentPath,
getDefaultVersion,
getVersionMessage,
} from '../utils/nodes'; } from '../utils/nodes';
const NodeProvider: StatelessComponent<{}> = ({ children, pageContext: { slug } }): ReactElement => { const NodeProvider: StatelessComponent<{}> = ({ children, pageContext: { slug } }): ReactElement => {
@ -59,6 +61,8 @@ const NodeProvider: StatelessComponent<{}> = ({ children, pageContext: { slug }
getSiblings, getSiblings,
getVersionPath, getVersionPath,
setCurrentPath, setCurrentPath,
getDefaultVersion,
getVersionMessage,
}}> }}>
{children} {children}
</NodeContext.Provider> </NodeContext.Provider>

View File

@ -1,4 +1,4 @@
import { useContext } from 'react'; import { useContext, ReactElement } from 'react';
import NodeContext from '../contexts/NodeContext'; import NodeContext from '../contexts/NodeContext';
import { SilverstripeDocument } from '../types'; import { SilverstripeDocument } from '../types';
@ -12,8 +12,10 @@ interface NodeFunctions {
getHomePage(): SilverstripeDocument|null; getHomePage(): SilverstripeDocument|null;
getNavChildren(node: SilverstripeDocument): SilverstripeDocument[]; getNavChildren(node: SilverstripeDocument): SilverstripeDocument[];
getCurrentVersion(): string; getCurrentVersion(): string;
getVersionPath(currentNode: SilverstripeDocument, version: number): string; getVersionPath(currentNode: SilverstripeDocument, version: number|string): string;
setCurrentPath(slug: string): undefined; setCurrentPath(slug: string): undefined;
getDefaultVersion(): string;
getVersionMessage(): ReactElement | ReactElement[] | string | null;
}; };
const useHierarchy = (): NodeFunctions => { const useHierarchy = (): NodeFunctions => {

View File

@ -14,9 +14,10 @@
.nav-link { .nav-link {
display: block; display: block;
padding: $nav-link-padding-y $nav-link-padding-x; padding: $nav-link-padding-y $nav-link-padding-x;
text-decoration: none;
@include hover-focus { @include hover-focus {
text-decoration: none; text-decoration: underline;
} }
// Disabled state lightens text // Disabled state lightens text

View File

@ -29,9 +29,13 @@ $wordpress-color: #028cb0;
$single-col-max: 800px; $single-col-max: 800px;
$theme-success-color: #5cb377; $theme-success-color: #5cb377;
$theme-success-color-dark: #39794D;
$theme-warning-color: #EEBF41; $theme-warning-color: #EEBF41;
$theme-warning-color-dark: #9E6100;
$theme-info-color: #5b99ea; $theme-info-color: #5b99ea;
$theme-info-color-dark: #1c6fdc;
$theme-danger-color: #d26d69; $theme-danger-color: #d26d69;
$theme-danger-color-dark: #b73c37;

View File

@ -13,6 +13,10 @@ h1, h2, h3, h4, h5, h6 {
font-family: 'Poppins', sans-serif; font-family: 'Poppins', sans-serif;
color: $theme-text-color-primary; color: $theme-text-color-primary;
font-weight: 600; font-weight: 600;
code[class*="language-"] {
font-size: 0.8em;
}
} }
code { code {
@ -59,16 +63,27 @@ code {
border-bottom-color: darken($theme-bg-light, 5%); border-bottom-color: darken($theme-bg-light, 5%);
} }
a.theme-link { a {
color: $theme-text-color-primary;
text-decoration: underline; text-decoration: underline;
-webkit-text-decoration-color: rgba($theme-text-color-primary,0.3);
text-decoration-color: rgba($theme-text-color-primary,0.3); &:hover {
&:hover { text-decoration: none;
color: $theme-color-primary; }
-webkit-text-decoration-color: rgba($theme-color-primary,0.8);
text-decoration-color: rgba($theme-color-primary,0.8); &.theme-link {
} color: $theme-text-color-primary;
-webkit-text-decoration-color: rgba($theme-text-color-primary,0.3);
text-decoration-color: rgba($theme-text-color-primary,0.3);
&:hover {
color: $theme-color-primary;
-webkit-text-decoration-color: rgba($theme-color-primary,0.8);
text-decoration-color: rgba($theme-color-primary,0.8);
}
}
&.btn {
text-decoration: none;
}
} }
.btn { .btn {

View File

@ -172,11 +172,6 @@
.section-title { .section-title {
font-size: 1rem; font-size: 1rem;
margin-bottom: 1rem; margin-bottom: 1rem;
a {
&:hover {
text-decoration: none;
}
}
} }
.section-items { .section-items {
font-size: 0.875rem; font-size: 0.875rem;
@ -207,7 +202,6 @@
color: $theme-color-primary; color: $theme-color-primary;
&:before { &:before {
background-color: $theme-color-primary; background-color: $theme-color-primary;
} }
.theme-icon-holder { .theme-icon-holder {
color: #fff; color: #fff;
@ -267,7 +261,6 @@
margin-bottom: 0; margin-bottom: 0;
} }
} }
} }
.anchor { .anchor {
@ -275,18 +268,6 @@
margin-left: 1rem; margin-left: 1rem;
opacity: 0; opacity: 0;
transition: opacity .2s; transition: opacity .2s;
/* Force anchor link to offset header */
margin-top: -90px;
padding-top: 90px;
&:focus {
opacity: 1;
/* Outline behaves incorrectly due to offset, use underline instead */
outline: none;
text-decoration: underline;
}
} }
:hover > .anchor { :hover > .anchor {
opacity: 1; opacity: 1;
@ -346,40 +327,94 @@
border-color: $theme-info-color; border-color: $theme-info-color;
background: lighten($theme-info-color, 35%); background: lighten($theme-info-color, 35%);
.callout-title { .callout-title {
color: darken($theme-info-color, 15%); color: $theme-info-color-dark;
} }
a { a {
color: darken($theme-info-color, 15%); color: $theme-info-color-dark;
} }
} }
&.callout-block-success { &.callout-block-success {
border-color: $theme-success-color; border-color: $theme-success-color;
background: lighten($theme-success-color, 40%); background: lighten($theme-success-color, 40%);
.callout-title { .callout-title {
color: darken($theme-success-color, 15%); color: $theme-success-color-dark;
} }
a { a {
color: darken($theme-success-color, 15%); color: $theme-success-color-dark;
} }
} }
&.callout-block-warning { &.callout-block-warning {
border-color: $theme-warning-color; border-color: $theme-warning-color;
background: lighten($theme-warning-color, 35%); background: lighten($theme-warning-color, 35%);
.callout-title { .callout-title {
color: darken($theme-warning-color, 15%); color: $theme-warning-color-dark;
} }
a { a {
color: darken($theme-warning-color, 15%); color: $theme-warning-color-dark;
} }
} }
&.callout-block-danger { &.callout-block-danger {
border-color: $theme-danger-color; border-color: $theme-danger-color;
background: lighten($theme-danger-color, 35%); background: lighten($theme-danger-color, 35%);
.callout-title { .callout-title {
color: darken($theme-danger-color, 15%); color: $theme-danger-color-dark;
} }
a { a {
color: darken($theme-danger-color, 15%); color: $theme-danger-color-dark;
}
}
}
.callout-block--version {
border-left-width: 6px;
padding-top: 1rem;
padding-bottom: 1rem;
.callout-version-title {
display: flex;
font-size: 1rem;
font-weight: $font-weight-bold;
color: lighten($theme-text-color-primary, 15%);
.callout-version-stability {
display: flex;
align-items: center;
margin-left: auto;
font-size: 1.125rem;
}
.callout-version-stability-text {
text-transform: uppercase;
font-size: 0.875rem;
margin-left: 10px;
}
}
.callout-version-content {
padding-top: 10px;
}
&.callout-block-success {
.callout-version-stability {
color: $theme-success-color-dark;
}
}
&.callout-block-info {
.callout-version-stability {
color: $theme-info-color-dark;
}
}
&.callout-block-warning {
.callout-version-stability {
color: $theme-warning-color-dark;
}
}
&.callout-block-danger {
.callout-version-stability {
color: $theme-danger-color-dark;
} }
} }
} }

View File

@ -1,6 +1,7 @@
import parse from 'html-react-parser';
import { ReactElement } from 'react';
import { SilverstripeDocument } from '../types'; import { SilverstripeDocument } from '../types';
import sortFiles from './sortFiles'; import sortFiles from './sortFiles';
import { node } from 'prop-types';
let __nodes: SilverstripeDocument[]; let __nodes: SilverstripeDocument[];
let __currentVersion: string | null = null; let __currentVersion: string | null = null;
@ -139,10 +140,59 @@ const getHomePage = (): SilverstripeDocument | null => {
return homeMap.get(slug); return homeMap.get(slug);
}; };
/**
* Get the default version
*/
const getDefaultVersion = (): string => '4';
/** /**
* Get the selected version * Get the selected version
*/ */
const getCurrentVersion = (): string => __currentVersion || '4'; const getCurrentVersion = (): string => __currentVersion || getDefaultVersion();
/**
* Get a message to display for all pages on this version's docs
*/
const getVersionMessage = (): ReactElement | ReactElement[] | string | null => {
const EOL = [
'3',
];
const PRE_RELEASE = [
'5',
];
const version = getCurrentVersion();
const stablePath = getVersionPath(getCurrentNode(), getDefaultVersion());
// Output the appropriate message and styling
function makeMessage(style: string, icon: string, stability: string, message: string|null): string {
let template = `<div id="version-callout" class="callout-block callout-block--version callout-block-${style}">
<div class="callout-version-title">Version ${version}<span class="callout-version-stability">
<i class="far fa-${icon}"></i><span class="callout-version-stability-text">${stability}</span></span>
</div>`;
if (message) {
template += `<div class="callout-version-content">
This version of Silverstripe CMS ${message}.
<a href="${stablePath}">Go to documentation for the most recent stable version.</a>
</div>`;
}
template += '</div>';
return template;
}
// Return the correct message for the current version
if (EOL.includes(version)) {
return parse(makeMessage('danger', 'times-circle', 'end of life', 'will not recieve any additional bug fixes or documentation updates'));
}
if (PRE_RELEASE.includes(version)) {
return parse(makeMessage(
'warning',
'calendar',
'pre-stable',
'has not yet been given a stable release. See <a target="_blank" href="https://www.silverstripe.org/software/roadmap/">the release roadmap</a> for more information'
));
}
return parse(makeMessage('success', 'check-circle', 'supported', null));
};
/** /**
@ -150,11 +200,15 @@ const getCurrentVersion = (): string => __currentVersion || '4';
* @param currentNode * @param currentNode
* @param version * @param version
*/ */
const getVersionPath = (currentNode: SilverstripeDocument, version: number): string => { const getVersionPath = (currentNode: SilverstripeDocument|null, version: number|string): string => {
const newPath = currentNode.slug.replace(/^\/en\/[0-9]+\//, `/en/${version}/`); const basePath = `/en/${version}`;
if (!currentNode) {
return basePath;
}
const newPath = currentNode.slug.replace(/^\/en\/[0-9]+\//, `${basePath}/`);
const otherNode = getNodes().find(n => n.slug === newPath); const otherNode = getNodes().find(n => n.slug === newPath);
return otherNode ? otherNode.slug : `/en/${version}`; return otherNode ? otherNode.slug : basePath;
}; };
/** /**
@ -178,5 +232,7 @@ export {
getNavChildren, getNavChildren,
getCurrentVersion, getCurrentVersion,
getVersionPath, getVersionPath,
setCurrentPath setCurrentPath,
getDefaultVersion,
getVersionMessage,
}; };

View File

@ -1,9 +1,11 @@
import { getCurrentVersion } from './nodes';
/** /**
* If an href is preceded with api:, rewrite it to the api.silverstripe.org site * If an href is preceded with api:, rewrite it to the api.silverstripe.org site
* @param link * @param link
*/ */
const rewriteAPILink = (link: string): string => { const rewriteAPILink = (link: string): string => {
const version = 4; const version = getCurrentVersion();
const match = link.match(/api\:(.*)/); const match = link.match(/api\:(.*)/);
if (!match) { if (!match) {
console.error(`Unable to resolve api link ${link}!`); console.error(`Unable to resolve api link ${link}!`);

View File

@ -65,6 +65,13 @@ const rewriteHeaders = (domNode: DomElement): ReactElement | false => {
domNode.children?.push(anchor); domNode.children?.push(anchor);
if (domNode.name === 'h1') {
if (!domNode.attribs) {
domNode.attribs = {};
}
domNode.attribs['aria-details'] = 'version-callout';
}
return domToReact([domNode]); return domToReact([domNode]);
} }