Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adds spree 1.0 support

  • Loading branch information...
commit b34c78a58b2503339b1482b0b679ddb92dae9c39 1 parent 9d68199
@jsqu99 jsqu99 authored
View
5 Gemfile
@@ -2,6 +2,9 @@ source 'http://rubygems.org'
group :test do
gem 'ffaker'
+ gem 'spree_auth', '~> 1.0.0'
+ gem 'spree_gateway', :git => 'git://github.com/spree/spree_gateway.git'
+ gem 'database_cleaner'
end
if RUBY_VERSION < "1.9"
@@ -10,4 +13,6 @@ else
gem "ruby-debug19"
end
+gem 'spree'
+
gemspec
View
252 Gemfile.lock
@@ -0,0 +1,252 @@
+GIT
+ remote: git://github.com/spree/spree_gateway.git
+ revision: c186cac0083c1666eaab3a543b95a674737f6b16
+ specs:
+ spree_gateway (1.0.0)
+ spree_core (>= 1.0.beta)
+
+PATH
+ remote: .
+ specs:
+ spree_reuse_credit_card (1.0.0)
+ spree_core (~> 1.0.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.3)
+ actionpack (= 3.1.3)
+ mail (~> 2.3.0)
+ actionpack (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.5)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.3)
+ active_utils (1.0.3)
+ activesupport (>= 2.3.11)
+ i18n
+ activemerchant (1.20.1)
+ active_utils (>= 1.0.1)
+ activesupport (>= 2.3.11)
+ braintree (>= 2.0.0)
+ builder (>= 2.0.0)
+ i18n
+ json (>= 1.5.1)
+ money (<= 3.7.1)
+ activemodel (3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ activesupport (3.1.3)
+ multi_json (~> 1.0)
+ acts_as_list (0.1.4)
+ archive-tar-minitar (0.5.2)
+ arel (2.2.1)
+ bcrypt-ruby (3.0.1)
+ braintree (2.13.4)
+ builder (>= 2.0.0)
+ builder (3.0.0)
+ cancan (1.6.7)
+ capybara (1.0.1)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.1)
+ ffi (~> 1.0.6)
+ cocaine (0.2.1)
+ columnize (0.3.6)
+ deface (0.7.2)
+ nokogiri (~> 1.5.0)
+ rails (>= 3.0.9)
+ devise (1.4.8)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.0.3)
+ warden (~> 1.0.3)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ factory_girl (2.4.2)
+ activesupport
+ ffaker (1.12.1)
+ ffi (1.0.11)
+ highline (1.6.8)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.19)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ json (1.6.5)
+ kaminari (0.13.0)
+ actionpack (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ railties (>= 3.0.0)
+ linecache19 (0.5.13)
+ ruby_core_source (>= 0.1.4)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ meta_search (1.1.1)
+ actionpack (~> 3.1.0)
+ activerecord (~> 3.1.0)
+ activesupport (~> 3.1.0)
+ polyamorous (~> 0.5.0)
+ mime-types (1.17.2)
+ money (3.7.1)
+ i18n (~> 0.4)
+ multi_json (1.0.4)
+ nested_set (1.6.8)
+ activerecord (>= 3.0.0)
+ railties (>= 3.0.0)
+ nokogiri (1.5.0)
+ orm_adapter (0.0.6)
+ paperclip (2.5.0)
+ activerecord (>= 2.3.0)
+ activesupport (>= 2.3.2)
+ cocaine (>= 0.0.2)
+ mime-types
+ polyamorous (0.5.0)
+ activerecord (~> 3.0)
+ polyglot (0.3.3)
+ rack (1.3.6)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.3)
+ actionmailer (= 3.1.3)
+ actionpack (= 3.1.3)
+ activerecord (= 3.1.3)
+ activeresource (= 3.1.3)
+ activesupport (= 3.1.3)
+ bundler (~> 1.0)
+ railties (= 3.1.3)
+ railties (3.1.3)
+ actionpack (= 3.1.3)
+ activesupport (= 3.1.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
+ ruby-debug-base19 (0.11.26)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby_core_source (0.1.5)
+ archive-tar-minitar (>= 0.5.2)
+ rubyzip (0.9.5)
+ selenium-webdriver (2.16.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0.9)
+ multi_json (~> 1.0.4)
+ rubyzip
+ spree (1.0.0)
+ spree_api (= 1.0.0)
+ spree_auth (= 1.0.0)
+ spree_cmd (= 1.0.0)
+ spree_core (= 1.0.0)
+ spree_dash (= 1.0.0)
+ spree_promo (= 1.0.0)
+ spree_sample (= 1.0.0)
+ spree_api (1.0.0)
+ spree_auth (= 1.0.0)
+ spree_core (= 1.0.0)
+ spree_auth (1.0.0)
+ cancan (= 1.6.7)
+ devise (= 1.4.8)
+ spree_core (= 1.0.0)
+ spree_cmd (1.0.0)
+ rails (>= 3.1.1, <= 3.1.3)
+ spree_core (1.0.0)
+ activemerchant (= 1.20.1)
+ acts_as_list (= 0.1.4)
+ deface (>= 0.7.2)
+ ffaker (~> 1.12.0)
+ highline (= 1.6.8)
+ jquery-rails (>= 1.0.18, <= 1.0.19)
+ kaminari (>= 0.13.0)
+ meta_search (= 1.1.1)
+ nested_set (= 1.6.8)
+ paperclip (= 2.5.0)
+ rails (>= 3.1.1, <= 3.1.3)
+ state_machine (= 1.1.1)
+ stringex (~> 1.3.0)
+ spree_dash (1.0.0)
+ spree_core (= 1.0.0)
+ spree_promo (1.0.0)
+ spree_auth (= 1.0.0)
+ spree_core (= 1.0.0)
+ spree_sample (1.0.0)
+ spree_core (= 1.0.0)
+ sprockets (2.0.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ state_machine (1.1.1)
+ stringex (1.3.2)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.31)
+ warden (1.0.6)
+ rack (>= 1.0)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ capybara (= 1.0.1)
+ factory_girl
+ ffaker
+ rspec-rails (~> 2.7)
+ ruby-debug19
+ spree
+ spree_auth (~> 1.0.0)
+ spree_gateway!
+ spree_reuse_credit_card!
+ sqlite3
View
2  README.md
@@ -1,8 +1,6 @@
SpreeReuseCreditCard
====================
-the master branch is currently being upgraded to spree 1.0 compatability so it is temporarily (next 24 hours?) in an uncertain state.
-
This extension enables view enhancements for managing multiple previously-used credit cards for Spree.
It adds a user/accounts section listing the current credit cards on file.
View
2  app/assets/javascripts/store/spree_reuse_credit_card.js
@@ -13,4 +13,4 @@ function displayCreditCardDeleteStatus(notice) {
$("#card_notice").html('<div class="flash notice">' + notice + '</div>');
}
}
-}
+}
View
25 app/controllers/spree/creditcards_controller.rb
@@ -3,20 +3,21 @@ class CreditcardsController < Spree::BaseController
respond_to :json
- def destroy
- @creditcard = Spree::Creditcard.find(params["id"])
- authorize! :destroy, @creditcard
+ def destroy
+ @creditcard = Spree::Creditcard.find(params["id"])
+ authorize! :destroy, @creditcard
- # TODO: think about the necessity of deleting payment profiles here.
- # I'm thinking we want to always leave them alone
+ # TODO: think about the necessity of deleting payment profiles here.
+ # I'm thinking we want to always leave them alone
- if @creditcard.update_attribute(:deleted_at, Time.now)
- respond_with(@creditcard) do |format|
- format.json { render :status => 200 }
- end
- else
- respond_with(@creditcard) do |format|
- format.json { render :status => 500 }
+ if @creditcard.update_attribute(:deleted_at, Time.now)
+ respond_with(@creditcard) do |format|
+ format.json { render :status => 200 }
+ end
+ else
+ respond_with(@creditcard) do |format|
+ format.json { render :status => 500 }
+ end
end
end
end
View
1  app/controllers/spree/users_controller_decorator.rb
@@ -3,6 +3,7 @@
module Spree
UsersController.class_eval do
include CardReuse
+ helper 'spree/admin/navigation'
before_filter :load_existing_cards, :only => :show
View
9 app/helpers/spree/creditcards_helper.rb
@@ -4,11 +4,12 @@ def link_to_delete_credit_card(card)
# <%# passing in an explicit 'url' here let's us make use of this 'admin' helper and bypass the object_url %>
# <%# (from resourcec_ontroller) that is embedded in the helper %>
- %(link_to_delete card, {
- :url => main_app.creditcard_url(card),
+ s = link_to_delete card, {
+ :url => spree.creditcard_url(card),
:dataType => 'json',
- :success => "function(r){ jQuery('##{dom_id card}').fadeOut('hide'); displayCreditCardDeleteStatus(#{t(:creditcard_successfully_removed)}); }",
- :failure => "function(r){ displayCreditCardDeleteStatus(#{t(:creditcard_not_removed)}); }"} )
+ :success => "function(r){ jQuery('##{dom_id card}').fadeOut('hide'); displayCreditCardDeleteStatus('#{t(:creditcard_successfully_removed)}'); }",
+ :error => "function(r){ displayCreditCardDeleteStatus('#{t(:creditcard_not_removed)}'); }"}
+ s.html_safe
end
end
end
View
2  lib/spree_reuse_credit_card/engine.rb
@@ -11,7 +11,7 @@ class Engine < Rails::Engine
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
- Rails.application.config.cache_classes ? require(c) : load(c)
+ Rails.configuration.cache_classes ? require(c) : load(c)
end
# Yeah, I know. Probably wrong place for this
View
6 script/rails
@@ -1,9 +1,5 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
-
ENGINE_PATH = File.expand_path('../..', __FILE__)
-APP_PATH = File.expand_path('../../../config/application', __FILE__)
-require File.expand_path('../../../config/boot', __FILE__)
-require 'rails/commands'
-
+load File.expand_path('../../spec/dummy/script/rails', __FILE__)
Please sign in to comment.
Something went wrong with that request. Please try again.