diff --git a/Gemfile b/Gemfile index 26fbd10..a2ed6a0 100644 --- a/Gemfile +++ b/Gemfile @@ -3,12 +3,12 @@ source 'https://rubygems.org' gem 'rails', '3.2.8' group :development do - gem 'sqlite3' + gem 'sqlite3' end group :production do - gem 'thin' - gem 'pg' + gem 'thin' + gem 'pg' end # Gems used only for assets and not required @@ -27,4 +27,4 @@ gem 'jquery-rails' gem 'amazon_flex_pay' # Configuration File -gem 'rails_config' \ No newline at end of file +gem 'rails_config' diff --git a/app/assets/javascripts/preorder.js.coffee b/app/assets/javascripts/preorder.js.coffee index 3919e25..c6c6339 100644 --- a/app/assets/javascripts/preorder.js.coffee +++ b/app/assets/javascripts/preorder.js.coffee @@ -20,9 +20,3 @@ Selfstarter = $ -> Selfstarter.init() $("#email").focus() - - - - - - diff --git a/app/assets/stylesheets/homepage/call_to_action.css.scss b/app/assets/stylesheets/homepage/call_to_action.css.scss index edb154b..078f6c5 100644 --- a/app/assets/stylesheets/homepage/call_to_action.css.scss +++ b/app/assets/stylesheets/homepage/call_to_action.css.scss @@ -1,4 +1,4 @@ -#reserve_container +#reserve_container { float: left; padding-top: 20px; @@ -8,13 +8,13 @@ box-shadow: 0 -1px 0 #cbcbcb; /* drop shadow */ margin-top: 30px; text-align: center; - p + p { color: #8b8a8a; font-size: 18px; line-height: 1.4; } - #ship_date + #ship_date { color: #4c4c4c; font-size: 22px; @@ -24,7 +24,7 @@ margin: 0 auto; width: 300px; } - #price + #price { color: #4c4c4c; font-size: 22px; @@ -35,7 +35,7 @@ width: 300px; } } -.reserve +.reserve { margin: 0 auto; margin-top: 20px; @@ -45,7 +45,7 @@ font-size: 32px; } -#middle_reserve +#middle_reserve { padding: 60px; h2 @@ -53,4 +53,3 @@ margin-bottom: 26px; } } - diff --git a/app/assets/stylesheets/homepage/press.css.scss b/app/assets/stylesheets/homepage/press.css.scss index c18b38e..9cc907b 100644 --- a/app/assets/stylesheets/homepage/press.css.scss +++ b/app/assets/stylesheets/homepage/press.css.scss @@ -4,7 +4,7 @@ -moz-box-shadow: 0px 1px 3px 0px #acacac; -webkit-box-shadow: 0px 1px 3px 0px #acacac; box-shadow: 0px 1px 3px 0px #acacac; - li + li { float: left; margin: 0 16px; @@ -39,9 +39,3 @@ width: 81px; } } - - - - - - diff --git a/app/assets/stylesheets/homepage/stats.css.scss b/app/assets/stylesheets/homepage/stats.css.scss index 42d16b3..2c2c6b7 100644 --- a/app/assets/stylesheets/homepage/stats.css.scss +++ b/app/assets/stylesheets/homepage/stats.css.scss @@ -1,47 +1,47 @@ -#backing +#backing { float: left; width: 383px; margin: 20px 0 0 40px; - #backers - { - border-left: none; - padding-left: 0; - ul - { - float: left; - } - } - #days { - border-right: none; - padding-right: 0; - } - ul { - text-align: center; - } - .stats - { - margin: 0 auto; - color: #3f3f3f; - font-size: 24px; - display: block; - display: inline-block; - font-family: $primary_font, $secondary_font, $tertiary_font; - border-right: 1px solid #cbcbcb; - padding-right: 26px; - padding-left: 26px; - text-align: left; - span - { - color: #868686; - font-size: 18px; - margin-top: 5px; - display: block; - font-family: $primary_font, $secondary_font, $tertiary_font; - } - } + #backers + { + border-left: none; + padding-left: 0; + ul + { + float: left; + } + } + #days { + border-right: none; + padding-right: 0; + } + ul { + text-align: center; + } + .stats + { + margin: 0 auto; + color: #3f3f3f; + font-size: 24px; + display: block; + display: inline-block; + font-family: $primary_font, $secondary_font, $tertiary_font; + border-right: 1px solid #cbcbcb; + padding-right: 26px; + padding-left: 26px; + text-align: left; + span + { + color: #868686; + font-size: 18px; + margin-top: 5px; + display: block; + font-family: $primary_font, $secondary_font, $tertiary_font; + } + } } -#progress_bg +#progress_bg { margin-top: 20px; float: left; @@ -54,7 +54,7 @@ border-radius: 30px; width: 383px; background: #dbdbdb; - #progress + #progress { height: 40px; -moz-box-shadow: 0 1px 1px rgba(0,0,0,.59); /* drop shadow */ @@ -74,23 +74,23 @@ display: inline-block; } #progress_text - { - margin: 0 auto; - width: 100%; - font-size: 14pt; - display: inline-block; - color: white; - text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.37); - text-align: center; - position: relative; - top: -35px; - } + { + margin: 0 auto; + width: 100%; + font-size: 14pt; + display: inline-block; + color: white; + text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.37); + text-align: center; + position: relative; + top: -35px; + } } .small { - height: 20px !important; - #progress - { - height: 20px !important; - } -} \ No newline at end of file + height: 20px !important; + #progress + { + height: 20px !important; + } +} diff --git a/app/controllers/preorder_controller.rb b/app/controllers/preorder_controller.rb index 2367fc0..db819b6 100644 --- a/app/controllers/preorder_controller.rb +++ b/app/controllers/preorder_controller.rb @@ -2,41 +2,38 @@ class PreorderController < ApplicationController skip_before_filter :verify_authenticity_token, :only => :ipn def index - end def checkout - end def prefill - @user = User.find_or_create_by_email!(params[:email]) - @order = Order.prefill!(:name => Settings.product_name, :price => Settings.price, :user_id => @user.id) + @user = User.find_or_create_by_email!(params[:email]) + @order = Order.prefill!(:name => Settings.product_name, :price => Settings.price, :user_id => @user.id) - # This is where all the magic happens. We create a multi-use token with Amazon, letting us charge the user's Amazon account - # Then, if they confirm the payment, Amazon POSTs us their shipping details and phone number - # From there, we save it, and voila, we got ourselves a preorder! + # This is where all the magic happens. We create a multi-use token with Amazon, letting us charge the user's Amazon account + # Then, if they confirm the payment, Amazon POSTs us their shipping details and phone number + # From there, we save it, and voila, we got ourselves a preorder! @pipeline = AmazonFlexPay.multi_use_pipeline(@order.uuid, :transaction_amount => Settings.price, :global_amount_limit => Settings.charge_limit, :collect_shipping_address => "True", :payment_reason => Settings.payment_description) - redirect_to @pipeline.url("#{request.scheme}://#{request.host}/preorder/postfill") + redirect_to @pipeline.url("#{request.scheme}://#{request.host}/preorder/postfill") end def postfill - unless params[:callerReference].blank? - @order = Order.postfill!(params) - end - # "A" means the user cancelled the preorder before clicking "Confirm" on Amazon Payments. - if params['status'] != 'A' && @order.present? - redirect_to :action => :share, :uuid => @order.uuid - else - redirect_to root_url - end + unless params[:callerReference].blank? + @order = Order.postfill!(params) + end + # "A" means the user cancelled the preorder before clicking "Confirm" on Amazon Payments. + if params['status'] != 'A' && @order.present? + redirect_to :action => :share, :uuid => @order.uuid + else + redirect_to root_url + end end def share - @order = Order.find_by_uuid(params[:uuid]) + @order = Order.find_by_uuid(params[:uuid]) end def ipn end - end diff --git a/app/helpers/preorder_helper.rb b/app/helpers/preorder_helper.rb index 8372d05..d46028a 100644 --- a/app/helpers/preorder_helper.rb +++ b/app/helpers/preorder_helper.rb @@ -1,17 +1,17 @@ module PreorderHelper - def like_button(width = 70, show_faces = false) - raw "
" - end - def pin_it_button - image_url = URI.encode("#{request.scheme}://#{request.host}#{image_path(Settings.product_image_url)}") - raw "
"
- end
- def tweet_button
- tweet_text = "I'm #{Settings.primary_stat_verb} number #{number_with_delimiter @order.number, :delimiter => ","} #{Settings.tweet_text}!"
- raw "Tweet"
- end
+ def like_button(width = 70, show_faces = false)
+ raw ""
+ end
+ def pin_it_button
+ image_url = URI.encode("#{request.scheme}://#{request.host}#{image_path(Settings.product_image_url)}")
+ raw "
"
+ end
+ def tweet_button
+ tweet_text = "I'm #{Settings.primary_stat_verb} number #{number_with_delimiter @order.number, :delimiter => ","} #{Settings.tweet_text}!"
+ raw "Tweet"
+ end
- def encoded_root_url
- raw URI.encode "#{request.scheme}://#{request.host}/preorder"
- end
+ def encoded_root_url
+ raw URI.encode "#{request.scheme}://#{request.host}/preorder"
+ end
end
diff --git a/app/models/order.rb b/app/models/order.rb
index 8821428..b7c9687 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -2,51 +2,50 @@ class Order < ActiveRecord::Base
attr_accessible :address_one, :address_two, :city, :country, :number, :state, :status, :token, :transaction_id, :zip, :shipping, :tracking_number, :name, :price, :phone, :expiration
attr_readonly :uuid
before_validation :generate_uuid!, :on => :create
- belongs_to :user
+ belongs_to :user
self.primary_key = 'uuid'
-
# This is where we create our Caller Reference for Amazon Payments, and prefill some other information.
def self.prefill!(options = {})
- @order = Order.new
- @order.name = options[:name]
- @order.user_id = options[:user_id]
- @order.price = options[:price]
- @order.number = Order.next_order_number || 1
- @order.save!
+ @order = Order.new
+ @order.name = options[:name]
+ @order.user_id = options[:user_id]
+ @order.price = options[:price]
+ @order.number = Order.next_order_number || 1
+ @order.save!
- return @order
+ @order
end
# After authenticating with Amazon, we get the rest of the details
def self.postfill!(options = {})
- @order = Order.find_by_uuid!(options[:callerReference])
- @order.token = options[:tokenID]
- if !@order.token.blank?
- @order.address_one = options[:addressLine1]
- @order.address_two = options[:addressLine2]
- @order.city = options[:city]
- @order.state = options[:state]
+ @order = Order.find_by_uuid!(options[:callerReference])
+ @order.token = options[:tokenID]
+ if @order.token.present?
+ @order.address_one = options[:addressLine1]
+ @order.address_two = options[:addressLine2]
+ @order.city = options[:city]
+ @order.state = options[:state]
@order.status = options[:status]
- @order.zip = options[:zip]
- @order.phone = options[:phoneNumber]
- @order.country = options[:country]
+ @order.zip = options[:zip]
+ @order.phone = options[:phoneNumber]
+ @order.country = options[:country]
@order.expiration = Date.parse(options[:expiry])
- @order.save!
+ @order.save!
- @order
- end
+ @order
+ end
end
def self.next_order_number
- Order.order("number DESC").limit(1).first.number.to_i + 1 if Order.count > 0
+ Order.order("number DESC").limit(1).first.number.to_i + 1 if Order.count > 0
end
def generate_uuid!
- self.uuid = SecureRandom.hex(16)
+ self.uuid = SecureRandom.hex(16)
end
- # Implement these three methods to
+ # Implement these three methods to
def self.goal
Settings.project_goal
end
diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb
index 635aa49..1ff4f44 100644
--- a/app/views/layouts/_footer.html.erb
+++ b/app/views/layouts/_footer.html.erb
@@ -1,22 +1,22 @@
\ No newline at end of file
+ © 2009-2012 Apigy Inc. All rights reserved. Patents pending.
+
Let your backers know how their payment information will be handled.
-
- Enter your email address below.
+
+ Enter your email address below.
You'll need to create an Amazon Seller Central account. Afterwards, get your access key and secret key from the "Integration" tab on your AWS account. Click here for more info.
-
-
- Once you have your access key and secret key, head over to config/settings.yml. Change amazon_access_key and amazon_secret_key appropriately.
The faq is a partial located in app/views/preorder/homepage/_faq.html.erb The summary tag is the title, the p is the body. Make sure to add an li tag for each FAQ entry.
The best way is in config/settings.yml. It has variables for several different parts, the YouTube video, the product name, the call to action button ("Fork Now"), and several more.
-
Head over to app/assets/stylesheets/variables.css.scss. It makes it easy to change around the elements used throughout the HTML.
-
-
- Alternatively, you can dive right into the CSS, have a look at app/assets/stylesheets/main.css.scss.
Hardware startups are less welcome on Kickstarter than they were 6 months ago. We needed to roll our own kickstarter, so we did. Other hardware startups probably will too, so we made it easier for them by open sourcing our way of doing it.
-It's a Ruby on Rails app that makes heavy use of SCSS, Kickstarter's wonderful amazon_flex_pay gem, and a hint of CoffeeScript.
We recommend using Heroku. We include a Procfile for you, so all you need to do is: -
-
Install the Heroku Toolbelt
-Run heroku create in Selfstarter's folder
Run git push heroku master in Selfstarter's folder
You'll need to create an Amazon Seller Central account. Afterwards, get your access key and secret key from the "Integration" tab on your AWS account. Click here for more info.
+
+
+ Once you have your access key and secret key, head over to config/settings.yml. Change amazon_access_key and amazon_secret_key appropriately.
The faq is a partial located in app/views/preorder/homepage/_faq.html.erb The summary tag is the title, the p is the body. Make sure to add an li tag for each FAQ entry.
The best way is in config/settings.yml. It has variables for several different parts, the YouTube video, the product name, the call to action button ("Fork Now"), and several more.
+
Head over to app/assets/stylesheets/variables.css.scss. It makes it easy to change around the elements used throughout the HTML.
+
+
+ Alternatively, you can dive right into the CSS, have a look at app/assets/stylesheets/main.css.scss.
Hardware startups are less welcome on Kickstarter than they were 6 months ago. We needed to roll our own kickstarter, so we did. Other hardware startups probably will too, so we made it easier for them by open sourcing our way of doing it.
+It's a Ruby on Rails app that makes heavy use of SCSS, Kickstarter's wonderful amazon_flex_pay gem, and a hint of CoffeeScript.
We recommend using Heroku. We include a Procfile for you, so all you need to do is: +
+
Install the Heroku Toolbelt
+Run heroku create in Selfstarter's folder
Run git push heroku master in Selfstarter's folder
- \ No newline at end of file + diff --git a/app/views/preorder/homepage/_middle_reserve.html.erb b/app/views/preorder/homepage/_middle_reserve.html.erb index 6cf1a3c..c789606 100644 --- a/app/views/preorder/homepage/_middle_reserve.html.erb +++ b/app/views/preorder/homepage/_middle_reserve.html.erb @@ -3,4 +3,4 @@
Curabitur ac mi elit, nec tempor odio. Nam sollicitudin, sapien sit amet elementum pretium, turpis mi fermentum nisl, ac vehicula purus lacus non velit.
- \ No newline at end of file + diff --git a/app/views/preorder/homepage/_press.html.erb b/app/views/preorder/homepage/_press.html.erb index f837db6..b8d4c74 100644 --- a/app/views/preorder/homepage/_press.html.erb +++ b/app/views/preorder/homepage/_press.html.erb @@ -1,8 +1,8 @@ \ No newline at end of file + + diff --git a/app/views/preorder/share.html.erb b/app/views/preorder/share.html.erb index a4449a4..aea025a 100644 --- a/app/views/preorder/share.html.erb +++ b/app/views/preorder/share.html.erb @@ -4,23 +4,22 @@ Hooray! You've just reserved a <%= Settings.product_name %>!Congratulations, you're <%= Settings.primary_stat_verb %> number <%= number_with_delimiter @order.number, :delimiter => "," %>, in supporting <%= Settings.product_name %>. Share the great news!
-