spree_store_credits 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +36 -0
- data/Rakefile +51 -22
- data/Versionfile +4 -0
- data/app/controllers/admin/store_credits_controller.rb +10 -16
- data/app/controllers/users_controller_decorator.rb +1 -1
- data/app/models/order_decorator.rb +6 -3
- data/app/models/promotion/actions/give_store_credit.rb +10 -0
- data/app/models/user_decorator.rb +5 -1
- data/app/overrides/views_decorator.rb +39 -0
- data/app/views/admin/store_credits/index.html.erb +3 -2
- data/app/views/users/_store_credits.html.erb +2 -0
- data/lib/spree_store_credits.rb +6 -1
- data/spec/factories/store_credits_factory.rb +20 -0
- data/spec/requests/store_credits_spec.rb +30 -0
- data/spec/spec_helper.rb +23 -2
- data/spree_store_credits.gemspec +1 -1
- metadata +15 -6
- data/lib/spree_store_credits_hooks.rb +0 -26
data/Gemfile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rake', '~> 0.8.7'
|
4
|
+
gem 'linecache', '0.43'
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'rspec-rails', '= 2.6.1'
|
8
|
+
gem 'factory_girl', '= 1.3.3'
|
9
|
+
gem 'factory_girl_rails', '= 1.0.1'
|
10
|
+
gem 'rcov'
|
11
|
+
gem 'shoulda'
|
12
|
+
gem 'faker'
|
13
|
+
if RUBY_VERSION < "1.9"
|
14
|
+
gem "ruby-debug"
|
15
|
+
else
|
16
|
+
gem "ruby-debug19"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
group :cucumber do
|
21
|
+
gem 'cucumber-rails'
|
22
|
+
gem 'database_cleaner', '= 0.6.7'
|
23
|
+
gem 'nokogiri'
|
24
|
+
gem 'capybara', '= 0.4.1.2'
|
25
|
+
gem 'factory_girl', '= 1.3.3'
|
26
|
+
gem 'factory_girl_rails', '= 1.0.1'
|
27
|
+
gem 'faker'
|
28
|
+
gem 'launchy'
|
29
|
+
|
30
|
+
if RUBY_VERSION < "1.9"
|
31
|
+
gem "ruby-debug"
|
32
|
+
else
|
33
|
+
gem "ruby-debug19"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
gem 'spree', :git => 'git://github.com/spree/spree.git'
|
data/Rakefile
CHANGED
@@ -2,53 +2,82 @@
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rake'
|
4
4
|
require 'rake/testtask'
|
5
|
+
require 'rake/packagetask'
|
6
|
+
require 'rubygems/package_task'
|
7
|
+
|
8
|
+
gemfile = File.expand_path('../spec/test_app/Gemfile', __FILE__)
|
9
|
+
if File.exists?(gemfile) && (%w(spec cucumber).include?(ARGV.first.to_s) || ARGV.size == 0)
|
10
|
+
require 'bundler'
|
11
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
12
|
+
Bundler.setup
|
13
|
+
|
14
|
+
require 'rspec'
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
RSpec::Core::RakeTask.new
|
17
|
+
|
18
|
+
require 'cucumber/rake/task'
|
19
|
+
Cucumber::Rake::Task.new do |t|
|
20
|
+
t.cucumber_opts = %w{--format progress}
|
21
|
+
end
|
22
|
+
end
|
5
23
|
|
6
24
|
desc "Default Task"
|
7
|
-
task :default => [
|
25
|
+
task :default => [:spec, :cucumber ]
|
26
|
+
|
27
|
+
spec = eval(File.read('spree_store_credits.gemspec'))
|
8
28
|
|
9
|
-
|
10
|
-
|
29
|
+
Gem::PackageTask.new(spec) do |p|
|
30
|
+
p.gem_spec = spec
|
31
|
+
end
|
11
32
|
|
12
|
-
|
13
|
-
|
14
|
-
|
33
|
+
desc "Release to gemcutter"
|
34
|
+
task :release => :package do
|
35
|
+
require 'rake/gemcutter'
|
36
|
+
Rake::Gemcutter::Tasks.new(spec).define
|
37
|
+
Rake::Task['gem:push'].invoke
|
15
38
|
end
|
16
39
|
|
40
|
+
desc "Default Task"
|
41
|
+
task :default => [ :spec ]
|
42
|
+
|
17
43
|
desc "Regenerates a rails 3 app for testing"
|
18
44
|
task :test_app do
|
19
45
|
SPREE_PATH = ENV['SPREE_PATH']
|
20
46
|
raise "SPREE_PATH should be specified" unless SPREE_PATH
|
21
47
|
require File.join(SPREE_PATH, 'lib/generators/spree/test_app_generator')
|
22
|
-
|
23
|
-
|
24
|
-
append_file 'Gemfile' do
|
25
|
-
<<-gems
|
26
|
-
gem 'spree_core', :path => '#{File.join(SPREE_PATH, 'core')}'
|
27
|
-
gem 'spree_auth', :path => '#{File.join(SPREE_PATH, 'auth')}'
|
28
|
-
gem 'spree_store_credits', :path => '#{File.dirname(__FILE__)}'
|
29
|
-
gems
|
30
|
-
end
|
31
|
-
end
|
48
|
+
|
49
|
+
class SpreeStoreCreditTestAppGenerator < Spree::Generators::TestAppGenerator
|
32
50
|
|
33
51
|
def install_gems
|
34
52
|
inside "test_app" do
|
35
|
-
run 'rake spree_core:install'
|
36
|
-
run 'rake spree_auth:install'
|
53
|
+
run 'bundle exec rake spree_core:install'
|
54
|
+
run 'bundle exec rake spree_auth:install'
|
55
|
+
run 'bundle exec rake spree_promo:install'
|
56
|
+
generate 'spree_store_credits:install -f'
|
37
57
|
end
|
38
|
-
|
39
|
-
generate 'spree_store_credits:install -f'
|
40
58
|
end
|
41
59
|
|
42
60
|
def migrate_db
|
43
61
|
run_migrations
|
44
62
|
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
def full_path_for_local_gems
|
66
|
+
<<-gems
|
67
|
+
gem 'spree_core', :path => \'#{File.join(SPREE_PATH, "core")}\'
|
68
|
+
gem 'spree_auth', :path => \'#{File.join(SPREE_PATH, "auth")}\'
|
69
|
+
gem 'spree_promo', :path => \'#{File.join(SPREE_PATH, "promo")}\'
|
70
|
+
gem 'spree_store_credits', :path => \'#{File.expand_path('..', __FILE__)}\'
|
71
|
+
gems
|
72
|
+
end
|
73
|
+
|
45
74
|
end
|
46
|
-
|
75
|
+
SpreeStoreCreditTestAppGenerator.start
|
47
76
|
end
|
48
77
|
|
49
78
|
namespace :test_app do
|
50
79
|
desc 'Rebuild test and cucumber databases'
|
51
80
|
task :rebuild_dbs do
|
52
|
-
system("cd spec/test_app && rake db:drop db:migrate RAILS_ENV=test && rake db:drop db:migrate RAILS_ENV=cucumber")
|
81
|
+
system("cd spec/test_app && bundle exec rake db:drop db:migrate RAILS_ENV=test && bundle exec rake db:drop db:migrate RAILS_ENV=cucumber")
|
53
82
|
end
|
54
83
|
end
|
data/Versionfile
ADDED
@@ -1,27 +1,21 @@
|
|
1
|
-
class Admin::StoreCreditsController < Admin::
|
2
|
-
resource_controller
|
1
|
+
class Admin::StoreCreditsController < Admin::ResourceController
|
3
2
|
before_filter :check_amounts, :only => [:edit, :update]
|
4
|
-
|
5
|
-
|
6
|
-
create.response do |wants|
|
7
|
-
wants.html { redirect_to collection_url }
|
8
|
-
end
|
3
|
+
prepend_before_filter :set_remaining_amount, :only => [:create, :update]
|
9
4
|
|
10
|
-
update.response do |wants|
|
11
|
-
wants.html { redirect_to collection_url }
|
12
|
-
end
|
13
|
-
|
14
|
-
destroy.success.wants.js { render_js_for_destroy }
|
15
|
-
|
16
5
|
private
|
17
6
|
def check_amounts
|
18
|
-
if (
|
7
|
+
if (@store_credit.remaining_amount < @store_credit.amount)
|
19
8
|
flash[:error] = "Can't be edit, b/c already was used."
|
20
|
-
redirect_to
|
9
|
+
redirect_to admin_store_credits_path
|
21
10
|
end
|
22
11
|
end
|
23
|
-
|
12
|
+
|
24
13
|
def set_remaining_amount
|
25
14
|
params[:store_credit][:remaining_amount] = params[:store_credit][:amount]
|
26
15
|
end
|
16
|
+
|
17
|
+
def collection
|
18
|
+
super.page(params[:page])
|
19
|
+
end
|
20
|
+
|
27
21
|
end
|
@@ -4,6 +4,6 @@ UsersController.class_eval do
|
|
4
4
|
private
|
5
5
|
|
6
6
|
def find_orders_with_store_credit
|
7
|
-
@orders_with_store_credit =
|
7
|
+
@orders_with_store_credit = @user.orders.joins(:adjustments).where(:adjustments => {:source_type => 'StoreCredit'})
|
8
8
|
end
|
9
9
|
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
Order.class_eval do
|
2
2
|
attr_accessible :store_credit_amount, :remove_store_credits
|
3
3
|
attr_accessor :store_credit_amount, :remove_store_credits
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
# the check for user? below is to ensure we don't break the
|
5
|
+
# admin app when creating a new order from the admin console
|
6
|
+
# In that case, we create an order before assigning a user
|
7
|
+
before_save :process_store_credit, :if => "self.user.present? && @store_credit_amount"
|
8
|
+
before_save :remove_store_credits, :if => "self.user.present?"
|
9
|
+
after_save :ensure_sufficient_credit, :if => "self.user.present?"
|
7
10
|
|
8
11
|
has_many :store_credits, :class_name => 'StoreCreditAdjustment', :conditions => "source_type='StoreCredit'"
|
9
12
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class Promotion::Actions::GiveStoreCredit < PromotionAction
|
2
|
+
preference :amount, :decimal, :default => 0.0
|
3
|
+
|
4
|
+
def perform(options = {})
|
5
|
+
if user = options[:user]
|
6
|
+
user.store_credits.create(:amount => preferred_amount, :remaining_amount => preferred_amount, :reason => "Promotion: #{promotion.name}")
|
7
|
+
else
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Deface::Override.new(
|
2
|
+
:virtual_path => "admin/configurations/index",
|
3
|
+
:name => "store_credits_admin_configurations_menu",
|
4
|
+
:insert_bottom => "[data-hook='admin_configurations_menu']",
|
5
|
+
:text => "<%= configurations_menu_item(I18n.t('store_credits'), admin_store_credits_url, I18n.t('manage_store_credits')) %>",
|
6
|
+
:disabled => false)
|
7
|
+
|
8
|
+
Deface::Override.new(
|
9
|
+
:virtual_path => "admin/users/index",
|
10
|
+
:name => "store_credits_admin_users_index_row_actions",
|
11
|
+
:insert_bottom => "[data-hook='admin_users_index_row_actions']",
|
12
|
+
:text => " <%= link_to_with_icon('add', t('add_store_credit'), new_admin_user_store_credit_url(user)) %>",
|
13
|
+
:disabled => false)
|
14
|
+
|
15
|
+
Deface::Override.new(
|
16
|
+
:virtual_path => "checkout/_payment",
|
17
|
+
:name => "store_credits_checkout_payment_step",
|
18
|
+
:insert_after => "[data-hook='checkout_payment_step']",
|
19
|
+
:partial => "checkout/store_credits",
|
20
|
+
:disabled => false)
|
21
|
+
|
22
|
+
Deface::Override.new(
|
23
|
+
:virtual_path => "users/show",
|
24
|
+
:name => "store_credits_account_my_orders",
|
25
|
+
:insert_after => "[data-hook='account_my_orders']",
|
26
|
+
:partial => "users/store_credits",
|
27
|
+
:disabled => false)
|
28
|
+
|
29
|
+
Deface::Override.new(
|
30
|
+
:virtual_path => "shared/_order_details",
|
31
|
+
:name => "store_credits_order_details_adjustments",
|
32
|
+
:insert_after => "[data-hook='order_details_adjustments']",
|
33
|
+
:text => "
|
34
|
+
<% if @order.store_credits.present? && !@order.completed? %>
|
35
|
+
<tr><td colspan=\"4\">
|
36
|
+
<%= check_box :order, :remove_store_credits %> <%= label :order, :remove_store_credits %>
|
37
|
+
</td></tr>
|
38
|
+
<% end %>",
|
39
|
+
:disabled => false)
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<tbody>
|
15
15
|
<% @store_credits.each do |store_credit|%>
|
16
16
|
<tr id="<%= dom_id store_credit %>">
|
17
|
-
<td><%= link_to store_credit.user.email, admin_user_url(store_credit.user) %></td>
|
17
|
+
<td><%= link_to store_credit.user.email, admin_user_url(store_credit.user) if store_credit.user.present? %></td>
|
18
18
|
<td><%= number_to_currency store_credit.amount %></td>
|
19
19
|
<td><%= number_to_currency store_credit.remaining_amount %></td>
|
20
20
|
<td><%= store_credit.reason %></td>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<%= link_to_edit store_credit %>
|
25
25
|
<% else %>
|
26
26
|
<%= t(:was_partially_used) %>
|
27
|
-
<% end %>
|
27
|
+
<% end %>
|
28
28
|
<%= link_to_delete store_credit %>
|
29
29
|
<% else %>
|
30
30
|
<%= t(:was_fully_used) %>
|
@@ -37,3 +37,4 @@
|
|
37
37
|
</tbody>
|
38
38
|
</table>
|
39
39
|
|
40
|
+
<%= paginate @store_credits %>
|
data/lib/spree_store_credits.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spree_core'
|
2
|
-
require '
|
2
|
+
require 'spree_promo'
|
3
3
|
|
4
4
|
module SpreeStoreCredits
|
5
5
|
class Engine < Rails::Engine
|
@@ -8,8 +8,13 @@ module SpreeStoreCredits
|
|
8
8
|
Rails.env == "production" ? require(c) : load(c)
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
11
12
|
config.to_prepare &method(:activate).to_proc
|
12
13
|
config.autoload_paths += %W(#{config.root}/lib)
|
14
|
+
|
15
|
+
initializer "spree.promo.register.promotions.actions" do |app|
|
16
|
+
app.config.spree.promotions.actions.concat([Promotion::Actions::GiveStoreCredit])
|
17
|
+
end
|
13
18
|
end
|
14
19
|
end
|
15
20
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# this :promotion factory is defined in spree_promo, but I can't reuse it (i believe) b/c it is in spec/factories vs. lib/....
|
2
|
+
Factory.define :promotion, :class => Promotion, :parent => :activator do |f|
|
3
|
+
f.name 'Promo'
|
4
|
+
end
|
5
|
+
|
6
|
+
Factory.define :give_store_credit_action, :class => Promotion::Actions::GiveStoreCredit do |f|
|
7
|
+
f.association :promotion
|
8
|
+
|
9
|
+
f.after_create do |action|
|
10
|
+
action.set_preference(:amount, 1234.56)
|
11
|
+
action.save!
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Factory.define :promotion_for_store_credits, :parent => :promotion do |f|
|
16
|
+
f.event_name "spree.user.signup"
|
17
|
+
f.after_create do |p|
|
18
|
+
p.promotion_actions [Factory(:give_store_credit_action, :promotion => p)]
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Promotion for Store Credits" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
DatabaseCleaner.strategy = :truncation
|
7
|
+
DatabaseCleaner.clean
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
DatabaseCleaner.start
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:each) do
|
15
|
+
DatabaseCleaner.clean
|
16
|
+
end
|
17
|
+
|
18
|
+
context "#new user" do
|
19
|
+
it "should give me a store credit when I register" do
|
20
|
+
|
21
|
+
Factory(:promotion_for_store_credits, :event_name => "spree.user.signup")
|
22
|
+
|
23
|
+
new_user = Factory.build(:user)
|
24
|
+
|
25
|
+
post user_registration_path, {"commit"=>"Create", "user"=> {"password" => new_user.password, "email" => new_user.email }}
|
26
|
+
new_user = User.find_by_email new_user.email
|
27
|
+
new_user.store_credits.size.should == 1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
-
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
1
|
# from the project root directory.
|
3
2
|
ENV["RAILS_ENV"] ||= 'test'
|
4
3
|
require File.expand_path("../test_app/config/environment", __FILE__)
|
5
4
|
require 'rspec/rails'
|
6
5
|
|
6
|
+
require 'database_cleaner'
|
7
|
+
|
7
8
|
# Requires supporting files with custom matchers and macros, etc,
|
8
9
|
# in ./support/ and its subdirectories.
|
9
10
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
11
|
|
12
|
+
require 'spree_core/testing_support/factories'
|
13
|
+
|
14
|
+
# include local factories
|
15
|
+
Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each { |f| require File.expand_path(f)}
|
16
|
+
|
11
17
|
RSpec.configure do |config|
|
12
18
|
# == Mock Framework
|
13
19
|
#
|
@@ -23,5 +29,20 @@ RSpec.configure do |config|
|
|
23
29
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
30
|
# examples within a transaction, comment the following line or assign false
|
25
31
|
# instead of true.
|
26
|
-
config.use_transactional_fixtures =
|
32
|
+
config.use_transactional_fixtures = false
|
33
|
+
end
|
34
|
+
|
35
|
+
# https://groups.google.com/forum/m/#!msg/ruby-capybara/JI6JrirL9gM/R6YiXj4gi_UJ
|
36
|
+
|
37
|
+
class ActiveRecord::Base
|
38
|
+
mattr_accessor :shared_connection
|
39
|
+
@@shared_connection = nil
|
40
|
+
|
41
|
+
def self.connection
|
42
|
+
@@shared_connection || retrieve_connection
|
43
|
+
end
|
27
44
|
end
|
45
|
+
|
46
|
+
# Forces all threads to share the same connection. This works on
|
47
|
+
# Capybara because it starts the web server in a thread.
|
48
|
+
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
data/spree_store_credits.gemspec
CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
|
6
6
|
s.name = 'spree_store_credits'
|
7
|
-
s.version = '1.0.
|
7
|
+
s.version = '1.0.2'
|
8
8
|
s.authors = ["Roman Smirnov", "Brian Quinn"]
|
9
9
|
s.email = 'roman@railsdog.com'
|
10
10
|
s.homepage = 'http://github.com/spree/spree-store-credits'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Roman Smirnov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-04 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -42,17 +42,21 @@ extra_rdoc_files: []
|
|
42
42
|
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
|
+
- Gemfile
|
45
46
|
- LICENSE
|
46
47
|
- README.md
|
47
48
|
- Rakefile
|
48
49
|
- VERSION
|
50
|
+
- Versionfile
|
49
51
|
- app/controllers/admin/store_credits_controller.rb
|
50
52
|
- app/controllers/checkout_controller_decorator.rb
|
51
53
|
- app/controllers/users_controller_decorator.rb
|
52
54
|
- app/models/order_decorator.rb
|
55
|
+
- app/models/promotion/actions/give_store_credit.rb
|
53
56
|
- app/models/store_credit.rb
|
54
57
|
- app/models/store_credit_adjustment.rb
|
55
58
|
- app/models/user_decorator.rb
|
59
|
+
- app/overrides/views_decorator.rb
|
56
60
|
- app/views/admin/store_credits/_form.html.erb
|
57
61
|
- app/views/admin/store_credits/edit.html.erb
|
58
62
|
- app/views/admin/store_credits/index.html.erb
|
@@ -66,9 +70,10 @@ files:
|
|
66
70
|
- lib/generators/spree_store_credits/install_generator.rb
|
67
71
|
- lib/generators/templates/db/migrate/20100928140217_create_store_credits.rb
|
68
72
|
- lib/spree_store_credits.rb
|
69
|
-
-
|
73
|
+
- spec/factories/store_credits_factory.rb
|
70
74
|
- spec/models/order_spec.rb
|
71
75
|
- spec/models/user_spec.rb
|
76
|
+
- spec/requests/store_credits_spec.rb
|
72
77
|
- spec/spec_helper.rb
|
73
78
|
- spree_store_credits.gemspec
|
74
79
|
has_rdoc: true
|
@@ -103,5 +108,9 @@ rubygems_version: 1.3.6
|
|
103
108
|
signing_key:
|
104
109
|
specification_version: 3
|
105
110
|
summary: Provides store credits for a Spree store.
|
106
|
-
test_files:
|
107
|
-
|
111
|
+
test_files:
|
112
|
+
- spec/factories/store_credits_factory.rb
|
113
|
+
- spec/models/order_spec.rb
|
114
|
+
- spec/models/user_spec.rb
|
115
|
+
- spec/requests/store_credits_spec.rb
|
116
|
+
- spec/spec_helper.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
class SpreeStaticContentHooks < Spree::ThemeSupport::HookListener
|
2
|
-
insert_after :admin_configurations_menu do
|
3
|
-
"<%= configurations_menu_item(I18n.t('store_credits'), admin_store_credits_url, I18n.t('manage_store_credits')) %>"
|
4
|
-
end
|
5
|
-
|
6
|
-
|
7
|
-
insert_after :admin_users_index_row_actions do
|
8
|
-
%(
|
9
|
-
<%= link_to_with_icon('add', t('add_store_credit'), new_admin_user_store_credit_url(user)) %>
|
10
|
-
)
|
11
|
-
end
|
12
|
-
|
13
|
-
insert_after :checkout_payment_step, :partial => 'checkout/store_credits'
|
14
|
-
|
15
|
-
insert_after :account_my_orders, :partial => 'users/store_credits'
|
16
|
-
|
17
|
-
insert_after :order_details_adjustments do
|
18
|
-
%(
|
19
|
-
<% if @order.store_credits.present? && !@order.completed? %>
|
20
|
-
<tr><td colspan="4">
|
21
|
-
<%= check_box :order, :remove_store_credits %> <%= label :order, :remove_store_credits %>
|
22
|
-
</td></tr>
|
23
|
-
<% end %>
|
24
|
-
)
|
25
|
-
end
|
26
|
-
end
|