fleet/website/api/controllers/view-testimonials.js
Eric 5acc897f8d
Website: Update testimonials page layout and URL (#39114)
Closes: https://github.com/fleetdm/fleet/issues/38472

Changes:
- Updated the URL of the testimonials page to be /customers
- Added a redirect for /testimonials
- Updated the layout and content of the /customers page to match the
latest wireframes
- Updated links to the /testimonials page to go to /customers
- Changed the "Customers" dropdown in the website nav to be a link to
the /customers page.
2026-02-02 20:52:17 +09:00

65 lines
1.7 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 page contents
let testimonials = _.clone(sails.config.builtStaticContent.testimonials);
let testimonialAuthorsToShowOnThisPage = [
'Scott MacVicar',
'Nick Fohs',
'Wes Whetstone',
'Erik Gomez',
'matt carr',
'nico waisman',
'Kenny Botelho',
'Dan Grzelak',
'Eric Tan',
];
let filteredTestimonialsForThisPage = _.filter(testimonials, (testimonial)=>{
return testimonialAuthorsToShowOnThisPage.includes(testimonial.quoteAuthorName);
});
filteredTestimonialsForThisPage.sort((a, b)=>{
if(testimonialAuthorsToShowOnThisPage.indexOf(a.quoteAuthorName) === -1){
return 1;
} else if(testimonialAuthorsToShowOnThisPage.indexOf(b.quoteAuthorName) === -1) {
return -1;
}
return testimonialAuthorsToShowOnThisPage.indexOf(a.quoteAuthorName) - testimonialAuthorsToShowOnThisPage.indexOf(b.quoteAuthorName);
});
let testimonialsWithVideoLinks = _.filter(filteredTestimonialsForThisPage, (testimonial)=>{
return testimonial.youtubeVideoUrl;
});
return {
testimonials: filteredTestimonialsForThisPage,
testimonialsWithVideoLinks,
};
}
};