Browse Source

Worked on creating contact page

pull/4/head
jrtechs 6 years ago
parent
commit
e89af8fbac
10 changed files with 165 additions and 26 deletions
  1. +18
    -18
      css/bootstrap.css
  2. +3
    -3
      downloads/downloads.js
  3. +1
    -1
      includes/adminHeader.html
  4. +66
    -0
      includes/contact.html
  5. +65
    -0
      includes/contact.js
  6. +1
    -1
      includes/header.html
  7. +1
    -1
      includes/includes.js
  8. +3
    -0
      includes/messageSent.html
  9. +6
    -2
      server.js
  10. +1
    -0
      sitemap.txt

+ 18
- 18
css/bootstrap.css View File

@ -21,14 +21,14 @@
--yellow: #ffc107;
--green: #93C54B;
--teal: #20c997;
--cyan: #29ABE0;
--cyan: #498FBE;
--white: #fff;
--gray: #8E8C84;
--gray-dark: #3E3F3A;
--primary: #325D88;
--secondary: #8E8C84;
--success: #93C54B;
--info: #29ABE0;
--info: #498FBE;
--warning: #F47C3C;
--danger: #d9534f;
--light: #F8F5F0;
@ -2629,8 +2629,8 @@ fieldset:disabled a.btn {
.btn-info {
color: #fff;
background-color: #29ABE0;
border-color: #29ABE0;
background-color: #498FBE;
border-color: #498FBE;
}
.btn-info:hover {
@ -2646,8 +2646,8 @@ fieldset:disabled a.btn {
.btn-info.disabled, .btn-info:disabled {
color: #fff;
background-color: #29ABE0;
border-color: #29ABE0;
background-color: #498FBE;
border-color: #498FBE;
}
.btn-info:not(:disabled):not(.disabled):active, .btn-info:not(:disabled):not(.disabled).active,
@ -2916,16 +2916,16 @@ fieldset:disabled a.btn {
}
.btn-outline-info {
color: #29ABE0;
color: #498FBE;
background-color: transparent;
background-image: none;
border-color: #29ABE0;
border-color: #498FBE;
}
.btn-outline-info:hover {
color: #fff;
background-color: #29ABE0;
border-color: #29ABE0;
background-color: #498FBE;
border-color: #498FBE;
}
.btn-outline-info:focus, .btn-outline-info.focus {
@ -2934,15 +2934,15 @@ fieldset:disabled a.btn {
}
.btn-outline-info.disabled, .btn-outline-info:disabled {
color: #29ABE0;
color: #498FBE;
background-color: transparent;
}
.btn-outline-info:not(:disabled):not(.disabled):active, .btn-outline-info:not(:disabled):not(.disabled).active,
.show > .btn-outline-info.dropdown-toggle {
color: #fff;
background-color: #29ABE0;
border-color: #29ABE0;
background-color: #498FBE;
border-color: #498FBE;
}
.btn-outline-info:not(:disabled):not(.disabled):active:focus, .btn-outline-info:not(:disabled):not(.disabled).active:focus,
@ -5059,7 +5059,7 @@ input[type="button"].btn-block {
.badge-info {
color: #fff;
background-color: #29ABE0;
background-color: #498FBE;
}
.badge-info[href]:hover, .badge-info[href]:focus {
@ -6314,7 +6314,7 @@ button.bg-success:focus {
}
.bg-info {
background-color: #29ABE0 !important;
background-color: #498FBE !important;
}
a.bg-info:hover, a.bg-info:focus,
@ -6424,7 +6424,7 @@ button.bg-dark:focus {
}
.border-info {
border-color: #29ABE0 !important;
border-color: #498FBE !important;
}
.border-warning {
@ -9205,7 +9205,7 @@ a.text-success:hover, a.text-success:focus {
}
.text-info {
color: #29ABE0 !important;
color: #498FBE !important;
}
a.text-info:hover, a.text-info:focus {
@ -9461,7 +9461,7 @@ a.text-dark:hover, a.text-dark:focus {
}
.alert-info, .alert-info > th, .alert-info > td {
background-color: #29ABE0;
background-color: #498FBE;
}
.alert-danger, .alert-danger > th, .alert-danger > td {

+ 3
- 3
downloads/downloads.js View File

@ -12,17 +12,17 @@ const sql = require('../utils/sql');
module.exports=
{
/**
* TODO
*
* @param res
* @param requestURL
* @param request
* @returns {*|Promise}
*/
main: function(res, requestURL, request)
main: function(res, requestURL)
{
return new Promise(function(resolve, reject)
{
var urlSplit = requestURL.split("/");
const urlSplit = requestURL.split("/");
console.log(urlSplit);
if(urlSplit.length == 3 || urlSplit.length == 4)
{

+ 1
- 1
includes/adminHeader.html View File

@ -39,7 +39,7 @@
<a class="nav-link" href="https://jrtechs.net">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://jrtechs.me/#contact">Contact</a>
<a class="nav-link" href="https://jrtechs.net/contact/">Contact</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">

+ 66
- 0
includes/contact.html View File

@ -0,0 +1,66 @@
<div class='col-md-8'>
<!--Form with header-->
<form action="/contact" method="post">
<div class="card border-primary rounded-0">
<div class="card-header p-0">
<div class="bg-info text-white text-center py-2">
<h3><i class="fa fa-envelope"></i>Contact Me</h3>
<p class="m-0">I would love to hear from you.</p>
</div>
</div>
<div class="card-body p-3">
<!--Body-->
<div class="form-group">
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fa fa-user text-info"></i></div>
</div>
<input type="text" class="form-control" id="name" name="name" placeholder="Name" required>
</div>
</div>
<div class="form-group">
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fa fa-envelope text-info"></i></div>
</div>
<input type="email" class="form-control" id="email" name="email" placeholder="example@gmail.com" required>
</div>
</div>
<div class="form-group">
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fa fa-comment text-info"></i></div>
</div>
<textarea class="form-control" placeholder="Message" required></textarea>
</div>
</div>
<div class="form-group">
<div class="g-recaptcha" data-sitekey="6LceWF8UAAAAAIsd7F6iY_Pywt4fJsJlFNPtEgi9"></div>
</div>
<div class="text-center">
<input type="submit" value="Send" class="btn btn-info btn-block rounded-0 py-2">
</div>
</div>
</div>
</form>
</div>
<script src='https://www.google.com/recaptcha/api.js'></script>
<script>
$("form").submit(function(event) {
var recaptcha = $("#g-recaptcha-response").val();
if (recaptcha === "") {
event.preventDefault();
alert("Please check the recaptcha");
}
});
</script>

+ 65
- 0
includes/contact.js View File

@ -0,0 +1,65 @@
/**
* @author Jeffery Russell 8-19-18
*/
//used for file IO
const utils = require('../utils/utils.js');
//used for static files
const includes = require('../includes/includes');
//for parsing post data
const qs = require('querystring');
const processContactPage = function(request)
{
return new Promise(function(resolve, reject)
{
utils.getPostData(request).then(function(postData)
{
const data = qs.parse(postData);
console.log(postData);
console.log(data);
if(data.name && data.email)
{
//send email
resolve(utils.include("includes/messageSent.html"));
}
else
{
resolve(utils.include("includes/contact.html"));
}
}).catch(function(err)
{
reject(err);
})
});
};
module.exports =
{
main: function(request, result)
{
result.writeHead(200, {'Content-Type': 'text/html'});
Promise.all([includes.printAdminHeader(),
processContactPage(request),
require("../sidebar/sidebar.js").main(),
includes.printFooter()]).then(function(content)
{
result.write(content.join(''));
result.end();
}).catch(function(err)
{
console.log(err);
});
}
};

+ 1
- 1
includes/header.html View File

@ -43,7 +43,7 @@
<a class="nav-link" href="https://jrtechs.net">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://jrtechs.me/#contact">Contact</a>
<a class="nav-link" href="https://jrtechs.net/contact/">Contact</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">

+ 1
- 1
includes/includes.js View File

@ -43,7 +43,7 @@ const sendCachedContent = function(cache, path, type, result)
const eTag = crypto.createHash('md5').update(content).digest('hex');
result.writeHead(200, {'Content-Type': type, 'Cache-Control':
'public, max-age=2678400', 'ETag': '"' + eTag + '"',
'Vary': 'Accept-Encoding'});
'Vary': 'Accept-Encoding'});
result.write(content);
result.end();
cache.put(path, content);

+ 3
- 0
includes/messageSent.html View File

@ -0,0 +1,3 @@
<div class='col-md-8'>
<h1>Message Sent</h1>
</div>

+ 6
- 2
server.js View File

@ -69,7 +69,11 @@ app.use(function(request, result)
//downloads
else if(filename.includes("/downloads/"))
{
require("./downloads/downloads.js").main(result, filename, request);
require("./downloads/downloads.js").main(result, filename);
}
else if(filename.includes("/contact"))
{
require("./includes/contact.js").main(request, result);
}
else
{
@ -117,7 +121,7 @@ app.use(function(request, result)
try
{
var getClientAddress = (request.headers['x-forwarded-for'] || '').split(',')[0]
const getClientAddress = (request.headers['x-forwarded-for'] || '').split(',')[0]
|| request.connection.remoteAddress;
console.log(getClientAddress);

+ 1
- 0
sitemap.txt View File

@ -16,4 +16,5 @@ http://jrtechs.net/java/top-three-recommended-java-ides
http://jrtechs.net/other/my-college-essay
http://jrtechs.net/web-development/node-website-optimization
http://jrtechs.net/web-development/node-website-optimization
http://jrtechs.net/programming/c-to-c++-tutorial
http://jrtechs.net/programming/gremlin-in-10-minutes

Loading…
Cancel
Save