fleet/website/api/controllers/view-testimonials.js
Eric 4f03956c72
Website: add /customer-stories (#23837)
For: #23721 

Changes:
- Added /customer-stories, a page that displays the testimonials from
testimonials.yml
- Changed the /testimonials redirect to go to the /customer-stories
page.
- Updated the "What people are saying" link on the homepage and the
header navigation.



@mike-j-thomas FYI: To make this PR quickly, I did not implement the
sort order in the wireframes or change the testimonials yaml.
2024-11-15 14:52:36 +09:00

51 lines
1.4 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View testimonials',
description: 'Display "Testimonials" page.',
exits: {
success: {
viewTemplatePath: 'pages/testimonials'
}
},
fn: async function () {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.testimonials) || !sails.config.builtStaticContent.compiledPagePartialsAppPath) {
throw {badConfig: 'builtStaticContent.testimonials'};
}
// Get testimonials for the <scrolalble-tweets> component.
let testimonials = _.clone(sails.config.builtStaticContent.testimonials);
// Filter the testimonials by product category
let testimonialsForMdm = _.filter(testimonials, (testimonial)=>{
return _.contains(testimonial.productCategories, 'Device management');
});
let testimonialsForSecurityEngineering = _.filter(testimonials, (testimonial)=>{
return _.contains(testimonial.productCategories, 'Vulnerability management');
});
let testimonialsForItEngineering = _.filter(testimonials, (testimonial)=>{
return _.contains(testimonial.productCategories, 'Endpoint operations');
});
let testimonialsWithVideoLinks = _.filter(testimonials, (testimonial)=>{
return testimonial.youtubeVideoUrl;
});
return {
testimonialsForMdm,
testimonialsForSecurityEngineering,
testimonialsForItEngineering,
testimonialsWithVideoLinks,
};
}
};