mirror of
https://github.com/fleetdm/fleet
synced 2026-05-05 14:28:46 +00:00
Closes: https://github.com/fleetdm/fleet/issues/9762 Changes: - `routes.js`: Changed the `currentPage` local variable to `currentSection` and updated the value based each on the dropdown navigation menus in the website header. This variable is used to make a section "active" in the header. - `view-basic-article` & `view-articles`: Updated these view actions to set a `currentSection` variable based on the Markdown article category. - `Layout.less`: Updated styles to match wireframes - `layout.ejs`: Updated the styles and layout of the website header to match wireframes. - `layout-landing.ejs`, `layout-sandbox.ejs` & `layout-customer.ejs`: Updated to match wireframes and stylesheet changes. - `basic-documentation.less`: adjusted the position of the sticky right sidebar. --------- Co-authored-by: Mike McNeil <[email protected]>
77 lines
2.3 KiB
JavaScript
Vendored
77 lines
2.3 KiB
JavaScript
Vendored
module.exports = {
|
|
|
|
|
|
friendlyName: 'View articles',
|
|
|
|
|
|
description: 'Display "Articles" page.',
|
|
|
|
|
|
inputs: {
|
|
category: {
|
|
type: 'string',
|
|
description: 'The category of article to display.',
|
|
defaultsTo: '',
|
|
}
|
|
},
|
|
|
|
|
|
exits: {
|
|
|
|
success: { viewTemplatePath: 'pages/articles/articles' },
|
|
badConfig: { responseType: 'badConfig' },
|
|
notFound: { responseType: 'notFound' },
|
|
redirect: { responseType: 'redirect' },
|
|
|
|
},
|
|
|
|
|
|
fn: async function ({category}) {
|
|
|
|
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.markdownPages) || !sails.config.builtStaticContent.compiledPagePartialsAppPath) {
|
|
throw {badConfig: 'builtStaticContent.markdownPages'};
|
|
}
|
|
let articles = [];
|
|
if (category === 'articles') {
|
|
// If the category is `/articles` we'll show all articles
|
|
articles = sails.config.builtStaticContent.markdownPages.filter((page)=>{
|
|
if(_.startsWith(page.htmlId, 'articles')) {
|
|
return page;
|
|
}
|
|
});
|
|
// setting the category to all
|
|
category = 'all';
|
|
} else {
|
|
// if the user navigates to a URL for a specific category, we'll only display articles in that category
|
|
articles = sails.config.builtStaticContent.markdownPages.filter((page)=>{
|
|
if(_.startsWith(page.url, '/'+category)) {
|
|
return page;
|
|
}
|
|
});
|
|
}
|
|
// Set a currentSection variable for the website header based on how the articles category page is linked to in the header navigation dropdown menus.
|
|
let currentSection;
|
|
if(category === 'success-stories'){
|
|
// If the category is success-stories, highlight the "Platform" dropdown.
|
|
currentSection = 'platform';
|
|
} else if(_.contains(['deploy','guides','releases'], category)) {
|
|
// If the category is deploy, guides, or release, highlight the "Documentation" dropdown.
|
|
currentSection = 'documentation';
|
|
} else {
|
|
// If the category is anything else, highlight the "Community" dropdown.
|
|
currentSection = 'community';
|
|
}
|
|
|
|
return {
|
|
path: require('path'),
|
|
articles,
|
|
category,
|
|
markdownPages: sails.config.builtStaticContent.markdownPages,
|
|
compiledPagePartialsAppPath: sails.config.builtStaticContent.compiledPagePartialsAppPath,
|
|
currentSection,
|
|
};
|
|
|
|
}
|
|
|
|
|
|
};
|