johnhenry 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/app/assets/images/johnhenry/home/welcome/ga-screenshot.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/logo-bootstrap-html-css.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/logo-heroku.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/logo-stripe-users.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/sign-in-screenshot.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/sign-up-screenshot.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/tree-bark.png +0 -0
- data/app/assets/images/johnhenry/spinner-primary.gif +0 -0
- data/app/assets/javascripts/johnhenry/application.js +16 -0
- data/app/assets/javascripts/johnhenry/form-require-validation.js +27 -0
- data/app/assets/javascripts/johnhenry/layout.js +6 -0
- data/app/assets/javascripts/johnhenry/payment-form.js +33 -0
- data/app/assets/stylesheets/johnhenry/application.css +21 -0
- data/app/assets/stylesheets/johnhenry/home.css.scss +27 -0
- data/app/assets/stylesheets/johnhenry/payment-form.css.scss +5 -0
- data/app/assets/stylesheets/johnhenry/payments.css.scss +3 -0
- data/app/controllers/johnhenry/application_controller.rb +39 -0
- data/app/controllers/johnhenry/home_controller.rb +25 -0
- data/app/controllers/johnhenry/payments_controller.rb +146 -0
- data/app/controllers/johnhenry/registrations_controller.rb +26 -0
- data/app/controllers/johnhenry/sessions_controller.rb +5 -0
- data/app/helpers/johnhenry/application_helper.rb +4 -0
- data/app/models/payment.rb +3 -0
- data/app/models/user.rb +6 -0
- data/app/views/johnhenry/devise/confirmations/new.html.haml +9 -0
- data/app/views/johnhenry/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/johnhenry/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/johnhenry/devise/mailer/unlock_instructions.html.haml +5 -0
- data/app/views/johnhenry/devise/passwords/edit.html.haml +14 -0
- data/app/views/johnhenry/devise/passwords/new.html.haml +9 -0
- data/app/views/johnhenry/devise/registrations/edit.html.haml +30 -0
- data/app/views/johnhenry/devise/registrations/new.html.haml +6 -0
- data/app/views/johnhenry/devise/sessions/new.html.haml +6 -0
- data/app/views/johnhenry/devise/shared/_links.haml +21 -0
- data/app/views/johnhenry/devise/unlocks/new.html.haml +9 -0
- data/app/views/johnhenry/home/welcome.html.haml +119 -0
- data/app/views/johnhenry/payments/_form.html.haml +19 -0
- data/app/views/johnhenry/payments/edit.html.haml +7 -0
- data/app/views/johnhenry/payments/index.html.haml +22 -0
- data/app/views/johnhenry/payments/index.json.jbuilder +4 -0
- data/app/views/johnhenry/payments/new.html.haml +5 -0
- data/app/views/johnhenry/payments/show.html.haml +19 -0
- data/app/views/johnhenry/payments/show.json.jbuilder +1 -0
- data/app/views/johnhenry/shared/_payment_form.html.haml +74 -0
- data/app/views/johnhenry/shared/_signin_form.html.haml +37 -0
- data/app/views/johnhenry/shared/_signup_form.html.haml +48 -0
- data/app/views/layouts/johnhenry/application.html.haml +65 -0
- data/config/initializers/devise.rb +258 -0
- data/config/routes.rb +12 -0
- data/db/development.sqlite3 +0 -0
- data/db/migrate/20140104011356_add_users_and_payments.rb +33 -0
- data/lib/Gemfile +19 -0
- data/lib/johnhenry.rb +4 -0
- data/lib/johnhenry/engine.rb +5 -0
- data/lib/johnhenry/version.rb +3 -0
- data/lib/tasks/johnhenry_tasks.rake +129 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- metadata +311 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class Johnhenry::RegistrationsController < Devise::RegistrationsController
|
|
2
|
+
before_filter :maybe_generate_password, only: [:create]
|
|
3
|
+
before_filter :noop_test_at_test_dot_com, only: [:create]
|
|
4
|
+
|
|
5
|
+
def new
|
|
6
|
+
render 'johnhenry/devise/registrations/new'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def maybe_generate_password
|
|
12
|
+
if params['user']['password'].blank? &&
|
|
13
|
+
params['user']['password_confirmation'].blank?
|
|
14
|
+
password = Devise.friendly_token.first(10)
|
|
15
|
+
params['user']['password'] = password
|
|
16
|
+
params['user']['password_confirmation'] = password
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def noop_test_at_test_dot_com
|
|
21
|
+
if params['user']['email'] == 'test@test.com'
|
|
22
|
+
flash[:notice] = 'Almost created account for test@test.com.'
|
|
23
|
+
return redirect_to '/'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/app/models/user.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
%h2 Resend confirmation instructions
|
|
2
|
+
= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f|
|
|
3
|
+
= devise_error_messages!
|
|
4
|
+
%div
|
|
5
|
+
= f.label :email
|
|
6
|
+
%br/
|
|
7
|
+
= f.email_field :email, :autofocus => true
|
|
8
|
+
%div= f.submit "Resend confirmation instructions"
|
|
9
|
+
= render "devise/shared/links"
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
%p
|
|
2
|
+
Hello #{@resource.email}!
|
|
3
|
+
%p Someone has requested a link to change your password. You can do this through the link below.
|
|
4
|
+
%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token)
|
|
5
|
+
%p If you didn't request this, please ignore this email.
|
|
6
|
+
%p Your password won't change until you access the link above and create a new one.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
%h2 Change your password
|
|
2
|
+
= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
|
|
3
|
+
= devise_error_messages!
|
|
4
|
+
= f.hidden_field :reset_password_token
|
|
5
|
+
%div
|
|
6
|
+
= f.label :password, "New password"
|
|
7
|
+
%br/
|
|
8
|
+
= f.password_field :password, :autofocus => true
|
|
9
|
+
%div
|
|
10
|
+
= f.label :password_confirmation, "Confirm new password"
|
|
11
|
+
%br/
|
|
12
|
+
= f.password_field :password_confirmation
|
|
13
|
+
%div= f.submit "Change my password"
|
|
14
|
+
= render "devise/shared/links"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
%h2 Forgot your password?
|
|
2
|
+
= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
|
|
3
|
+
= devise_error_messages!
|
|
4
|
+
%div
|
|
5
|
+
= f.label :email
|
|
6
|
+
%br/
|
|
7
|
+
= f.email_field :email, :autofocus => true
|
|
8
|
+
%div= f.submit "Send me reset password instructions"
|
|
9
|
+
= render "devise/shared/links"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
%h2
|
|
2
|
+
Edit #{resource_name.to_s.humanize}
|
|
3
|
+
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|
|
|
4
|
+
= devise_error_messages!
|
|
5
|
+
%div
|
|
6
|
+
= f.label :email
|
|
7
|
+
%br/
|
|
8
|
+
= f.email_field :email, :autofocus => true
|
|
9
|
+
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
|
|
10
|
+
%div
|
|
11
|
+
Currently waiting confirmation for: #{resource.unconfirmed_email}
|
|
12
|
+
%div
|
|
13
|
+
= f.label :password
|
|
14
|
+
%i (leave blank if you don't want to change it)
|
|
15
|
+
%br/
|
|
16
|
+
= f.password_field :password, :autocomplete => "off"
|
|
17
|
+
%div
|
|
18
|
+
= f.label :password_confirmation
|
|
19
|
+
%br/
|
|
20
|
+
= f.password_field :password_confirmation
|
|
21
|
+
%div
|
|
22
|
+
= f.label :current_password
|
|
23
|
+
%i (we need your current password to confirm your changes)
|
|
24
|
+
%br/
|
|
25
|
+
= f.password_field :current_password
|
|
26
|
+
%div= f.submit "Update"
|
|
27
|
+
%h3 Cancel my account
|
|
28
|
+
%p
|
|
29
|
+
Unhappy? #{button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete}
|
|
30
|
+
= link_to "Back", :back
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
- if controller_name != 'sessions'
|
|
2
|
+
Already have an account?
|
|
3
|
+
= link_to raw("Sign in »"), new_session_path(resource_name), class: 'btn btn-info'
|
|
4
|
+
%br/
|
|
5
|
+
- if devise_mapping.registerable? && controller_name != 'registrations'
|
|
6
|
+
Need an account?
|
|
7
|
+
= link_to raw("Sign up »"), new_registration_path(resource_name), class: 'btn btn-info'
|
|
8
|
+
%br/
|
|
9
|
+
- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
|
|
10
|
+
= link_to "Forgot your password?", new_password_path(resource_name)
|
|
11
|
+
%br/
|
|
12
|
+
- if devise_mapping.confirmable? && controller_name != 'confirmations'
|
|
13
|
+
= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
|
|
14
|
+
%br/
|
|
15
|
+
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
|
|
16
|
+
= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
|
|
17
|
+
%br/
|
|
18
|
+
- if devise_mapping.omniauthable?
|
|
19
|
+
- resource_class.omniauth_providers.each do |provider|
|
|
20
|
+
= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider)
|
|
21
|
+
%br/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
%h2 Resend unlock instructions
|
|
2
|
+
= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f|
|
|
3
|
+
= devise_error_messages!
|
|
4
|
+
%div
|
|
5
|
+
= f.label :email
|
|
6
|
+
%br/
|
|
7
|
+
= f.email_field :email, :autofocus => true
|
|
8
|
+
%div= f.submit "Resend unlock instructions"
|
|
9
|
+
= render "devise/shared/links"
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
.container#hero-unit{ style: "background: url(#{ image_path('johnhenry/home/welcome/tree-bark.png') })" }
|
|
2
|
+
.row
|
|
3
|
+
.col-xs-12
|
|
4
|
+
%h1.text-center
|
|
5
|
+
New to Ruby on Rails? Launch a site like this in 10 minutes
|
|
6
|
+
.well.col-md-6.col-md-offset-3.col-sm-8.col-sm-offset-2.col-xs-10.col-xs-offset-1
|
|
7
|
+
%p
|
|
8
|
+
A blank canvas can be intimidating, even if learning Rails is something
|
|
9
|
+
you've wanted to do for years. With
|
|
10
|
+
%i John Henry Rails
|
|
11
|
+
you'll start with a web site like this one in under 10 minutes.
|
|
12
|
+
%p
|
|
13
|
+
Sign up to be notified when the John Henry Rails toolkit is available:
|
|
14
|
+
.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2.col-xs-12
|
|
15
|
+
= render 'johnhenry/shared/signup_form',
|
|
16
|
+
generate_password: true,
|
|
17
|
+
autofocus: true,
|
|
18
|
+
cta: raw('Get Started For Free »')
|
|
19
|
+
|
|
20
|
+
.container#bootstrap
|
|
21
|
+
.row
|
|
22
|
+
.col-sm-6.col-xs-12
|
|
23
|
+
%h2 Leverage Twitter's Bootstrap 3.0
|
|
24
|
+
%p Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
|
|
25
|
+
.col-sm-6.col-xs-12.text-center
|
|
26
|
+
= image_tag "johnhenry/home/welcome/logo-bootstrap-html-css.jpg"
|
|
27
|
+
|
|
28
|
+
.container#stripe
|
|
29
|
+
.row
|
|
30
|
+
.col-xs-12
|
|
31
|
+
%h2 Start taking payments immediately with Stripe
|
|
32
|
+
|
|
33
|
+
.row
|
|
34
|
+
.col-sm-7.col-xs-12
|
|
35
|
+
%p Stripe makes it easy to start accepting credit cards on the web today
|
|
36
|
+
%ul
|
|
37
|
+
%li 2.9% + $.30 per transaction
|
|
38
|
+
%li Stripe stores card number and gives you a secure token
|
|
39
|
+
%li Quick and easy to switch between test and live mode
|
|
40
|
+
%li Used by major Internet companies
|
|
41
|
+
.col-sm-4.col-sm-offset-1.col-xs-12
|
|
42
|
+
= image_tag "johnhenry/home/welcome/logo-stripe-users.jpg"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
.container#common-modules
|
|
46
|
+
.row.well
|
|
47
|
+
.col-xs-12
|
|
48
|
+
%h2 Launch your Ruby on Rails site in just minutes. Start now!
|
|
49
|
+
.col-md-4.col-md-offset-1.col-sm-12
|
|
50
|
+
= render 'johnhenry/shared/payment_form', amount: 7, cta: raw('Take the First Step »')
|
|
51
|
+
.col-md-6.col-md-offset-1
|
|
52
|
+
%h4
|
|
53
|
+
It's never been easier to set up a Ruby on Rails web site. You'll
|
|
54
|
+
have your first version live on the internet in just three easy steps:
|
|
55
|
+
%ol
|
|
56
|
+
%li Download `johnhenry` gem
|
|
57
|
+
%li Follow the installation guide
|
|
58
|
+
%li Deploy to Heroku
|
|
59
|
+
|
|
60
|
+
.container
|
|
61
|
+
.row
|
|
62
|
+
.col-xs-12
|
|
63
|
+
%h2 Bootstrapped Essential Pages
|
|
64
|
+
%h4
|
|
65
|
+
John Henry Rails includes basic user management pages
|
|
66
|
+
.row
|
|
67
|
+
%a{ href: new_user_session_path }
|
|
68
|
+
= image_tag 'johnhenry/home/welcome/sign-in-screenshot.jpg', class: 'col-sm-6 col-xs-12'
|
|
69
|
+
%a{ href: new_user_registration_path }
|
|
70
|
+
= image_tag 'johnhenry/home/welcome/sign-up-screenshot.jpg', class: 'col-sm-6 col-xs-12 '
|
|
71
|
+
|
|
72
|
+
.container#google-analytics
|
|
73
|
+
.row
|
|
74
|
+
.col-xs-12
|
|
75
|
+
%h2 Google Analytics
|
|
76
|
+
.row
|
|
77
|
+
.col-sm-6.col-xs-12
|
|
78
|
+
%ul
|
|
79
|
+
%li Monitor traffic
|
|
80
|
+
%li Link to AdWords
|
|
81
|
+
%li Set up conversion goals
|
|
82
|
+
= image_tag 'johnhenry/home/welcome/ga-screenshot.jpg', class: 'col-sm-6 col-xs-12'
|
|
83
|
+
|
|
84
|
+
.container#heroku
|
|
85
|
+
.row
|
|
86
|
+
.col-xs-12
|
|
87
|
+
%h2 Use Heroku and stop worrying about web hosting
|
|
88
|
+
|
|
89
|
+
.row
|
|
90
|
+
.col-sm-7.col-xs-12
|
|
91
|
+
%p
|
|
92
|
+
Deliver apps, the right way.
|
|
93
|
+
Cloud computing designed and built for developers.
|
|
94
|
+
%ul
|
|
95
|
+
%li Free tier sufficient for small web sites
|
|
96
|
+
%li Makes running a Rails App "foolproof"
|
|
97
|
+
%li Commonly used among Rails developers
|
|
98
|
+
.col-sm-5.col-xs-12.text-center
|
|
99
|
+
%br
|
|
100
|
+
%br
|
|
101
|
+
%br
|
|
102
|
+
= image_tag "johnhenry/home/welcome/logo-heroku.jpg"
|
|
103
|
+
|
|
104
|
+
.container#common-modules
|
|
105
|
+
.row
|
|
106
|
+
.col-md-6
|
|
107
|
+
%h2
|
|
108
|
+
Start with an existing project
|
|
109
|
+
%br
|
|
110
|
+
%ul
|
|
111
|
+
%li Learn by modifying
|
|
112
|
+
%li Use included components
|
|
113
|
+
%li Avoid common mistakes
|
|
114
|
+
%li Save time
|
|
115
|
+
|
|
116
|
+
.col-md-4.col-md-offset-1
|
|
117
|
+
%h4.text-center Example Signup Form
|
|
118
|
+
%h5.text-center Just one of many included forms
|
|
119
|
+
= render 'johnhenry/shared/signup_form', cta: raw('Example Button »')
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
= form_for @payment do |f|
|
|
2
|
+
- if @payment.errors.any?
|
|
3
|
+
#error_explanation
|
|
4
|
+
%h2= "#{pluralize(@payment.errors.count, "error")} prohibited this payment from being saved:"
|
|
5
|
+
%ul
|
|
6
|
+
- @payment.errors.full_messages.each do |msg|
|
|
7
|
+
%li= msg
|
|
8
|
+
|
|
9
|
+
.field
|
|
10
|
+
= f.label :user_id
|
|
11
|
+
= f.text_field :user_id
|
|
12
|
+
.field
|
|
13
|
+
= f.label :stripe_token
|
|
14
|
+
= f.text_field :stripe_token
|
|
15
|
+
.field
|
|
16
|
+
= f.label :stripe_customer_id
|
|
17
|
+
= f.text_field :stripe_customer_id
|
|
18
|
+
.actions
|
|
19
|
+
= f.submit 'Save'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.container
|
|
2
|
+
.row
|
|
3
|
+
%h1.col-xs-12.text-center Payments
|
|
4
|
+
|
|
5
|
+
%table.col-xs-12
|
|
6
|
+
- if @payments.empty?
|
|
7
|
+
%i.col-xs-12.text-center — No payments —
|
|
8
|
+
- else
|
|
9
|
+
%tr
|
|
10
|
+
%th User
|
|
11
|
+
%th Stripe token
|
|
12
|
+
%th Stripe customer
|
|
13
|
+
%th
|
|
14
|
+
%th
|
|
15
|
+
%th
|
|
16
|
+
|
|
17
|
+
- @payments.each do |payment|
|
|
18
|
+
%tr
|
|
19
|
+
%td= payment.user_id
|
|
20
|
+
%td= payment.stripe_token
|
|
21
|
+
%td= payment.stripe_customer_id
|
|
22
|
+
%td= link_to 'Show', payment
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.container
|
|
2
|
+
.row
|
|
3
|
+
.col-xs-12
|
|
4
|
+
.row
|
|
5
|
+
.col-xs-12
|
|
6
|
+
%p
|
|
7
|
+
%b User:
|
|
8
|
+
= @payment.user.email
|
|
9
|
+
.col-xs-12
|
|
10
|
+
%p
|
|
11
|
+
%b Amount:
|
|
12
|
+
= @payment.amount
|
|
13
|
+
.col-xs-12
|
|
14
|
+
%p
|
|
15
|
+
%b Date:
|
|
16
|
+
= @payment.created_at
|
|
17
|
+
.container
|
|
18
|
+
.row
|
|
19
|
+
.col-xs-12= raw(@readme)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
json.extract! @payment, :id, :user_id, :stripe_token, :stripe_customer_id, :created_at, :updated_at
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
%script{ src: 'https://js.stripe.com/v2/', type: 'text/javascript' }
|
|
2
|
+
= form_tag '/payments', id: 'payment-form', method: 'POST',
|
|
3
|
+
data: { 'stripe-publishable-key' => ENV['STRIPE_PUBLISHABLE_KEY'],
|
|
4
|
+
'cc-on-file' => false }, class: 'require-validation' do
|
|
5
|
+
- if false
|
|
6
|
+
.form-row
|
|
7
|
+
We have your credit card information on file.
|
|
8
|
+
- else
|
|
9
|
+
.form-row
|
|
10
|
+
.col-xs-12.form-group.required
|
|
11
|
+
%label.control-label Email Address
|
|
12
|
+
- if signed_in?
|
|
13
|
+
%input.form-control{ size: '4', type: 'email',
|
|
14
|
+
value: current_user.email,
|
|
15
|
+
disabled: true }/
|
|
16
|
+
- elsif Rails.env.development?
|
|
17
|
+
- nonce = nil # Devise.friendly_token.first(10)
|
|
18
|
+
%input.form-control{ name: 'email', size: '4', type: 'email', value: "user+#{ nonce }@example.com" }/
|
|
19
|
+
- else
|
|
20
|
+
%input.form-control{ name: 'email', size: '4', type: 'email' }/
|
|
21
|
+
|
|
22
|
+
.form-row
|
|
23
|
+
.col-xs-12.form-group.card.required
|
|
24
|
+
%label.control-label Card Number
|
|
25
|
+
-# TODO stub in default values better for dev
|
|
26
|
+
- if Rails.env.development?
|
|
27
|
+
%input.form-control.card-number{ autocomplete: 'off', size: '20', type: 'text', value: '4242424242424242' }/
|
|
28
|
+
- else
|
|
29
|
+
%input.form-control.card-number{ autocomplete: 'off', size: '20', type: 'text' }/
|
|
30
|
+
|
|
31
|
+
.form-row
|
|
32
|
+
.col-xs-4.form-group.cvc.required
|
|
33
|
+
%label.control-label CVC
|
|
34
|
+
- if Rails.env.development?
|
|
35
|
+
%input.form-control.card-cvc{ autocomplete: 'off', size: '4', type: 'text', placeholder: 'ex. 311', value: '175' }/
|
|
36
|
+
- else
|
|
37
|
+
%input.form-control.card-cvc{ autocomplete: 'off', size: '4', type: 'text', placeholder: 'ex. 311' }/
|
|
38
|
+
.col-xs-4.form-group.expiration.required
|
|
39
|
+
%label.control-label Expiration
|
|
40
|
+
- if Rails.env.development?
|
|
41
|
+
%input.form-control.card-expiry-month{ size: '2', type: 'text', placeholder: 'MM', value: '04' }/
|
|
42
|
+
- else
|
|
43
|
+
%input.form-control.card-expiry-month{ size: '2', type: 'text', placeholder: 'MM' }/
|
|
44
|
+
.col-xs-4.form-group.expiration.required
|
|
45
|
+
%label.control-label
|
|
46
|
+
- if Rails.env.development?
|
|
47
|
+
%input.form-control.card-expiry-year{ size: '4', type: 'text', placeholder: 'YYYY', value: '2014' }/
|
|
48
|
+
- else
|
|
49
|
+
%input.form-control.card-expiry-year{ size: '4', type: 'text', placeholder: 'YYYY' }/
|
|
50
|
+
|
|
51
|
+
.form-row
|
|
52
|
+
.col-md-12
|
|
53
|
+
.form-control.total.btn.btn-info
|
|
54
|
+
Total:
|
|
55
|
+
%span.amount= number_to_currency(local_assigns[:amount].try(:to_f) || 50)
|
|
56
|
+
|
|
57
|
+
- %w(STRIPE_PUBLISHABLE_KEY STRIPE_SECRET_KEY).each do |env_var|
|
|
58
|
+
- if ENV[env_var].blank?
|
|
59
|
+
.form-row
|
|
60
|
+
.col-md-12
|
|
61
|
+
.form-control.total.btn.btn-warning{ style: 'margin-top: 10px; height: auto; white-space: normal' }
|
|
62
|
+
Environment variable `#{ env_var }` must be set for this
|
|
63
|
+
form to work.
|
|
64
|
+
|
|
65
|
+
.form-row
|
|
66
|
+
.col-md-12.form-group
|
|
67
|
+
%button.form-control.btn.btn-primary.submit-button{ type: 'submit' }
|
|
68
|
+
= image_tag 'johnhenry/spinner-primary.gif', class: 'hide'
|
|
69
|
+
= local_assigns[:cta] || raw('Pay »')
|
|
70
|
+
|
|
71
|
+
.form-row
|
|
72
|
+
.col-md-12.error.form-group.hide
|
|
73
|
+
.alert-danger.alert
|
|
74
|
+
Please fix the errors and try again.
|