Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 6c78632ccf0442618c4f7be0c8a955610e70f2f0 @ryanb ryanb committed Jun 28, 2012
Showing with 1,790 additions and 0 deletions.
  1. +14 −0 README.md
  2. +15 −0 checkout-after/.gitignore
  3. +43 −0 checkout-after/Gemfile
  4. +137 −0 checkout-after/Gemfile.lock
  5. +8 −0 checkout-after/Guardfile
  6. +11 −0 checkout-after/README.md
  7. +7 −0 checkout-after/Rakefile
  8. +15 −0 checkout-after/app/assets/javascripts/application.js
  9. +22 −0 checkout-after/app/assets/javascripts/credit_card.js.coffee
  10. +5 −0 checkout-after/app/assets/javascripts/orders.js.coffee
  11. +13 −0 checkout-after/app/assets/stylesheets/application.css
  12. +79 −0 checkout-after/app/assets/stylesheets/layout.css.scss
  13. +3 −0 checkout-after/app/assets/stylesheets/orders.css.scss
  14. +3 −0 checkout-after/app/controllers/application_controller.rb
  15. +8 −0 checkout-after/app/controllers/orders_controller.rb
  16. +2 −0 checkout-after/app/helpers/application_helper.rb
  17. +2 −0 checkout-after/app/helpers/orders_helper.rb
  18. 0 checkout-after/app/mailers/.gitkeep
  19. 0 checkout-after/app/models/.gitkeep
  20. +4 −0 checkout-after/app/models/order.rb
  21. +17 −0 checkout-after/app/views/layouts/application.html.erb
  22. +3 −0 checkout-after/app/views/orders/create.html.erb
  23. +14 −0 checkout-after/app/views/orders/new.html.erb
  24. +4 −0 checkout-after/config.ru
  25. +62 −0 checkout-after/config/application.rb
  26. +6 −0 checkout-after/config/boot.rb
  27. +25 −0 checkout-after/config/database.yml
  28. +5 −0 checkout-after/config/environment.rb
  29. +37 −0 checkout-after/config/environments/development.rb
  30. +67 −0 checkout-after/config/environments/production.rb
  31. +37 −0 checkout-after/config/environments/test.rb
  32. +7 −0 checkout-after/config/initializers/backtrace_silencers.rb
  33. +15 −0 checkout-after/config/initializers/inflections.rb
  34. +5 −0 checkout-after/config/initializers/mime_types.rb
  35. +7 −0 checkout-after/config/initializers/secret_token.rb
  36. +8 −0 checkout-after/config/initializers/session_store.rb
  37. +14 −0 checkout-after/config/initializers/wrap_parameters.rb
  38. +5 −0 checkout-after/config/locales/en.yml
  39. +4 −0 checkout-after/config/routes.rb
  40. +8 −0 checkout-after/db/migrate/20120627041404_create_orders.rb
  41. +21 −0 checkout-after/db/schema.rb
  42. +7 −0 checkout-after/db/seeds.rb
  43. +2 −0 checkout-after/doc/README_FOR_APP
  44. 0 checkout-after/lib/assets/.gitkeep
  45. 0 checkout-after/lib/tasks/.gitkeep
  46. 0 checkout-after/log/.gitkeep
  47. +26 −0 checkout-after/public/404.html
  48. +26 −0 checkout-after/public/422.html
  49. +25 −0 checkout-after/public/500.html
  50. 0 checkout-after/public/favicon.ico
  51. +5 −0 checkout-after/public/robots.txt
  52. +6 −0 checkout-after/script/rails
  53. +21 −0 checkout-after/spec/javascripts/credit_card_spec.js.coffee
  54. +4 −0 checkout-after/spec/javascripts/fixtures/order_form.html
  55. +3 −0 checkout-after/spec/javascripts/spec.js.coffee
  56. 0 checkout-after/test/fixtures/.gitkeep
  57. +11 −0 checkout-after/test/fixtures/orders.yml
  58. 0 checkout-after/test/functional/.gitkeep
  59. +14 −0 checkout-after/test/functional/orders_controller_test.rb
  60. 0 checkout-after/test/integration/.gitkeep
  61. +12 −0 checkout-after/test/performance/browsing_test.rb
  62. +13 −0 checkout-after/test/test_helper.rb
  63. 0 checkout-after/test/unit/.gitkeep
  64. +4 −0 checkout-after/test/unit/helpers/orders_helper_test.rb
  65. +7 −0 checkout-after/test/unit/order_test.rb
  66. 0 checkout-after/vendor/assets/javascripts/.gitkeep
  67. 0 checkout-after/vendor/assets/stylesheets/.gitkeep
  68. 0 checkout-after/vendor/plugins/.gitkeep
  69. +15 −0 checkout-before/.gitignore
  70. +38 −0 checkout-before/Gemfile
  71. +111 −0 checkout-before/Gemfile.lock
  72. +11 −0 checkout-before/README.md
  73. +7 −0 checkout-before/Rakefile
  74. +15 −0 checkout-before/app/assets/javascripts/application.js
  75. +3 −0 checkout-before/app/assets/javascripts/orders.js.coffee
  76. +13 −0 checkout-before/app/assets/stylesheets/application.css
  77. +79 −0 checkout-before/app/assets/stylesheets/layout.css.scss
  78. +3 −0 checkout-before/app/assets/stylesheets/orders.css.scss
  79. +3 −0 checkout-before/app/controllers/application_controller.rb
  80. +8 −0 checkout-before/app/controllers/orders_controller.rb
  81. +2 −0 checkout-before/app/helpers/application_helper.rb
  82. +2 −0 checkout-before/app/helpers/orders_helper.rb
  83. 0 checkout-before/app/mailers/.gitkeep
  84. 0 checkout-before/app/models/.gitkeep
  85. +4 −0 checkout-before/app/models/order.rb
  86. +17 −0 checkout-before/app/views/layouts/application.html.erb
  87. +3 −0 checkout-before/app/views/orders/create.html.erb
  88. +13 −0 checkout-before/app/views/orders/new.html.erb
  89. +4 −0 checkout-before/config.ru
  90. +62 −0 checkout-before/config/application.rb
  91. +6 −0 checkout-before/config/boot.rb
  92. +25 −0 checkout-before/config/database.yml
  93. +5 −0 checkout-before/config/environment.rb
  94. +37 −0 checkout-before/config/environments/development.rb
  95. +67 −0 checkout-before/config/environments/production.rb
  96. +37 −0 checkout-before/config/environments/test.rb
  97. +7 −0 checkout-before/config/initializers/backtrace_silencers.rb
  98. +15 −0 checkout-before/config/initializers/inflections.rb
  99. +5 −0 checkout-before/config/initializers/mime_types.rb
  100. +7 −0 checkout-before/config/initializers/secret_token.rb
  101. +8 −0 checkout-before/config/initializers/session_store.rb
  102. +14 −0 checkout-before/config/initializers/wrap_parameters.rb
  103. +5 −0 checkout-before/config/locales/en.yml
  104. +4 −0 checkout-before/config/routes.rb
  105. +8 −0 checkout-before/db/migrate/20120627041404_create_orders.rb
  106. +21 −0 checkout-before/db/schema.rb
  107. +7 −0 checkout-before/db/seeds.rb
  108. +2 −0 checkout-before/doc/README_FOR_APP
  109. 0 checkout-before/lib/assets/.gitkeep
  110. 0 checkout-before/lib/tasks/.gitkeep
  111. 0 checkout-before/log/.gitkeep
  112. +26 −0 checkout-before/public/404.html
  113. +26 −0 checkout-before/public/422.html
  114. +25 −0 checkout-before/public/500.html
  115. 0 checkout-before/public/favicon.ico
  116. +5 −0 checkout-before/public/robots.txt
  117. +6 −0 checkout-before/script/rails
  118. 0 checkout-before/test/fixtures/.gitkeep
  119. +11 −0 checkout-before/test/fixtures/orders.yml
  120. 0 checkout-before/test/functional/.gitkeep
  121. +14 −0 checkout-before/test/functional/orders_controller_test.rb
  122. 0 checkout-before/test/integration/.gitkeep
  123. +12 −0 checkout-before/test/performance/browsing_test.rb
  124. +13 −0 checkout-before/test/test_helper.rb
  125. 0 checkout-before/test/unit/.gitkeep
  126. +4 −0 checkout-before/test/unit/helpers/orders_helper_test.rb
  127. +7 −0 checkout-before/test/unit/order_test.rb
  128. 0 checkout-before/vendor/assets/javascripts/.gitkeep
  129. 0 checkout-before/vendor/assets/stylesheets/.gitkeep
  130. 0 checkout-before/vendor/plugins/.gitkeep
