mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
67 lines
1.3 KiB
JavaScript
67 lines
1.3 KiB
JavaScript
|
|
module.exports = {
|
||
|
|
|
||
|
|
|
||
|
|
friendlyName: 'View basic webinar',
|
||
|
|
|
||
|
|
|
||
|
|
description: 'Display "Basic webinar" page.',
|
||
|
|
|
||
|
|
inputs: {
|
||
|
|
slug: {
|
||
|
|
type: 'string',
|
||
|
|
description: 'The slug of the webinar that will be displayed to the user',
|
||
|
|
required: true,
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
exits: {
|
||
|
|
|
||
|
|
success: {
|
||
|
|
viewTemplatePath: 'pages/articles/basic-webinar'
|
||
|
|
},
|
||
|
|
|
||
|
|
badConfig: {
|
||
|
|
responseType: 'badConfig'
|
||
|
|
},
|
||
|
|
|
||
|
|
notFound: {
|
||
|
|
responseType: 'notFound'
|
||
|
|
},
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
fn: async function ({slug}) {
|
||
|
|
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.markdownPages) || !sails.config.builtStaticContent.markdownPages) {
|
||
|
|
throw {badConfig: 'builtStaticContent.markdownPages'};
|
||
|
|
}
|
||
|
|
|
||
|
|
let thisPage = _.find(sails.config.builtStaticContent.markdownPages, { url: '/webinars/'+encodeURIComponent(slug) });
|
||
|
|
if (!thisPage) {
|
||
|
|
throw 'notFound';
|
||
|
|
}
|
||
|
|
|
||
|
|
let pageTitleForMeta;
|
||
|
|
let pageDescriptionForMeta;
|
||
|
|
|
||
|
|
if(thisPage.meta.articleTitle) {
|
||
|
|
pageTitleForMeta = thisPage.meta.articleTitle;
|
||
|
|
}
|
||
|
|
|
||
|
|
if(thisPage.meta.description) {
|
||
|
|
pageDescriptionForMeta = thisPage.meta.description;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Respond with view.
|
||
|
|
return {
|
||
|
|
pageTitleForMeta,
|
||
|
|
pageDescriptionForMeta,
|
||
|
|
path: require('path'),
|
||
|
|
thisPage: thisPage,
|
||
|
|
};
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
};
|