Add hiring page mockup

This commit is contained in:
Christine Dodrill 2015-01-31 23:00:52 -08:00
parent 7119339991
commit e2e9387bb6
5 changed files with 79 additions and 13 deletions

View File

@ -1,15 +1,42 @@
gh = require('github').new({access_token: os.getenv "GITHUB_TOKEN", httpclient_driver: 'httpclient.ngx_driver'})
http = require "lapis.nginx.http"
lapis = require "lapis"
csrf = require "lapis.csrf"
http = require "lapis.nginx.http"
mime = require "mime"
class About extends lapis.Application
[about: "/about"]: =>
@user, err = gh\get_authenticated_user()
import respond_to from require "lapis.application"
import assert_valid from require "lapis.validate"
if err
@err = err
class Hire extends lapis.Application
[hire: "/hire"]: respond_to {
GET: =>
@csrf_token = csrf.generate_token @
return render: true
return status: 500, render: "error"
POST: =>
csrf.assert_token @
return render: true
assert_valid @params, {
{ "name", exists: true, min_length: 3 }
{ "message", exists: true, min_length: 15 }
{ "email", exists: true, min_length: 3 }
}
res, code = http.simple{
url: "https://api.mailgun.net/v2/mailgun.xeserv.us/messages"
headers: {
"authentication": "Basic " .. (mime.b64 os.getenv "MAILGUN_KEY")
}
body: {
from: "#{@params.name} <siteusernoreply@mailgun.xeserv.us>",
to: "xena@yolo-swag.com",
subject: "I want to hire you!",
text: "Email from #{@params.name}:\n\n#{@params.message}\n\nPlease reply to #{@params.email}."
}
}
if code != 200
@err = res
return render: "error", status: 500
return render: "success"
}

View File

@ -5,6 +5,7 @@ daemon off;
env PORT;
env GITHUB_TOKEN;
env GIT_REV;
env MAILGUN_KEY;
events {
worker_connections 1024;

View File

@ -14,7 +14,6 @@ class About extends Widget
div class: "header", ->
h1 "Christine Dodrill"
h4 "Rockstar Programmer"
span "I am a GitHub power user. I am constantly learning new languages and tools. I strongly believe in knowing many languages and ways to do things so I can pick the right tool for the job."
div class: "row nav", ->
@ -31,5 +30,3 @@ class About extends Widget
div class: "col-md-4 col-xs-4 well", title: "Number of users following", ->
i class: "fa fa-thumbs-o-up fa-lg"
p @user.following

33
views/hire.moon Normal file
View File

@ -0,0 +1,33 @@
import Widget from require "lapis.html"
class Hire extends Widget
content: =>
div class: "row", ->
form class: "form-signin", method: "POST", action: "/hire", ->
input type: "hidden", name: "csrf_token", value: @csrf_token
i class:"glyphicon glyphicon-ok form-control-feedback", ->
p "Required"
div class: "form-group", ->
label for: "name", "Your Name"
div class: "input-group", ->
input type: "text", class: "form-control", name: "name", id: "name", placeholder: "Enter Name", :required
raw [[<span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span>]]
div class: "form-group", ->
label for: "email", "Your Email Address"
div class: "input-group", ->
input type: "email", class: "form-control", name: "email", id: "email", placeholder: "Enter Email Address", :required
raw [[<span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span>]]
div class: "form-group", ->
label for: "name", "Message"
div class: "input-group", ->
textarea type: "text", class: "form-control", name: "message", id: "message", rows: 5, :required
raw [[<span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span>]]
raw [[<input type="submit" name="submit" id="submit" value="Submit" class="btn btn-info pull-right">]]

8
views/success.moon Normal file
View File

@ -0,0 +1,8 @@
import Widget from require "lapis.html"
class Success extends Widget
content: =>
center ->
h1 "Thanks!"
p class: "lead", "Thanks for getting in touch! I'll get back with you as soon as I can."