@@ -0,0 +1,14 @@
+# RailsCasts Episode #261: Testing JavaScript with Jasmine (revised)
+
+http://railscasts.com/episodes/261-testing-javascript-with-jasmine-revised
+
+Requires Ruby 1.9.2 or higher.
+
+
+### Commands used in this episode
+
+```
+mkdir -p spec/javascripts
+brew install phantomjs
+guard init jasmine
+```
@@ -0,0 +1,15 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile ~/.gitignore_global
+
+# Ignore bundler config
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+
+# Ignore all logfiles and tempfiles.
+/log/*.log
+/tmp
@@ -0,0 +1,43 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.6'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer', :platforms => :ruby
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the app server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'debugger'
+
+group :development, :test do
+ gem 'jasminerice'
+ gem 'guard-jasmine'
+end
@@ -0,0 +1,137 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.6)
+ actionpack (= 3.2.6)
+ mail (~> 2.4.4)
+ actionpack (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.3)
+ activemodel (3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ activerecord (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ activesupport (3.2.6)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ builder (3.0.0)
+ childprocess (0.3.2)
+ ffi (~> 1.0.6)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.3.3)
+ erubis (2.7.0)
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ ffi (1.0.11)
+ guard (1.2.1)
+ listen (>= 0.4.2)
+ thor (>= 0.14.6)
+ guard-jasmine (1.5.0)
+ childprocess
+ guard (>= 1.1.0)
+ multi_json
+ thor
+ haml (3.1.6)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jasminerice (0.0.9)
+ coffee-rails
+ haml
+ journey (1.0.4)
+ jquery-rails (2.0.2)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.7.3)
+ listen (0.4.6)
+ rb-fchange (~> 0.0.5)
+ rb-fsevent (~> 0.9.1)
+ rb-inotify (~> 0.8.8)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.19)
+ multi_json (1.3.6)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.6)
+ actionmailer (= 3.2.6)
+ actionpack (= 3.2.6)
+ activerecord (= 3.2.6)
+ activeresource (= 3.2.6)
+ activesupport (= 3.2.6)
+ bundler (~> 1.0)
+ railties (= 3.2.6)
+ railties (3.2.6)
+ actionpack (= 3.2.6)
+ activesupport (= 3.2.6)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (0.9.2.2)
+ rb-fchange (0.0.5)
+ ffi
+ rb-fsevent (0.9.1)
+ rb-inotify (0.8.8)
+ ffi (>= 0.5.0)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.1.19)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ thor (0.15.3)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+ uglifier (1.2.5)
+ execjs (>= 0.3.0)
+ multi_json (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.2.1)
+ guard-jasmine
+ jasminerice
+ jquery-rails
+ rails (= 3.2.6)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
@@ -0,0 +1,8 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+guard 'jasmine' do
+ watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { "spec/javascripts" }
+ watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
+ watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)$}) { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
+end
@@ -0,0 +1,11 @@
+# RailsCasts Example Application
+
+Run these commands to try it out.
+
+```
+bundle
+rake db:setup
+rails s
+```
+
+Requires Ruby 1.9.2 or later to run.
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Checkout::Application.load_tasks
@@ -0,0 +1,15 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
@@ -0,0 +1,22 @@
+class @CreditCard
+ constructor: (number) ->
+ @number = number.replace(/[ -]/g, '')
+
+ validNumber: ->
+ total = 0
+ for i in [(@number.length-1)..0]
+ n = +@number[i]
+ if (i+@number.length) % 2 == 0
+ n = if n*2 > 9 then n*2 - 9 else n*2
+ total += n
+ total % 10 == 0
+
+
+$.fn.validateCreditCardNumber = ->
+ @each ->
+ $(this).blur ->
+ card = new CreditCard(@value)
+ if !card.validNumber()
+ $(this).next('.error').text("Invalid card number.")
+ else
+ $(this).next('.error').text("")
@@ -0,0 +1,5 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
+jQuery ->
+ $('#order_card_number').validateCreditCardNumber()
@@ -0,0 +1,13 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require_tree .
+ */
@@ -0,0 +1,79 @@
+html, body {
+ background-color: #4B7399;
+ font-family: Verdana, Helvetica, Arial;
+ font-size: 14px;
+}
+
+a img {
+ border: none;
+}
+
+a {
+ color: #0000FF;
+}
+
+.clear {
+ clear: both;
+ height: 0;
+ overflow: hidden;
+}
+
+#container {
+ width: 80%;
+ margin: 0 auto;
+ background-color: #FFF;
+ padding: 20px 40px;
+ border: solid 1px black;
+ margin-top: 20px;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+}
+
+#flash_notice {
+ background-color: #CFC;
+ border: solid 1px #6C6;
+}
+
+#flash_error, #flash_alert {
+ background-color: #FCC;
+ border: solid 1px #C66;
+}
+
+.field_with_errors {
+ display: inline;
+}
+
+.error_messages {
+ width: 400px;
+ border: 2px solid #CF0000;
+ padding: 0px;
+ padding-bottom: 12px;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ font-size: 12px;
+}
+
+.error_messages h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 10px;
+ font-size: 12px;
+ margin: 0;
+ background-color: #c00;
+ color: #fff;
+}
+
+.error_messages p {
+ margin: 8px 10px;
+}
+
+.error_messages ul {
+ margin-bottom: 0;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
@@ -0,0 +1,3 @@
+// Place all the styles related to the orders controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
@@ -0,0 +1,8 @@
+class OrdersController < ApplicationController
+ def new
+ @order = Order.new
+ end
+
+ def create
+ end
+end
Oops, something went wrong.

0 comments on commit 6c78632

Please sign in to comment.