Skip to content

Feature/testimonial #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions models/Testimonial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var keystone = require('keystone');
var Types = keystone.Field.Types;

/**
* Testimonial Model
* ==========
*/


var Testimonial = new keystone.List('Testimonial', {
autokey: { from: 'name', path: 'key', unique: true },
plural: 'Testimonials',
singular: 'Testimonial',
});

Testimonial.add({
name: { type: String, initial: true, required: true },
description: { type: Types.Textarea, max: 500, height: 100 },
image: { type: Types.CloudinaryImage }
});

Testimonial.track = true;
Testimonial.defaultSort = 'name';
Testimonial.defaultColumns = 'name, description';
Testimonial.register();
72 changes: 24 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,9 @@ li.__shecodelink.active a {
#testimonials .box img {
display: block;
margin: 30px auto;
width: 85px;
height: 85px;
border-radius: 50%;
}

#testimonials .testimonial_text {
Expand Down
4 changes: 3 additions & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var routes = {
// Setup Route Bindings
exports = module.exports = function(app) {
app.use(cookieParser(process.env.TOKEN_SECRET));

// Views
app.get('/', routes.views.index);
app.post('/', routes.views.index);
Expand All @@ -58,6 +58,7 @@ exports = module.exports = function(app) {
app.get('/faq', routes.views.faq);
app.get('/privacy', routes.views.privacy);
app.get('/terms', routes.views.terms);
app.get('/testimonials', routes.views.testimonials);
app.get('/jobs', routes.views.jobs);
app.get('/jobs/:org', middleware.getCookieAndFiles, middleware.verifyToken, routes.views.jobsorgdashboard);
app.get('/view/jobs/:id', routes.views.jobdetail);
Expand All @@ -69,6 +70,7 @@ exports = module.exports = function(app) {
app.post('/jobs/post/new', middleware.getCookieAndFiles, middleware.verifyToken, routes.views.jobdetails);
app.get('/jobs/org/login', routes.views.jobslogin);
app.post('/jobs/org/login', routes.views.jobslogin);

app.get('/success', routes.views.successMessage);
app.get('/logout', middleware.logoutUser);

Expand Down
9 changes: 8 additions & 1 deletion routes/views/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var keystone = require('keystone');
var Enquiry = keystone.list('Enquiry');
var Testimonial = keystone.list('Testimonial');
const https = require('https');

exports = module.exports = function(req, res) {
Expand All @@ -12,8 +13,14 @@ exports = module.exports = function(req, res) {
locals.enquiryTypes = Enquiry.fields.enquiryType.ops;
locals.formData = req.body || {};
locals.formerror = false;
locals.validationErrors = {};
locals.validationErrors = {};
locals.enquirySubmitted = false;
locals.data = {
testimonials: [],
};


view.query('testimonials', Testimonial.model.find());

view.on('post', { action: '' }, function(next) {
if (locals.formData['g-recaptcha-response'] === undefined || locals.formData['g-recaptcha-response'] === '' || locals.formData['g-recaptcha-response'] === null) {
Expand Down
11 changes: 11 additions & 0 deletions routes/views/testimonials.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var keystone = require('keystone');

exports = module.exports = function(req, res) {
var view = new keystone.View(req, res);
var locals = res.locals;

locals.section = 'testimonials';

//render the view
view.render('testimonials');
}
Loading