jackpot 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/.rspec +1 -0
- data/.rvmrc.example +1 -0
- data/.travis.yml +12 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +181 -0
- data/MIT-LICENSE +20 -0
- data/README.md +134 -0
- data/Rakefile +25 -0
- data/app/assets/images/jackpot/.gitkeep +0 -0
- data/app/assets/javascripts/jackpot/application.js +5 -0
- data/app/assets/javascripts/jackpot/bootstrap.js +32 -0
- data/app/assets/javascripts/jackpot/customers.js +2 -0
- data/app/assets/javascripts/jackpot/login.js +1 -0
- data/app/assets/javascripts/jackpot/payments.js +2 -0
- data/app/assets/javascripts/jackpot/subscriptions.js +2 -0
- data/app/assets/stylesheets/jackpot/application.css +9 -0
- data/app/assets/stylesheets/jackpot/customers.css +4 -0
- data/app/assets/stylesheets/jackpot/jackpot.css +10 -0
- data/app/controllers/jackpot/application_controller.rb +4 -0
- data/app/controllers/jackpot/customers_controller.rb +100 -0
- data/app/controllers/jackpot/payments_controller.rb +20 -0
- data/app/controllers/jackpot/subscriptions_controller.rb +86 -0
- data/app/helpers/jackpot/application_helper.rb +27 -0
- data/app/helpers/jackpot/customers_helper.rb +7 -0
- data/app/helpers/jackpot/subscriptions_helper.rb +4 -0
- data/app/models/jackpot/card.rb +29 -0
- data/app/models/jackpot/customer.rb +48 -0
- data/app/models/jackpot/gateway.rb +28 -0
- data/app/models/jackpot/payment.rb +33 -0
- data/app/models/jackpot/subscription.rb +13 -0
- data/app/models/jackpot/user.rb +25 -0
- data/app/views/jackpot/customers/_credit_card_form.html.erb +42 -0
- data/app/views/jackpot/customers/_form.html.erb +17 -0
- data/app/views/jackpot/customers/edit.html.erb +13 -0
- data/app/views/jackpot/customers/index.html.erb +30 -0
- data/app/views/jackpot/customers/new.html.erb +8 -0
- data/app/views/jackpot/customers/show.html.erb +32 -0
- data/app/views/jackpot/payments/create.html.erb +1 -0
- data/app/views/jackpot/payments/index.html.erb +25 -0
- data/app/views/jackpot/shared/_flash_messages.html.erb +6 -0
- data/app/views/jackpot/shared/_navigation.html.erb +5 -0
- data/app/views/jackpot/subscriptions/_form.html.erb +13 -0
- data/app/views/jackpot/subscriptions/edit.html.erb +6 -0
- data/app/views/jackpot/subscriptions/index.html.erb +29 -0
- data/app/views/jackpot/subscriptions/new.html.erb +4 -0
- data/app/views/jackpot/subscriptions/show.html.erb +23 -0
- data/app/views/layouts/devise.html.erb +22 -0
- data/app/views/layouts/jackpot/application.html.erb +39 -0
- data/config/initializers/jackpot_devise.rb +226 -0
- data/config/locales/devise.en.yml +57 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20111221002616_create_jackpot_payments.rb +11 -0
- data/db/migrate/20111230014003_add_customer_information_to_jackpot_payments.rb +5 -0
- data/db/migrate/20120102223341_create_jackpot_subscriptions.rb +10 -0
- data/db/migrate/20120103211153_create_jackpot_customers.rb +11 -0
- data/db/migrate/20120104164830_add_credit_card_number_to_customer.rb +5 -0
- data/db/migrate/20120130173242_add_credit_card_information_to_customers.rb +7 -0
- data/db/migrate/20120208191815_add_billing_period_to_jackpot_subscriptions.rb +5 -0
- data/db/migrate/20120208191934_add_good_until_date_to_jackpot_customers.rb +6 -0
- data/db/migrate/20120209203542_add_subscription_and_customer_to_jackpot_payments.rb +8 -0
- data/db/migrate/20120209212043_rename_column_token_in_jackpot_payments.rb +5 -0
- data/db/migrate/20120210144038_devise_create_jackpot_users.rb +49 -0
- data/jackpot.gemspec +33 -0
- data/lib/jackpot.rb +23 -0
- data/lib/jackpot/configuration.rb +33 -0
- data/lib/jackpot/cron.rb +22 -0
- data/lib/jackpot/engine.rb +14 -0
- data/lib/jackpot/errors.rb +18 -0
- data/lib/jackpot/factory.rb +26 -0
- data/lib/jackpot/version.rb +3 -0
- data/lib/tasks/jackpot_tasks.rake +38 -0
- data/script/rails +6 -0
- data/spec/controllers/jackpot/customers_controller_spec.rb +170 -0
- data/spec/controllers/jackpot/payments_controller_spec.rb +47 -0
- data/spec/controllers/jackpot/subscriptions_controller_spec.rb +153 -0
- data/spec/dummy/.gitignore +1 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +51 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +17 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +32 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +41 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/jackpot.rb +13 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/schema.rb +68 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/index.html +5 -0
- data/spec/dummy/public/payment.html +36 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/fixtures/vcr/Create_Customers_To_bill_monthly_my_customers_As_a_user_I_want_to_record_their_billing_information_/assigning_credit_card_information_to_customer.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_NEVER_persist_in_the_database_the_actual_card_number.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_NEVER_persist_in_the_database_the_verification_value.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_persist_in_the_database_the_ONLY_last_four_digits.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_persist_the_card_information.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_store_this_card_at_the_gateway.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_create/with_valid_token_information/creates_a_new_payment.yml +96 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_create/with_valid_token_information/does_not_persist_credit_card_token_information.yml +96 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_create/with_valid_token_information/records_the_payment_transaction_id_for_future_reference.yml +96 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_create/with_valid_token_information/records_this_payment_information.yml +96 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_customer_name/returns_its_customer_email.yml +96 -0
- data/spec/fixtures/vcr/jackpot/customer/updatecard.yml +34 -0
- data/spec/fixtures/vcr/jackpot/customer_expiration_date.yml +34 -0
- data/spec/fixtures/vcr/jackpot/receiving_payments.yml +96 -0
- data/spec/helpers/jackpot/customers_helper_spec.rb +16 -0
- data/spec/helpers/jackpot/subscriptions_helper_spec.rb +4 -0
- data/spec/lib/cron_spec.rb +39 -0
- data/spec/lib/factory_spec.rb +40 -0
- data/spec/models/jackpot/card_spec.rb +23 -0
- data/spec/models/jackpot/customer_spec.rb +140 -0
- data/spec/models/jackpot/gateway_spec.rb +22 -0
- data/spec/models/jackpot/payment_spec.rb +74 -0
- data/spec/models/jackpot/subscription_spec.rb +19 -0
- data/spec/requests/jackpot/jackpot_assign_subscription_to_customer_spec.rb +39 -0
- data/spec/requests/jackpot/jackpot_create_customer_spec.rb +73 -0
- data/spec/requests/jackpot/jackpot_create_subscriptions_spec.rb +27 -0
- data/spec/requests/jackpot/jackpot_receive_payments_spec.rb +34 -0
- data/spec/spec_helper.rb +41 -0
- data/spec/support/active_merchant.rb +1 -0
- data/spec/support/capybara.rb +6 -0
- data/spec/support/devise.rb +21 -0
- data/spec/support/factories/jackpot_customers.rb +36 -0
- data/spec/support/factories/jackpot_payments.rb +7 -0
- data/spec/support/factories/jackpot_subscriptions.rb +9 -0
- data/spec/support/factories/jackpot_users.rb +9 -0
- data/spec/support/helpers.rb +16 -0
- data/spec/support/routes.rb +3 -0
- data/spec/support/vcr.rb +10 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/twitter/bootstrap.js +12 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +91 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +98 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +154 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +136 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +92 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +209 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +95 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +125 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +130 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +270 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +51 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +271 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/bootstrap-responsive.css +567 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/bootstrap.css.erb +3366 -0
- metadata +351 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
module Jackpot
|
2
|
+
|
3
|
+
def self.table_name_prefix
|
4
|
+
'jackpot_'
|
5
|
+
end
|
6
|
+
|
7
|
+
class User < ActiveRecord::Base
|
8
|
+
# Include default devise modules. Others available are:
|
9
|
+
# :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
10
|
+
devise :database_authenticatable,
|
11
|
+
:registerable,
|
12
|
+
:recoverable,
|
13
|
+
:rememberable,
|
14
|
+
:trackable,
|
15
|
+
:validatable,
|
16
|
+
:token_authenticatable
|
17
|
+
|
18
|
+
# Setup accessible (or protected) attributes for your model
|
19
|
+
attr_accessible :email,
|
20
|
+
:password,
|
21
|
+
:password_confirmation,
|
22
|
+
:remember_me
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<%= form_tag(credit_card_customer_path, :method => :put , :id => "credit-card-form") do %>
|
2
|
+
<fieldset>
|
3
|
+
<legend>Credit Card Details</legend>
|
4
|
+
|
5
|
+
|
6
|
+
<div class="optional text clearfix" id="credit_card_number">
|
7
|
+
<%= label_tag "credit_card[number]", "Number" %>
|
8
|
+
<%= text_field_tag "credit_card[number]" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="optional text clearfix" id="credit_card_month">
|
12
|
+
<%= label_tag "credit_card[month]", "Month" %>
|
13
|
+
<%= text_field_tag "credit_card[month]" %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="optional text clearfix" id="credit_card_year">
|
17
|
+
<%= label_tag "credit_card[year]", "Year" %>
|
18
|
+
<%= text_field_tag "credit_card[year]" %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="optional text clearfix" id="credit_card_first_name">
|
22
|
+
<%= label_tag "credit_card[first_name]", "First Name" %>
|
23
|
+
<%= text_field_tag "credit_card[first_name]" %>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="optional text clearfix" id="credit_card_last_name">
|
27
|
+
<%= label_tag "credit_card[last_name]", "Last Name" %>
|
28
|
+
<%= text_field_tag "credit_card[last_name]" %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="optional text clearfix" id="credit_card_verification_value">
|
32
|
+
<%= label_tag "credit_card[verification_value]",
|
33
|
+
"Verification Value" %>
|
34
|
+
<%= text_field_tag "credit_card[verification_value]" %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="actions">
|
38
|
+
<%= submit_tag "Confirm" %>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
</fieldset>
|
42
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= semantic_form_for @customer do |f| %>
|
2
|
+
<%= f.semantic_errors %>
|
3
|
+
|
4
|
+
<%= f.inputs do %>
|
5
|
+
<%= f.input :email %>
|
6
|
+
<%= f.input :description, :input_html => {
|
7
|
+
:class => 'autogrow',
|
8
|
+
:rows => 10,
|
9
|
+
:cols => 20,
|
10
|
+
:maxlength => 10 } %>
|
11
|
+
<%= f.input :subscription %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= f.buttons do %>
|
15
|
+
<%= f.commit_button :button_html => { :class => "primary" } %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<h1> Editing customer </h1>
|
2
|
+
|
3
|
+
<div id="form-basic-information">
|
4
|
+
|
5
|
+
<h2> Basic information </h2>
|
6
|
+
<%= render 'form' %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div id="credit-card-information">
|
10
|
+
<%= render 'credit_card_form' %>
|
11
|
+
</div>
|
12
|
+
<%= link_to 'Show', @customer %> |
|
13
|
+
<%= link_to 'Back', customers_path %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<h1> Listing customers </h1>
|
2
|
+
<table class="table table-striped">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th>Email</th>
|
6
|
+
<th>Description</th>
|
7
|
+
<th>Subscription</th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
|
14
|
+
<% @customers.each do |customer| %>
|
15
|
+
<tr id="customer-<%= customer.id %>">
|
16
|
+
<td><%= customer.email %> </td>
|
17
|
+
<td><%= customer.description %> </td>
|
18
|
+
<td><%= subscription_name_when_available(customer) %> </td>
|
19
|
+
<td><%= link_to 'Show', customer %> </td>
|
20
|
+
<td><%= link_to 'Edit', edit_customer_path(customer) %> </td>
|
21
|
+
<td><%= link_to 'Destroy', customer, :confirm => 'Are you sure?', :method => :delete %> </td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
</table>
|
26
|
+
|
27
|
+
|
28
|
+
<p>
|
29
|
+
<%= link_to 'New Customer', new_customer_path %>
|
30
|
+
</p>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<p id="notice"> <%= notice %> </p>
|
2
|
+
<div id="customer">
|
3
|
+
<p>
|
4
|
+
<b> Email: </b> <%= @customer.email %>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<p>
|
8
|
+
<b> Description: </b> <%= @customer.description %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b> Subscription: </b> <%= @customer.subscription.name if @customer.subscription.present? %>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<h2> Billing information </h2>
|
16
|
+
|
17
|
+
<% if @customer.credit_card_number.present? %>
|
18
|
+
<p>
|
19
|
+
<b> Credit Card Number: </b> <%= @customer.credit_card_number %>
|
20
|
+
</p>
|
21
|
+
<p>
|
22
|
+
<b> Credit Card Expiration Date: </b> <%= @customer.expiration_date %>
|
23
|
+
</p>
|
24
|
+
<% else %>
|
25
|
+
<p>
|
26
|
+
There is no credit card information assigned to this customer yet
|
27
|
+
</p>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<%= link_to "Edit", edit_customer_path(@customer) %> |
|
32
|
+
<%= link_to "Back", customers_path %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1> Payment created with success </h1>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h1> Payments </h1>
|
2
|
+
|
3
|
+
<% if @payments.present? %>
|
4
|
+
|
5
|
+
<table id="latest-payments" class="table table-striped">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th> Customer Email </th>
|
9
|
+
<th> Amount</th>
|
10
|
+
<th> Created at</th>
|
11
|
+
</tr>
|
12
|
+
|
13
|
+
<tbody>
|
14
|
+
<% @payments.each do |payment| %>
|
15
|
+
<tr>
|
16
|
+
<td class="customer-email"><%= payment.customer_email %></td>
|
17
|
+
<td class="amount"><%= number_to_currency(payment.amount) %></td>
|
18
|
+
<td class="created_at"><%= distance_of_time_in_words_to_now(payment.created_at) %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</tbody>
|
22
|
+
</thead>
|
23
|
+
|
24
|
+
</table>
|
25
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= semantic_form_for @subscription do |f| %>
|
2
|
+
<%= f.semantic_errors %>
|
3
|
+
|
4
|
+
<%= f.inputs do %>
|
5
|
+
<%= f.input :name %>
|
6
|
+
<%= f.input :price , hint: "Price in cents. Eq: 100 for 1 dolar/month subscriptions" %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= f.buttons do %>
|
10
|
+
<%= f.commit_button :button_html => { :class => "primary" } %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h1> Listing subscriptions </h1>
|
2
|
+
|
3
|
+
<table class="table table-striped">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th> Name </th>
|
7
|
+
<th> Price </th>
|
8
|
+
<th> </th>
|
9
|
+
<th> </th>
|
10
|
+
<th> </th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
|
14
|
+
<tbody>
|
15
|
+
<% @subscriptions.each do |subscription| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= subscription.name %></td>
|
18
|
+
<td><%= subscription.price %></td>
|
19
|
+
<td><%= link_to 'Show', subscription %></td>
|
20
|
+
<td><%= link_to 'Edit', edit_subscription_path(subscription)%></td>
|
21
|
+
<td><%= link_to 'Destroy', subscription, :confirm => 'Are you sure?',:method => :delete%></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<p>
|
28
|
+
<%= link_to 'New Subscription', new_subscription_path %>
|
29
|
+
</p>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h1> Subscription details </h1>
|
2
|
+
<p>
|
3
|
+
<b>Name:</b> <%= @subscription.name %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
|
7
|
+
<p>
|
8
|
+
<b>Price:</b> <%= number_to_currency @subscription.price %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<% if @subscription.customers.present? %>
|
12
|
+
<h2> Subscribers </h2>
|
13
|
+
<ul id="subscribers">
|
14
|
+
<% @subscription.customers.each do |subscriber| %>
|
15
|
+
<li>
|
16
|
+
<%= link_to subscriber.email , customer_path(subscriber) %>
|
17
|
+
</li>
|
18
|
+
<% end %>
|
19
|
+
</ul>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<%= link_to 'Edit', edit_subscription_path(@subscription) %> |
|
23
|
+
<%= link_to 'Back', subscriptions_path %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Jackpot</title>
|
5
|
+
<%= stylesheet_link_tag "jackpot/application" %>
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div class="navbar navbar-fixed-top">
|
10
|
+
<div class="navbar-inner">
|
11
|
+
<div class="container-fluid">
|
12
|
+
<%= link_to "Jackpot", "/billing", :class => "brand" %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="container-fluid">
|
17
|
+
<div class="offset5">
|
18
|
+
<%= yield %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Jackpot</title>
|
5
|
+
<%= stylesheet_link_tag "jackpot/application" %>
|
6
|
+
<%= javascript_include_tag "jackpot/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div class="navbar navbar-fixed-top">
|
11
|
+
<div class="navbar-inner">
|
12
|
+
<div class="container-fluid">
|
13
|
+
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
14
|
+
<span class="icon-bar"></span>
|
15
|
+
<span class="icon-bar"></span>
|
16
|
+
<span class="icon-bar"></span>
|
17
|
+
</a>
|
18
|
+
|
19
|
+
<%= link_to "Jackpot", root_path , :class => "brand" %>
|
20
|
+
<div class="nav-collapse">
|
21
|
+
<%= render "jackpot/shared/navigation" %>
|
22
|
+
|
23
|
+
<p class="navbar-text pull-right">
|
24
|
+
Logged in as <strong> <%= current_user.email %></strong> <%= link_to "Sign out", destroy_user_session_path , :method => :delete %>
|
25
|
+
</p>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
<div class="container-fluid">
|
30
|
+
<div class="row-fluid">
|
31
|
+
<%= render "jackpot/shared/flash_messages" %>
|
32
|
+
</div>
|
33
|
+
<div class="row-fluid">
|
34
|
+
<%= yield %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
</body>
|
39
|
+
</html>
|
@@ -0,0 +1,226 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
|
+
# Many of these configuration options can be set straight in your model.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# TODO: See how to retrieve the actual value where the engine is mounted
|
5
|
+
# Remove this hardcoded value
|
6
|
+
config.router_name = :jackpot
|
7
|
+
# ==> Mailer Configuration
|
8
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
9
|
+
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
10
|
+
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
11
|
+
|
12
|
+
# Configure the class responsible to send e-mails.
|
13
|
+
# config.mailer = "Devise::Mailer"
|
14
|
+
|
15
|
+
# Automatically apply schema changes in tableless databases
|
16
|
+
config.apply_schema = false
|
17
|
+
|
18
|
+
# ==> ORM configuration
|
19
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
20
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
21
|
+
# available as additional gems.
|
22
|
+
require 'devise/orm/active_record'
|
23
|
+
|
24
|
+
# ==> Configuration for any authentication mechanism
|
25
|
+
# Configure which keys are used when authenticating a user. The default is
|
26
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
27
|
+
# authenticating a user, both parameters are required. Remember that those
|
28
|
+
# parameters are used only when authenticating and not when retrieving from
|
29
|
+
# session. If you need permissions, you should implement that in a before filter.
|
30
|
+
# You can also supply a hash where the value is a boolean determining whether
|
31
|
+
# or not authentication should be aborted when the value is not present.
|
32
|
+
# config.authentication_keys = [ :email ]
|
33
|
+
|
34
|
+
# Configure parameters from the request object used for authentication. Each entry
|
35
|
+
# given should be a request method and it will automatically be passed to the
|
36
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
37
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
38
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
39
|
+
# config.request_keys = []
|
40
|
+
|
41
|
+
# Configure which authentication keys should be case-insensitive.
|
42
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
43
|
+
# to authenticate or find a user. Default is :email.
|
44
|
+
config.case_insensitive_keys = [ :email ]
|
45
|
+
|
46
|
+
# Configure which authentication keys should have whitespace stripped.
|
47
|
+
# These keys will have whitespace before and after removed upon creating or
|
48
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
49
|
+
config.strip_whitespace_keys = [ :email ]
|
50
|
+
|
51
|
+
# Tell if authentication through request.params is enabled. True by default.
|
52
|
+
# It can be set to an array that will enable params authentication only for the
|
53
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
54
|
+
# enable it only for database (email + password) authentication.
|
55
|
+
# config.params_authenticatable = true
|
56
|
+
|
57
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
58
|
+
# It can be set to an array that will enable http authentication only for the
|
59
|
+
# given strategies, for example, `config.http_authenticatable = [:token]` will
|
60
|
+
# enable it only for token authentication.
|
61
|
+
config.http_authenticatable = [:token]
|
62
|
+
|
63
|
+
# If http headers should be returned for AJAX requests. True by default.
|
64
|
+
# config.http_authenticatable_on_xhr = true
|
65
|
+
|
66
|
+
# The realm used in Http Basic Authentication. "Application" by default.
|
67
|
+
# config.http_authentication_realm = "Application"
|
68
|
+
|
69
|
+
# It will change confirmation, password recovery and other workflows
|
70
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
71
|
+
# Does not affect registerable.
|
72
|
+
# config.paranoid = true
|
73
|
+
|
74
|
+
# By default Devise will store the user in session. You can skip storage for
|
75
|
+
# :http_auth and :token_auth by adding those symbols to the array below.
|
76
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
77
|
+
# may want to disable generating routes to Devise's sessions controller by
|
78
|
+
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
79
|
+
config.skip_session_storage = [:http_auth]
|
80
|
+
|
81
|
+
# ==> Configuration for :database_authenticatable
|
82
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
83
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
84
|
+
#
|
85
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
86
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
87
|
+
# a value less than 10 in other environments.
|
88
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
89
|
+
|
90
|
+
# Setup a pepper to generate the encrypted password.
|
91
|
+
# config.pepper = "106f64daf01db7834a11ef4ce193ed9a5ff35b69d309f40a2b121f11e1553d1594082b69d6d3bf9faff287503a6ce15bca440e3a24d00c147076db00c3d7892a"
|
92
|
+
|
93
|
+
# ==> Configuration for :confirmable
|
94
|
+
# A period that the user is allowed to access the website even without
|
95
|
+
# confirming his account. For instance, if set to 2.days, the user will be
|
96
|
+
# able to access the website for two days without confirming his account,
|
97
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
98
|
+
# the user cannot access the website without confirming his account.
|
99
|
+
# config.allow_unconfirmed_access_for = 2.days
|
100
|
+
|
101
|
+
# If true, requires any email changes to be confirmed (exctly the same way as
|
102
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
103
|
+
# db field (see migrations). Until confirmed new email is stored in
|
104
|
+
# unconfirmed email column, and copied to email column on successful confirmation.
|
105
|
+
config.reconfirmable = true
|
106
|
+
|
107
|
+
# Defines which key will be used when confirming an account
|
108
|
+
# config.confirmation_keys = [ :email ]
|
109
|
+
|
110
|
+
# ==> Configuration for :rememberable
|
111
|
+
# The time the user will be remembered without asking for credentials again.
|
112
|
+
# config.remember_for = 2.weeks
|
113
|
+
|
114
|
+
# If true, extends the user's remember period when remembered via cookie.
|
115
|
+
# config.extend_remember_period = false
|
116
|
+
|
117
|
+
# If true, uses the password salt as remember token. This should be turned
|
118
|
+
# to false if you are not using database authenticatable.
|
119
|
+
config.use_salt_as_remember_token = true
|
120
|
+
|
121
|
+
# Options to be passed to the created cookie. For instance, you can set
|
122
|
+
# :secure => true in order to force SSL only cookies.
|
123
|
+
# config.cookie_options = {}
|
124
|
+
|
125
|
+
# ==> Configuration for :validatable
|
126
|
+
# Range for password length. Default is 6..128.
|
127
|
+
# config.password_length = 6..128
|
128
|
+
|
129
|
+
# Email regex used to validate email formats. It simply asserts that
|
130
|
+
# an one (and only one) @ exists in the given string. This is mainly
|
131
|
+
# to give user feedback and not to assert the e-mail validity.
|
132
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
133
|
+
|
134
|
+
# ==> Configuration for :timeoutable
|
135
|
+
# The time you want to timeout the user session without activity. After this
|
136
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
137
|
+
# config.timeout_in = 30.minutes
|
138
|
+
|
139
|
+
# ==> Configuration for :lockable
|
140
|
+
# Defines which strategy will be used to lock an account.
|
141
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
142
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
143
|
+
# config.lock_strategy = :failed_attempts
|
144
|
+
|
145
|
+
# Defines which key will be used when locking and unlocking an account
|
146
|
+
# config.unlock_keys = [ :email ]
|
147
|
+
|
148
|
+
# Defines which strategy will be used to unlock an account.
|
149
|
+
# :email = Sends an unlock link to the user email
|
150
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
151
|
+
# :both = Enables both strategies
|
152
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
153
|
+
# config.unlock_strategy = :both
|
154
|
+
|
155
|
+
# Number of authentication tries before locking an account if lock_strategy
|
156
|
+
# is failed attempts.
|
157
|
+
# config.maximum_attempts = 20
|
158
|
+
|
159
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
160
|
+
# config.unlock_in = 1.hour
|
161
|
+
|
162
|
+
# ==> Configuration for :recoverable
|
163
|
+
#
|
164
|
+
# Defines which key will be used when recovering the password for an account
|
165
|
+
# config.reset_password_keys = [ :email ]
|
166
|
+
|
167
|
+
# Time interval you can reset your password with a reset password key.
|
168
|
+
# Don't put a too small interval or your users won't have the time to
|
169
|
+
# change their passwords.
|
170
|
+
config.reset_password_within = 6.hours
|
171
|
+
|
172
|
+
# ==> Configuration for :encryptable
|
173
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
174
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
175
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
176
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
177
|
+
# REST_AUTH_SITE_KEY to pepper)
|
178
|
+
# config.encryptor = :sha512
|
179
|
+
|
180
|
+
# ==> Configuration for :token_authenticatable
|
181
|
+
# Defines name of the authentication token params key
|
182
|
+
config.token_authentication_key = :auth_token
|
183
|
+
|
184
|
+
# ==> Scopes configuration
|
185
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
186
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
187
|
+
# are using only default views.
|
188
|
+
# config.scoped_views = false
|
189
|
+
|
190
|
+
# Configure the default scope given to Warden. By default it's the first
|
191
|
+
# devise role declared in your routes (usually :user).
|
192
|
+
# config.default_scope = :user
|
193
|
+
|
194
|
+
# Configure sign_out behavior.
|
195
|
+
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
|
196
|
+
# The default is true, which means any logout action will sign out all active scopes.
|
197
|
+
# config.sign_out_all_scopes = true
|
198
|
+
|
199
|
+
# ==> Navigation configuration
|
200
|
+
# Lists the formats that should be treated as navigational. Formats like
|
201
|
+
# :html, should redirect to the sign in page when the user does not have
|
202
|
+
# access, but formats like :xml or :json, should return 401.
|
203
|
+
#
|
204
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
205
|
+
# should add them to the navigational formats lists.
|
206
|
+
#
|
207
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
208
|
+
# config.navigational_formats = ["*/*", :html]
|
209
|
+
|
210
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
211
|
+
config.sign_out_via = :delete
|
212
|
+
|
213
|
+
# ==> OmniAuth
|
214
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
215
|
+
# up on your models and hooks.
|
216
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
217
|
+
|
218
|
+
# ==> Warden configuration
|
219
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
220
|
+
# change the failure app, you can configure them inside the config.warden block.
|
221
|
+
#
|
222
|
+
# config.warden do |manager|
|
223
|
+
# manager.intercept_401 = false
|
224
|
+
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
225
|
+
# end
|
226
|
+
end
|