diff --git a/Gemfile b/Gemfile index d2fc666b5..803d8f49f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -ruby '1.9.3' +ruby '2.0.0' -gem 'rails', '3.2.13' +gem 'rails', '4.0.0' gem 'json', '~> 1.7.7' group :development do @@ -18,8 +18,8 @@ end # 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' + gem 'sass-rails', '~> 4.0.0' + gem 'coffee-rails', '~> 4.0.0' gem 'uglifier', '>= 1.0.3' end @@ -30,6 +30,7 @@ end # jQuery gem 'jquery-rails' +gem 'jquery-ui-rails' # Kickstarter's awesome Amazon Flexible Payments gem gem 'amazon_flex_pay' diff --git a/Gemfile.lock b/Gemfile.lock index f37514e02..b255e3153 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,151 +1,141 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.13) - actionpack (= 3.2.13) - mail (~> 2.4.4) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) + actionmailer (4.0.0) + actionpack (= 4.0.0) + mail (~> 2.5.3) + actionpack (4.0.0) + activesupport (= 4.0.0) + builder (~> 3.1.0) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.0) + activesupport (= 4.0.0) + builder (~> 3.1.0) + activerecord (4.0.0) + activemodel (= 4.0.0) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.0) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.0) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) amazon_flex_pay (0.10.0) activesupport (>= 3.0.14) multi_xml (>= 0.5.2) rest-client (~> 1.6.1) - arel (3.0.2) - bourne (1.1.2) - mocha (= 0.10.5) - builder (3.0.4) - coderay (1.0.8) - coffee-rails (3.2.2) + arel (4.0.1) + atomic (1.1.14) + builder (3.1.4) + coderay (1.1.0) + coffee-rails (4.0.1) coffee-script (>= 2.2.0) - railties (~> 3.2.0) + railties (>= 4.0.0, < 5.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.4.0) + coffee-script-source (1.6.3) daemons (1.1.9) - diff-lcs (1.1.3) + diff-lcs (1.2.5) erubis (2.7.0) - eventmachine (1.0.0) - execjs (1.4.0) - multi_json (~> 1.0) - hike (1.2.1) - i18n (0.6.1) - journey (1.0.4) - jquery-rails (2.1.4) + eventmachine (1.0.3) + execjs (2.0.2) + hike (1.2.3) + i18n (0.6.5) + jquery-rails (3.0.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) + jquery-ui-rails (4.1.0) + railties (>= 3.1.0) json (1.7.7) - mail (2.4.4) - i18n (>= 0.4.0) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - metaclass (0.0.1) - method_source (0.8.1) - mime-types (1.22) - mocha (0.10.5) - metaclass (~> 0.0.1) - multi_json (1.7.2) - multi_xml (0.5.3) - pg (0.14.1) + method_source (0.8.2) + mime-types (1.25) + minitest (4.7.5) + multi_json (1.8.2) + multi_xml (0.5.5) + pg (0.17.0) polyglot (0.3.3) - pry (0.9.10) - coderay (~> 1.0.5) + pry (0.9.12.3) + coderay (~> 1.0) method_source (~> 0.8) - slop (~> 3.3.1) - pry-rails (0.2.2) + slop (~> 3.4) + pry-rails (0.3.2) pry (>= 0.9.10) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack + rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) - bundler (~> 1.0) - railties (= 3.2.13) - rails_config (0.3.2) + rails (4.0.0) + actionmailer (= 4.0.0) + actionpack (= 4.0.0) + activerecord (= 4.0.0) + activesupport (= 4.0.0) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.0) + sprockets-rails (~> 2.0.0) + rails_config (0.3.3) activesupport (>= 3.0) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) + railties (4.0.0) + actionpack (= 4.0.0) + activesupport (= 4.0.0) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.0.3) - rdoc (3.12) - json (~> 1.4) + thor (>= 0.18.1, < 2.0) + rake (10.1.0) rest-client (1.6.7) mime-types (>= 1.16) - rspec-core (2.12.2) - rspec-expectations (2.12.1) - diff-lcs (~> 1.1.3) - rspec-mocks (2.12.1) - rspec-rails (2.12.1) + rspec-core (2.14.7) + rspec-expectations (2.14.4) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.4) + rspec-rails (2.14.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 2.12.0) - rspec-expectations (~> 2.12.0) - rspec-mocks (~> 2.12.0) - sass (3.2.5) - sass-rails (3.2.5) - railties (~> 3.2.0) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + sass (3.2.12) + sass-rails (4.0.1) + railties (>= 4.0.0, < 5.0) sass (>= 3.1.10) - tilt (~> 1.3) - shoulda (3.3.2) - shoulda-context (~> 1.0.1) - shoulda-matchers (~> 1.4.1) - shoulda-context (1.0.2) - shoulda-matchers (1.4.2) + sprockets-rails (~> 2.0.0) + shoulda (3.5.0) + shoulda-context (~> 1.0, >= 1.0.1) + shoulda-matchers (>= 1.4.1, < 3.0) + shoulda-context (1.1.6) + shoulda-matchers (2.4.0) activesupport (>= 3.0.0) - bourne (~> 1.1.2) - slop (3.3.3) - sprockets (2.2.2) + slop (3.4.7) + sprockets (2.10.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.6) - thin (1.5.0) + sprockets-rails (2.0.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + sqlite3 (1.3.8) + thin (1.6.1) daemons (>= 1.0.9) - eventmachine (>= 0.12.6) + eventmachine (>= 1.0.0) rack (>= 1.0.0) - thor (0.16.0) - tilt (1.3.3) - treetop (1.4.12) + thor (0.18.1) + thread_safe (0.1.3) + atomic + tilt (1.4.1) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.35) - uglifier (1.3.0) + tzinfo (0.3.38) + uglifier (2.2.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) @@ -154,15 +144,16 @@ PLATFORMS DEPENDENCIES amazon_flex_pay - coffee-rails (~> 3.2.1) + coffee-rails (~> 4.0.0) jquery-rails + jquery-ui-rails json (~> 1.7.7) pg pry-rails - rails (= 3.2.13) + rails (= 4.0.0) rails_config rspec-rails (~> 2.0) - sass-rails (~> 3.2.3) + sass-rails (~> 4.0.0) shoulda sqlite3 thin diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ebe9cbb4f..732fd5d3d 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,7 +13,7 @@ //= require html5shiv-printshiv //= require jquery //= require jquery_ujs -//= require jquery-ui +//= require jquery.ui.all //= require jquery.details //= require jquery.textchange //= require preorder diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index a782c5206..5489d36ba 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -11,6 +11,7 @@ *= require_self *= require reset *= require main + *= require jquery.ui.all */ .hidden { diff --git a/app/controllers/preorder_controller.rb b/app/controllers/preorder_controller.rb index 09d051b6c..6795e6d79 100644 --- a/app/controllers/preorder_controller.rb +++ b/app/controllers/preorder_controller.rb @@ -1,5 +1,5 @@ class PreorderController < ApplicationController - skip_before_filter :verify_authenticity_token, :only => :ipn + skip_before_action :verify_authenticity_token, :only => :ipn def index end @@ -8,7 +8,7 @@ def checkout end def prefill - @user = User.find_or_create_by_email!(params[:email]) + @user = User.find_or_create_by(:email => params[:email]) if Settings.use_payment_options payment_option_id = params['payment_option'] @@ -46,7 +46,7 @@ def postfill end def share - @order = Order.find_by_uuid(params[:uuid]) + @order = Order.find_by(:uuid => params[:uuid]) end def ipn diff --git a/app/models/order.rb b/app/models/order.rb index 696197a29..ba9ad4ad5 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -1,11 +1,8 @@ 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, :payment_option - attr_readonly :uuid before_validation :generate_uuid!, :on => :create belongs_to :user belongs_to :payment_option - scope :completed, where("token != ? OR token != ?", "", nil) + scope :completed, -> { where("token != ? OR token != ?", "", nil) } self.primary_key = 'uuid' # This is where we create our Caller Reference for Amazon Payments, and prefill some other information. @@ -23,7 +20,7 @@ def self.prefill!(options = {}) # After authenticating with Amazon, we get the rest of the details def self.postfill!(options = {}) - @order = Order.find_by_uuid!(options[:callerReference]) + @order = Order.find_by!(:uuid => options[:callerReference]) @order.token = options[:tokenID] if @order.token.present? @order.address_one = options[:addressLine1] @@ -52,7 +49,7 @@ def self.next_order_number def generate_uuid! begin self.uuid = SecureRandom.hex(16) - end while Order.find_by_uuid(self.uuid).present? + end while Order.find_by(:uuid => self.uuid).present? end # goal is a dollar amount, not a number of backers, beause you may be using the multiple payment options component diff --git a/app/models/payment_option.rb b/app/models/payment_option.rb index 0904697b9..63fa1de1f 100644 --- a/app/models/payment_option.rb +++ b/app/models/payment_option.rb @@ -1,4 +1,3 @@ class PaymentOption < ActiveRecord::Base - attr_accessible :amount, :amount_display, :delivery_desc, :description, :limit, :shipping_desc has_many :orders end diff --git a/app/models/user.rb b/app/models/user.rb index c388e7e38..a47180590 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,3 @@ class User < ActiveRecord::Base - attr_accessible :email has_many :orders end diff --git a/config/routes.rb b/config/routes.rb index 866c4d978..711d31518 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,9 @@ Selfstarter::Application.routes.draw do root :to => 'preorder#index' - match '/preorder' => 'preorder#index' + match '/preorder' => 'preorder#index', :via => [:get,:post] get 'preorder/checkout' match '/preorder/share/:uuid' => 'preorder#share', :via => :get match '/preorder/ipn' => 'preorder#ipn', :via => :post - match '/preorder/prefill' => 'preorder#prefill' - match '/preorder/postfill' => 'preorder#postfill' + match '/preorder/prefill' => 'preorder#prefill', :via => [:get,:post] + match '/preorder/postfill' => 'preorder#postfill', :via => [:get,:post] end diff --git a/db/schema.rb b/db/schema.rb index d0b7a9250..12b012420 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,11 +9,11 @@ # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # -# It's strongly recommended to check this file into your version control system. +# It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130107010733) do +ActiveRecord::Schema.define(version: 20130107010733) do - create_table "orders", :id => false, :force => true do |t| + create_table "orders", id: false, force: true do |t| t.string "token" t.string "transaction_id" t.string "address_one" @@ -32,26 +32,26 @@ t.string "phone" t.string "name" t.date "expiration" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "payment_option_id" end - create_table "payment_options", :force => true do |t| + create_table "payment_options", force: true do |t| t.decimal "amount" t.string "amount_display" t.text "description" t.string "shipping_desc" t.string "delivery_desc" t.integer "limit" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end - create_table "users", :force => true do |t| + create_table "users", force: true do |t| t.string "email" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end end