2024-11-15 05:52:36 +00:00
|
|
|
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'};
|
|
|
|
|
}
|
2024-12-17 23:08:25 +00:00
|
|
|
// Get testimonials for the page contents
|
2024-11-15 05:52:36 +00:00
|
|
|
let testimonials = _.clone(sails.config.builtStaticContent.testimonials);
|
|
|
|
|
|
2026-02-02 11:52:17 +00:00
|
|
|
|
|
|
|
|
let testimonialAuthorsToShowOnThisPage = [
|
2024-11-20 23:55:47 +00:00
|
|
|
'Scott MacVicar',
|
2026-02-02 11:52:17 +00:00
|
|
|
'Nick Fohs',
|
2025-04-07 17:05:18 +00:00
|
|
|
'Wes Whetstone',
|
|
|
|
|
'Erik Gomez',
|
2026-02-02 11:52:17 +00:00
|
|
|
'matt carr',
|
|
|
|
|
'nico waisman',
|
|
|
|
|
'Kenny Botelho',
|
2024-11-20 23:55:47 +00:00
|
|
|
'Dan Grzelak',
|
2025-04-07 17:05:18 +00:00
|
|
|
'Eric Tan',
|
2024-11-20 23:55:47 +00:00
|
|
|
];
|
2026-02-02 11:52:17 +00:00
|
|
|
|
|
|
|
|
let filteredTestimonialsForThisPage = _.filter(testimonials, (testimonial)=>{
|
|
|
|
|
return testimonialAuthorsToShowOnThisPage.includes(testimonial.quoteAuthorName);
|
2024-12-06 00:03:44 +00:00
|
|
|
});
|
2026-02-02 11:52:17 +00:00
|
|
|
filteredTestimonialsForThisPage.sort((a, b)=>{
|
|
|
|
|
if(testimonialAuthorsToShowOnThisPage.indexOf(a.quoteAuthorName) === -1){
|
2024-11-20 23:55:47 +00:00
|
|
|
return 1;
|
2026-02-02 11:52:17 +00:00
|
|
|
} else if(testimonialAuthorsToShowOnThisPage.indexOf(b.quoteAuthorName) === -1) {
|
2024-11-20 23:55:47 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2026-02-02 11:52:17 +00:00
|
|
|
return testimonialAuthorsToShowOnThisPage.indexOf(a.quoteAuthorName) - testimonialAuthorsToShowOnThisPage.indexOf(b.quoteAuthorName);
|
2024-11-15 05:52:36 +00:00
|
|
|
});
|
|
|
|
|
|
2026-02-02 11:52:17 +00:00
|
|
|
let testimonialsWithVideoLinks = _.filter(filteredTestimonialsForThisPage, (testimonial)=>{
|
|
|
|
|
return testimonial.youtubeVideoUrl;
|
2024-12-17 23:08:25 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2024-11-15 05:52:36 +00:00
|
|
|
return {
|
2026-02-02 11:52:17 +00:00
|
|
|
testimonials: filteredTestimonialsForThisPage,
|
2024-11-15 05:52:36 +00:00
|
|
|
testimonialsWithVideoLinks,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|