windhamdavid 4 years ago
parent
commit
d66b8a3d57

+ 2 - 1
.jshintrc

@@ -4,7 +4,8 @@
     "exports",
     "module",
     "require",
-    "__dirname"
+    "__dirname",
+    "secure"
   ],
 	"node": true,
 	"esnext": true,

+ 4 - 1
app.js

@@ -22,7 +22,7 @@ var lusca = require('lusca');
 var expressValidator = require('express-validator');
 
 
-/********** config **************/
+/********** Config **************/
 
 var app = express();
 
@@ -97,6 +97,7 @@ app.use(function(req, res, next) {
 
 var homeController = require('./controllers/home');
 var userController = require('./controllers/user');
+var contactController = require('./controllers/contact');
 
 app.get('/', homeController.index);
 app.get('/login', userController.getLogin);
@@ -108,6 +109,8 @@ app.get('/reset/:token', userController.getReset);
 app.post('/reset/:token', userController.postReset);
 app.get('/register', userController.getSignup);
 app.post('/register', userController.postSignup);
+app.get('/contact', contactController.getContact);
+app.post('/contact', contactController.postContact);
 app.get('/account', passportConf.isAuthenticated, userController.getAccount);
 app.post('/account/profile', passportConf.isAuthenticated, userController.postUpdateProfile);
 app.post('/account/password', passportConf.isAuthenticated, userController.postUpdatePassword);

+ 56 - 0
controllers/contact.js

@@ -0,0 +1,56 @@
+var secure = require('../config/secure');
+var nodemailer = require("nodemailer");
+var transporter = nodemailer.createTransport({
+  service: 'Mandrill',
+  auth: {
+    user: secure.mandrill.user,
+    pass: secure.mandrill.password
+  }
+});
+
+
+/********** GET / Contact **************/
+
+exports.getContact = function(req, res) {
+  res.render('contact', {
+    title: 'Contact'
+  });
+};
+
+
+/********** POST / Contact **************/
+
+exports.postContact = function(req, res) {
+  req.assert('name', 'Name cannot be blank').notEmpty();
+  req.assert('email', 'Email is not valid').isEmail();
+  req.assert('message', 'Message cannot be blank').notEmpty();
+
+  var errors = req.validationErrors();
+
+  if (errors) {
+    req.flash('errors', errors);
+    return res.redirect('/contact');
+  }
+
+  var from = req.body.email;
+  var name = req.body.name;
+  var body = req.body.message;
+  var to = 'admin@juryd.com';
+  var subject = 'Contact Form | Juryd';
+
+  var mailOptions = {
+    to: to,
+    from: from,
+    subject: subject,
+    text: body
+  };
+
+  transporter.sendMail(mailOptions, function(err) {
+    if (err) {
+      req.flash('errors', { msg: err.message });
+      return res.redirect('/contact');
+    }
+    req.flash('success', { msg: 'Email has been sent successfully!' });
+    res.redirect('/contact');
+  });
+};

+ 2 - 2
controllers/home.js

@@ -1,5 +1,5 @@
 exports.index = function(req, res) {
-  res.render('home', {
-    title: 'Home'
+  res.render('index', {
+    title: 'You Be the Judge'
   });
 };

BIN
src/img/favicon.png


+ 29 - 0
src/views/about.jade

@@ -0,0 +1,29 @@
+extends layout
+
+block content
+
+  section#about
+    .container
+      .row
+        .col-sm-8
+          img.svg(src="img/ipad.svg")
+        .col-sm-4.text-center
+          h2.section-heading How It Works
+          hr.light
+          p Some Copy
+  section#call
+    .container
+      .row
+        .col-sm-4.col-lg-offset-2.text-center
+          h4.section-heading Connect
+          hr.light
+          p (Social Media Icons)
+        .col-sm-4.text-center
+          h4.section-heading Get the Latest
+          form.form-inline
+            .form-group
+              label.sr-only(for="exampleInputAmount") Email Addresss
+              .input-group
+                input#email-address.form-control(type="text", placeholder="Email Address")
+                .input-group-addon
+                  button.btn.btn-primary(type="submit") GO

+ 2 - 0
src/views/account/profile.jade

@@ -1,6 +1,8 @@
 extends ../layout
 
 block content
+
+  .container
   .page-header
     h3 Profile Information
 

+ 66 - 66
src/views/home.jade

@@ -2,71 +2,71 @@ extends layout
 
 block content
 header
-.container-fluid
-  .header-content
-    .header-content-inner
-      .row
-        .col-sm-8
-          h1 Juryd
-          h2 You be the Judge
-          hr
-          h4 Juryd is an application that allows the participants to register and vote.
-        .col-sm-4
-          img.svg(src='img/ribbon.svg')
-    section#about
-      .container
+  .container-fluid
+    .header-content
+      .header-content-inner
         .row
-          .col-lg-8
-            img.svg(src='img/ipad.svg')
-          .col-sm-4.text-center
-            h2.section-heading How It Works
-            hr.light
-            p Some Copy
-    section#details
-      .container
-        .row.text-center
+          .col-sm-8
+            h1 Juryd
+            h2 You be the Judge
+            hr
+            h4 Juryd is an application that allows the participants to register and vote.
           .col-sm-4
-            h3.section-heading Juried Competition
-            p Some Copy
-          .col-sm-4
-            h3.section-heading Registrant Jury
-            p Some Copy
-          .col-sm-4
-            h3.section-heading Registered Judges
-            p Some Copy
-    section#features
-      .container
-        .row.text-center
-          .col-sm-6
-            h2.section-heading Features
-            p Some Copy
-            img.svg.icon-small.blue-ribbon(src='img/ribbon.svg')
-            img.svg.icon-small.red-ribbon(src='img/ribbon.svg')
-            img.svg.icon-small.yellow-ribbon(src='img/ribbon.svg')
-          .col-sm-6
-            img.svg(src='img/phone.svg')
-    section#account
-      .container
-        .row.text-center
-          .col-sm-6
-            h2.section-heading About
-            p Some Copy
-          .col-sm-6
-            h2.section-heading About
-            p Some Copy
-    section#call
-      .container
-        .row
-          .col-sm-4.col-lg-offset-2.text-center
-            h4.section-heading Connect
-            hr.light
-            p (Social Media Icons)
-          .col-sm-4.text-center
-            h4.section-heading Get the Latest
-            form.form-inline
-              .form-group
-                label.sr-only(for='exampleInputAmount') Email Addresss
-                .input-group
-                  input#email-address.form-control(type='text', placeholder='Email Address')
-                  .input-group-addon
-                    button.btn.btn-primary(type='submit') GO
+            img.svg(src="img/ribbon.svg")
+section#about
+  .container
+    .row
+      .col-sm-8
+        img.svg(src="img/ipad.svg")
+      .col-sm-4.text-center
+        h2.section-heading How It Works
+        hr.light
+        p Some Copy
+section#details
+  .container
+    .row.text-center
+      .col-sm-4
+        h3.section-heading Juried Competition
+        p Some Copy
+      .col-sm-4
+        h3.section-heading Registrant Jury
+        p Some Copy
+      .col-sm-4
+        h3.section-heading Registered Judges
+        p Some Copy
+section#features
+  .container
+    .row.text-center
+      .col-sm-6
+        h2.section-heading Features
+        p Some Copy
+        img.svg.icon-small.blue-ribbon(src="img/ribbon.svg")
+        img.svg.icon-small.red-ribbon(src="img/ribbon.svg")
+        img.svg.icon-small.yellow-ribbon(src="img/ribbon.svg")
+      .col-sm-6
+        img.svg(src="img/phone.svg")
+section#account
+  .container
+    .row.text-center
+      .col-sm-6
+        h2.section-heading About
+        p Some Copy
+      .col-sm-6
+        h2.section-heading About
+        p Some Copy
+section#call
+  .container
+    .row
+      .col-sm-4.col-lg-offset-2.text-center
+        h4.section-heading Connect
+        hr.light
+        p (Social Media Icons)
+      .col-sm-4.text-center
+        h4.section-heading Get the Latest
+        form.form-inline
+          .form-group
+            label.sr-only(for="exampleInputAmount") Email Addresss
+            .input-group
+              input#email-address.form-control(type="text", placeholder="Email Address")
+              .input-group-addon
+                button.btn.btn-primary(type="submit") GO

+ 73 - 0
src/views/index.jade

@@ -0,0 +1,73 @@
+extends layout
+
+block content
+
+  header
+    .container-fluid
+      .header-content
+        .header-content-inner
+          .row
+            .col-sm-8
+              h1 Juryd
+              h2 You be the Judge
+              hr
+              h4 Juryd is an application that allows the participants to register and vote.
+            .col-sm-4
+              img.svg(src="img/ribbon.svg")
+  section#about
+    .container
+      .row
+        .col-sm-8
+          img.svg(src="img/ipad.svg")
+        .col-sm-4.text-center
+          h2.section-heading How It Works
+          hr.light
+          p Some Copy
+  section#details
+    .container
+      .row.text-center
+        .col-sm-4
+          h3.section-heading Juried Competition
+          p Some Copy
+        .col-sm-4
+          h3.section-heading Registrant Jury
+          p Some Copy
+        .col-sm-4
+          h3.section-heading Registered Judges
+          p Some Copy
+  section#features
+    .container
+      .row.text-center
+        .col-sm-6
+          h2.section-heading Features
+          p Some Copy
+          img.svg.icon-small.blue-ribbon(src="img/ribbon.svg")
+          img.svg.icon-small.red-ribbon(src="img/ribbon.svg")
+          img.svg.icon-small.yellow-ribbon(src="img/ribbon.svg")
+        .col-sm-6
+          img.svg(src="img/phone.svg")
+  section#account
+    .container
+      .row.text-center
+        .col-sm-6
+          h2.section-heading About
+          p Some Copy
+        .col-sm-6
+          h2.section-heading About
+          p Some Copy
+  section#call
+    .container
+      .row
+        .col-sm-4.col-lg-offset-2.text-center
+          h4.section-heading Connect
+          hr.light
+          p (Social Media Icons)
+        .col-sm-4.text-center
+          h4.section-heading Get the Latest
+          form.form-inline
+            .form-group
+              label.sr-only(for="exampleInputAmount") Email Addresss
+              .input-group
+                input#email-address.form-control(type="text", placeholder="Email Address")
+                .input-group-addon
+                  button.btn.btn-primary(type="submit") GO

+ 10 - 11
src/views/layout.jade

@@ -5,17 +5,14 @@ html
     meta(http-equiv='X-UA-Compatible', content='IE=edge')
     meta(name='viewport', content='width=device-width, initial-scale=1.0')
     meta(name='csrf-token', content=_csrf)
-    title #{title} - Juryd
-    meta(name='description', content='Juryd Judging Everything')
+    title Juryd | #{title}
+    meta(name='description', content='Juryd')
     link(rel='stylesheet', href='/css/style.min.css')
   body
+  
     include partials/header
-
-    section#partial
-          .container
-            .row
-              .col-sm-8.col-sm-offset-2
-                include partials/flash
+    
+    include partials/flash
                 
     block content
 
@@ -23,6 +20,8 @@ html
 
     script(src='/js/lib.min.js')
     script(src='/js/main.min.js')
-    //if lt IE 9
-          script(src='js/html5shiv.min.js')
-          script(src='js/respond.min.js')
+    
+    <!--[if lt IE 9]>
+    script(src='js/html5shiv.min.js')
+    script(src='js/respond.min.js')
+    <!--<![endif]-->

+ 1 - 1
src/views/partials/flash.jade

@@ -15,4 +15,4 @@ if messages.success
     button.close(type='button', data-dismiss='alert')
       i.fa.fa-times-circle-o
     for success in messages.success
-      div= success.msg
+      div= success.msg

+ 0 - 0
src/views/status.jade