Skip to content

Commit

Permalink
Add stripe! Also add compass/sass to toolchain.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHintz committed Aug 8, 2012
1 parent e31a4ba commit 6b6da99
Show file tree
Hide file tree
Showing 10 changed files with 392 additions and 70 deletions.
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@
*~
.sass-cache*
aws-setup.scm
ktr-db
nohup.out
*#
send-grid-key
send-grid-user
stripe-username.scm
24 changes: 24 additions & 0 deletions config.rb
@@ -0,0 +1,24 @@
# Require any additional compass plugins here.

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "js"

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false


# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass scss scss && rm -rf sass && mv scss sass
185 changes: 131 additions & 54 deletions css/club-register.css
@@ -1,62 +1,139 @@
/* line 3, ../scss/_common.scss */
.button {
border: 1px solid grey;
margin-left: 20px;
width: 304px;
color: white;
line-height: 14px;
font-size: 14px;
height: 44px;
-webkit-font-smoothing: antialiased;
font-weight: bold;
font-family: HelveticaNeue, Helvetica, Arial, sans-serif;
cursor: pointer;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.53);
-webkit-border-radius: 4px 4px;
-moz-border-radius: 4px / 4px;
border-radius: 4px / 4px;
}

/* line 18, ../scss/_common.scss */
.button-blue {
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #77b7ff), color-stop(100%, #017aff));
background-image: -webkit-linear-gradient(#77b7ff, #017aff);
background-image: -moz-linear-gradient(#77b7ff, #017aff);
background-image: -o-linear-gradient(#77b7ff, #017aff);
background-image: linear-gradient(#77b7ff, #017aff);
}
/* line 20, ../scss/_common.scss */
.button-blue:active {
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #017aff), color-stop(100%, #77b7ff));
background-image: -webkit-linear-gradient(#017aff, #77b7ff);
background-image: -moz-linear-gradient(#017aff, #77b7ff);
background-image: -o-linear-gradient(#017aff, #77b7ff);
background-image: linear-gradient(#017aff, #77b7ff);
}

/* line 23, ../scss/_common.scss */
.button-green {
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #9fc164), color-stop(100%, #146600));
background-image: -webkit-linear-gradient(#9fc164, #146600);
background-image: -moz-linear-gradient(#9fc164, #146600);
background-image: -o-linear-gradient(#9fc164, #146600);
background-image: linear-gradient(#9fc164, #146600);
}
/* line 25, ../scss/_common.scss */
.button-green:active {
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #146600), color-stop(100%, #9fc164));
background-image: -webkit-linear-gradient(#146600, #9fc164);
background-image: -moz-linear-gradient(#146600, #9fc164);
background-image: -o-linear-gradient(#146600, #9fc164);
background-image: linear-gradient(#146600, #9fc164);
}

/* line 28, ../scss/_common.scss */
.column-header-grey {
background-color: grey;
}

/* line 4, ../scss/club-register.scss */
.action {
margin-bottom: 10px;
margin-top: 10px;
font-family: "Vollkorn";
font-size: 36px; }
margin-bottom: 10px;
margin-top: 10px;
font-family: "Vollkorn";
font-size: 36px;
}

/* line 10, ../scss/club-register.scss */
.form-context {
margin-bottom: 5px;
margin-left: 20px;
font-style: italic;
color: grey;
font-size: 16px; }
margin-bottom: 5px;
margin-left: 20px;
font-style: italic;
color: grey;
font-size: 16px;
}

/* line 17, ../scss/club-register.scss */
.text {
padding: 2px;
line-height: 32px;
margin-left: 20px;
margin-top: 5px;
margin-bottom: 5px;
background-color: #ededed;
width: 300px;
font-size: 24px;
font-family: 'Neucha', arial, serif;
outline: none;
border: 2px solid #ededed;
border-bottom: 2px solid black; }

font-family: 'Helvetica', serif;
padding: 2px;
line-height: 24px;
margin-left: 20px;
margin-top: 5px;
margin-bottom: 5px;
-webkit-border-radius: 4px 4px;
-moz-border-radius: 4px / 4px;
border-radius: 4px / 4px;
width: 300px;
font-size: 16px;
outline: none;
background: white url(/images/input-bg.jpg) repeat-x;
border: 1px solid #DDD;
}
/* line 30, ../scss/club-register.scss */
.text:focus {
-webkit-box-shadow: 0px 0px 10px blue;
border: 2px solid black;
border-radius: 6px;
background-color: white; }

.text:hover {
-webkit-box-shadow: 0px 0px 5px blue;
border: 2px solid white;
border-radius: 6px;
background-color: #eeeeee; }

.create {
width: 330px;
font-size: 24px;
margin-top: 20px;
color: white;
background-color: green;
font-family: Verdana, sans;
border: 1px solid grey;
border-radius: 20px;
-webkit-box-shadow: 0px 0px 10px grey; }

.create:hover {
cursor: pointer;
-webkit-box-shadow: 0px 0px 25px blue; }

.create:focus {
-webkit-box-shadow: 0px 0px 25px blue;
border-radius: 20px;
background-color: green;
border: 1px solid grey; }
border: 1px solid #72b6e6;
-webkit-box-shadow: 0px 0px 10px #72b6e6;
-moz-box-shadow: 0px 0px 10px #72b6e6;
box-shadow: 0px 0px 10px #72b6e6;
}

/* line 34, ../scss/club-register.scss */
.menu-frame {
display: none; }
display: none;
}

/* line 37, ../scss/club-register.scss */
.plan-features {
font-size: 20px;
line-height: 40px;
}

/* line 42, ../scss/club-register.scss */
.plan-features ul li {
font-family: 'Helvetica', serif;
border-top: solid 1px whiteSmoke;
border-bottom: solid 1px #D2D2D2;
}

/* line 47, ../scss/club-register.scss */
.plan-features ul li:first-child {
border-top-color: transparent;
}

/* line 50, ../scss/club-register.scss */
.plan-features ul li:last-child {
border-bottom-color: transparent;
}

/* line 53, ../scss/club-register.scss */
.plan-aside {
color: grey;
font-style: italic;
}

/* line 57, ../scss/club-register.scss */
.payment-errors {
color: red;
font-weight: bold;
}
Binary file added images/input-bg.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions js/payments.js
@@ -0,0 +1,34 @@
function stripeResponseHandler(status, response) {
if (response.error) {
// re-enable the submit button
$('.submit-button').removeAttr("disabled");
// show the errors on the form
$(".payment-errors").html(response.error.message);
} else {
var form$ = $("#payment-form");
// token contains id, last4, and card type
var token = response['id'];
// insert the token into the form so it gets submitted to the server
form$.append("<input type='hidden' name='stripeToken' value='" + token + "' />");
// and submit
form$.get(0).submit();
}
};

$(document).ready(function() {
$("#payment-form").submit(function(event) {
// disable the submit button to prevent repeated clicks
$('.submit-button').attr("disabled", "disabled");

Stripe.createToken({
name: $('.card-name').val(),
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val(),
exp_year: $('.card-expiry-year').val()
}, stripeResponseHandler);

// prevent the form from submitting with the default action
return false;
});
});
12 changes: 11 additions & 1 deletion keep-the-records.scm
Expand Up @@ -11,6 +11,7 @@
(load "pdf")
(load "awana-data-dsl")
(load "sections")
(load "rest")

(define is-production? (make-parameter (file-exists? "/keep-the-records/i-am-production")))

Expand Down Expand Up @@ -65,7 +66,7 @@
"PERMISSION DENIED! If you think this is an error, please email me at t@thintz.com"
(abort exn))
(let ((club (first (string-split actual-path "/"))))
(when (and (not (or (string=? club "user") (string=? club "club")))
(when (and (not (or (string=? club "user") (string=? club "club") (string=? club "sign-up") (string=? club "process-sign-up")))
(not (or (string=? ($session 'club) club) (string=? ($session 'user) "t@thintz.com"))))
(error 'permission-denied))
(++ (if (and (session-valid? (read-cookie "awful-cookie")) ($session 'demo))
Expand Down Expand Up @@ -1736,6 +1737,10 @@

;;; loaders

(define-page "/reload-app"
(lambda () (reload-apps (awful-apps)) "done")
no-session: #t)

(define-page "/reload/index"
(lambda ()
(when (developer-access?)
Expand Down Expand Up @@ -1938,3 +1943,8 @@
(<div> class: "tab-body padding"
(<div> class: "attendees" id: "attendees"
(attendees-html club date))))))


;;; includes

(include "payments.scm")
30 changes: 15 additions & 15 deletions mda.scm
@@ -1,4 +1,4 @@
(use srfi-1 srfi-13 srfi-18 srfi-69 tokyocabinet mailbox (prefix amazon-s3 amazon-s3:))
(use srfi-1 srfi-13 srfi-18 srfi-69 tokyocabinet); mailbox (prefix amazon-s3 amazon-s3:))

;;; utils

Expand Down Expand Up @@ -90,28 +90,28 @@

;;; amazon-s3 stuff

(load "aws-setup.scm") ; for credentials
(define as3-bucket (make-parameter (if (is-production?) "keep-the-records-backup-db" "keep-the-records-dev-backup-db")))
;(load "aws-setup.scm") ; for credentials
;(define as3-bucket (make-parameter (if (is-production?) "keep-the-records-backup-db" "keep-the-records-dev-backup-db")))

(define (make-as3-thread mb)
(make-thread
(lambda ()
(let loop ()
(let ((k-v (mailbox-receive! mb)))
(if (eq? (first k-v) 'put!)
(amazon-s3:put-string! (as3-bucket) (second k-v) (third k-v))
(amazon-s3:delete-object! (as3-bucket) (second k-v))))
(loop)))))
;; (define (make-as3-thread mb)
;; (make-thread
;; (lambda ()
;; (let loop ()
;; (let ((k-v (mailbox-receive! mb)))
;; (if (eq? (first k-v) 'put!)
;; (amazon-s3:put-string! (as3-bucket) (second k-v) (third k-v))
;; (amazon-s3:delete-object! (as3-bucket) (second k-v))))
;; (loop)))))

(define as3-mailbox (make-parameter (make-mailbox)))
;(define as3-mailbox (make-parameter (make-mailbox)))

; make amazon s3 threads
;(for-each (lambda (n) (thread-start! (make-as3-thread (as3-mailbox)))) (range 20))

(define (as3-put! k v) 'a)
;(define (as3-put! k v) 'a)
;(mailbox-send! (as3-mailbox) `(put! ,k ,v)))

(define (as3-delete! k v) 'a)
;(define (as3-delete! k v) 'a)
;(mailbox-send! (as3-mailbox) `(delete! ,k ,v)))

;;; tokyocabinet db operations / to be refactored of course!
Expand Down

0 comments on commit 6b6da99

Please sign in to comment.