mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Closes: #16018 Changes: - Updated the testimonial configuration in testimonial.yml to add two new required values: - `quoteAuthorProfileImageFilename` - The filename of the quote author's LinkedIn profile picture in the website's `assets/images/` folder - `productCategories`: An array of product categories that this quote is relevant to - Added new quotes to testimonials.yml - Updated the testimonial validation in build-static-content to throw an error if a testimonial is missing one of the new required values - Updated the `<scrollable-tweets> component to match the latest wireframes - Updated the controllers for the product category landing pages to filter testimonials by product category and sort them by the order specified in [the wireframes](https://www.figma.com/file/3he8e72251IEnF6dBafKq1/%F0%9F%9A%A7-fleetdm.com-(scratchpad)?type=design&node-id=9369-4714&mode=dev)
50 lines
1.7 KiB
JavaScript
Vendored
50 lines
1.7 KiB
JavaScript
Vendored
module.exports = {
|
|
|
|
|
|
friendlyName: 'View endpoint ops',
|
|
|
|
|
|
description: 'Display "Endpoint ops" page.',
|
|
|
|
|
|
exits: {
|
|
|
|
success: {
|
|
viewTemplatePath: 'pages/endpoint-ops'
|
|
},
|
|
badConfig: { responseType: 'badConfig' },
|
|
},
|
|
|
|
|
|
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 testimonialsForScrollableTweets = _.clone(sails.config.builtStaticContent.testimonials);
|
|
|
|
// Filter the testimonials by product category
|
|
testimonialsForScrollableTweets = _.filter(testimonialsForScrollableTweets, (testimonial)=>{
|
|
return _.contains(testimonial.productCategories, 'Endpoint operations');
|
|
});
|
|
|
|
// Specify an order for the testimonials on this page using the last names of quote authors
|
|
let testimonialOrderForThisPage = ['Anderson','Grzelak','Fohs','Shaklovitz','Waisman','Arpaia','Gomez','Shields','Majumdar','Elshaer','Yousafzai','Botelho','Zaffery','Larkin','Ravazzolo','Whetstone'];
|
|
testimonialsForScrollableTweets.sort((a, b)=>{
|
|
if(testimonialOrderForThisPage.indexOf(a.quoteAuthorName.split(' ')[1]) === -1){
|
|
return 1;
|
|
} else if(testimonialOrderForThisPage.indexOf(b.quoteAuthorName.split(' ')[1]) === -1) {
|
|
return -1;
|
|
}
|
|
return testimonialOrderForThisPage.indexOf(a.quoteAuthorName.split(' ')[1]) - testimonialOrderForThisPage.indexOf(b.quoteAuthorName.split(' ')[1]);
|
|
});
|
|
|
|
// Respond with view.
|
|
return {
|
|
testimonialsForScrollableTweets,
|
|
};
|
|
|
|
}
|
|
|
|
|
|
};
|