dup_spree_promo 1.3.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +26 -0
- data/app/assets/javascripts/admin/promotions.js +98 -0
- data/app/assets/javascripts/admin/spree_promo.js +32 -0
- data/app/assets/javascripts/store/spree_promo.js +1 -0
- data/app/assets/stylesheets/admin/spree_promo.css +3 -0
- data/app/assets/stylesheets/store/spree_promo.css +17 -0
- data/app/controllers/spree/admin/promotion_actions_controller.rb +27 -0
- data/app/controllers/spree/admin/promotion_rules_controller.rb +32 -0
- data/app/controllers/spree/admin/promotions_controller.rb +30 -0
- data/app/controllers/spree/checkout_controller_decorator.rb +30 -0
- data/app/controllers/spree/content_controller_decorator.rb +13 -0
- data/app/controllers/spree/orders_controller_decorator.rb +24 -0
- data/app/controllers/spree/store_controller_decorator.rb +55 -0
- data/app/helpers/spree/promotion_rules_helper.rb +13 -0
- data/app/models/spree/adjustment_decorator.rb +7 -0
- data/app/models/spree/calculator/free_shipping.rb +18 -0
- data/app/models/spree/calculator/percent_per_item.rb +48 -0
- data/app/models/spree/order_decorator.rb +19 -0
- data/app/models/spree/order_updater_decorator.rb +14 -0
- data/app/models/spree/payment_decorator.rb +5 -0
- data/app/models/spree/product_decorator.rb +8 -0
- data/app/models/spree/promotion.rb +105 -0
- data/app/models/spree/promotion/actions/create_adjustment.rb +48 -0
- data/app/models/spree/promotion/actions/create_line_items.rb +23 -0
- data/app/models/spree/promotion/rules/first_order.rb +12 -0
- data/app/models/spree/promotion/rules/item_total.rb +21 -0
- data/app/models/spree/promotion/rules/product.rb +46 -0
- data/app/models/spree/promotion/rules/user.rb +24 -0
- data/app/models/spree/promotion/rules/user_logged_in.rb +20 -0
- data/app/models/spree/promotion_action.rb +19 -0
- data/app/models/spree/promotion_action_line_item.rb +8 -0
- data/app/models/spree/promotion_rule.rb +25 -0
- data/app/overrides/promo_admin_tabs.rb +6 -0
- data/app/overrides/promo_cart_coupon_code_field.rb +6 -0
- data/app/overrides/promo_coupon_code_field.rb +6 -0
- data/app/overrides/promo_product_properties.rb +6 -0
- data/app/views/spree/admin/promotion_actions/create.js.erb +12 -0
- data/app/views/spree/admin/promotion_actions/destroy.js.erb +1 -0
- data/app/views/spree/admin/promotion_rules/create.js.erb +13 -0
- data/app/views/spree/admin/promotion_rules/destroy.js.erb +3 -0
- data/app/views/spree/admin/promotions/_actions.html.erb +32 -0
- data/app/views/spree/admin/promotions/_form.html.erb +56 -0
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +11 -0
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +9 -0
- data/app/views/spree/admin/promotions/_rules.html.erb +45 -0
- data/app/views/spree/admin/promotions/_tab.html.erb +1 -0
- data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +26 -0
- data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +22 -0
- data/app/views/spree/admin/promotions/edit.html.erb +28 -0
- data/app/views/spree/admin/promotions/index.html.erb +52 -0
- data/app/views/spree/admin/promotions/new.html.erb +16 -0
- data/app/views/spree/admin/promotions/rules/_first_order.html.erb +0 -0
- data/app/views/spree/admin/promotions/rules/_item_total.html.erb +6 -0
- data/app/views/spree/admin/promotions/rules/_landing_page.html.erb +5 -0
- data/app/views/spree/admin/promotions/rules/_product.html.erb +9 -0
- data/app/views/spree/admin/promotions/rules/_user.html.erb +4 -0
- data/app/views/spree/admin/promotions/rules/_user_logged_in.html.erb +0 -0
- data/app/views/spree/checkout/_coupon_code_field.html.erb +6 -0
- data/app/views/spree/orders/_coupon_code_field.html.erb +7 -0
- data/app/views/spree/products/_promotions.html.erb +23 -0
- data/config/locales/en.yml +98 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20120831092359_spree_promo_one_two.rb +45 -0
- data/lib/spree/promo.rb +9 -0
- data/lib/spree/promo/engine.rb +56 -0
- data/lib/spree/promo/environment.rb +9 -0
- data/lib/spree_promo.rb +1 -0
- metadata +129 -0
@@ -0,0 +1,98 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
activerecord:
|
4
|
+
attributes:
|
5
|
+
spree/promotion:
|
6
|
+
advertise: Advertise
|
7
|
+
code: Code
|
8
|
+
description: Description
|
9
|
+
event_name: Event Name
|
10
|
+
expires_at: Expires At
|
11
|
+
name: Name
|
12
|
+
path: Path
|
13
|
+
starts_at: Starts At
|
14
|
+
usage_limit: Usage Limit
|
15
|
+
add_action_of_type: Add action of type
|
16
|
+
add_rule_of_type: Add rule of type
|
17
|
+
back_to_promotions_list: "Back To Promotions List"
|
18
|
+
coupon: Coupon
|
19
|
+
coupon_code: Coupon code
|
20
|
+
coupon_code_applied: The coupon code was successfully applied to your order.
|
21
|
+
coupon_code_expired: The coupon code is expired
|
22
|
+
coupon_code_already_applied: The coupon code has already been applied to this order
|
23
|
+
coupon_code_better_exists: The previously applied coupon code results in a better deal
|
24
|
+
coupon_code_not_found: The coupon code you entered doesn't exist. Please try again.
|
25
|
+
coupon_code_max_usage: Coupon code usage limit exceeded
|
26
|
+
coupon_code_not_eligible: This coupon code is not eligible for this order
|
27
|
+
editing_promotion: Editing Promotion
|
28
|
+
current_promotion_usage: 'Current Usage: %{count}'
|
29
|
+
events:
|
30
|
+
spree:
|
31
|
+
checkout:
|
32
|
+
coupon_code_added: Coupon code added
|
33
|
+
content:
|
34
|
+
visited: Visit static content page
|
35
|
+
expiry: Expiry
|
36
|
+
free_shipping: Free Shipping
|
37
|
+
item_total_rule:
|
38
|
+
operators:
|
39
|
+
gt: greater than
|
40
|
+
gte: greater than or equal to
|
41
|
+
landing_page_rule:
|
42
|
+
path: Path
|
43
|
+
new_promotion: New Promotion
|
44
|
+
no_rules_added: No rules added
|
45
|
+
percent_per_item: Percent Per Item
|
46
|
+
product_rule:
|
47
|
+
choose_products: Choose products
|
48
|
+
label: "Order must contain %{select} of these products"
|
49
|
+
match_any: at least one
|
50
|
+
match_all: all
|
51
|
+
product_source:
|
52
|
+
group: From product group
|
53
|
+
manual: Manually choose
|
54
|
+
promotion: Promotion
|
55
|
+
promotion_action: Promotion Action
|
56
|
+
promotion_actions: Actions
|
57
|
+
promotion_action_types:
|
58
|
+
create_adjustment:
|
59
|
+
name: Create adjustment
|
60
|
+
description: Creates a promotion credit adjustment on the order
|
61
|
+
create_line_items:
|
62
|
+
name: Create line items
|
63
|
+
description: Populates the cart with the specified quantity of variant
|
64
|
+
give_store_credit:
|
65
|
+
name: Give store credit
|
66
|
+
description: Gives the user store credit of the amount specified
|
67
|
+
promotion_form:
|
68
|
+
match_policies:
|
69
|
+
all: Match all of these rules
|
70
|
+
any: Match any of these rules
|
71
|
+
promotions: Promotions
|
72
|
+
promotions_description: Manage offers and coupons with promotions
|
73
|
+
promotion_rule: Promotion Rule
|
74
|
+
promotion_rule_types:
|
75
|
+
first_order:
|
76
|
+
name: First order
|
77
|
+
description: "Must be the customer's first order"
|
78
|
+
item_total:
|
79
|
+
name: Item total
|
80
|
+
description: Order total meets these criteria
|
81
|
+
landing_page:
|
82
|
+
name: Landing Page
|
83
|
+
description: Customer must have visited the specified page
|
84
|
+
product:
|
85
|
+
name: Product(s)
|
86
|
+
description: Order includes specified product(s)
|
87
|
+
user:
|
88
|
+
name: User
|
89
|
+
description: Available only to the specified users
|
90
|
+
user_logged_in:
|
91
|
+
name: User Logged In
|
92
|
+
description: Available only to logged in users
|
93
|
+
rules: Rules
|
94
|
+
spree/order:
|
95
|
+
coupon_code: Coupon Code
|
96
|
+
user_rule:
|
97
|
+
choose_users: Choose users
|
98
|
+
|
data/config/routes.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
class SpreePromoOneTwo < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
# This migration is just a compressed migration for all previous versions of spree_promo
|
4
|
+
return if table_exists?(:spree_products_promotion_rules)
|
5
|
+
|
6
|
+
create_table :spree_products_promotion_rules, :id => false, :force => true do |t|
|
7
|
+
t.references :product
|
8
|
+
t.references :promotion_rule
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :spree_products_promotion_rules, [:product_id], :name => 'index_products_promotion_rules_on_product_id'
|
12
|
+
add_index :spree_products_promotion_rules, [:promotion_rule_id], :name => 'index_products_promotion_rules_on_promotion_rule_id'
|
13
|
+
|
14
|
+
create_table :spree_promotion_action_line_items, :force => true do |t|
|
15
|
+
t.references :promotion_action
|
16
|
+
t.references :variant
|
17
|
+
t.integer :quantity, :default => 1
|
18
|
+
end
|
19
|
+
|
20
|
+
create_table :spree_promotion_actions, :force => true do |t|
|
21
|
+
t.references :activator
|
22
|
+
t.integer :position
|
23
|
+
t.string :type
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table :spree_promotion_rules, :force => true do |t|
|
27
|
+
t.references :activator
|
28
|
+
t.references :user
|
29
|
+
t.references :product_group
|
30
|
+
t.string :type
|
31
|
+
t.timestamps
|
32
|
+
end
|
33
|
+
|
34
|
+
add_index :spree_promotion_rules, [:product_group_id], :name => 'index_promotion_rules_on_product_group_id'
|
35
|
+
add_index :spree_promotion_rules, [:user_id], :name => 'index_promotion_rules_on_user_id'
|
36
|
+
|
37
|
+
create_table :spree_promotion_rules_users, :id => false, :force => true do |t|
|
38
|
+
t.references :user
|
39
|
+
t.references :promotion_rule
|
40
|
+
end
|
41
|
+
|
42
|
+
add_index :spree_promotion_rules_users, [:promotion_rule_id], :name => 'index_promotion_rules_users_on_promotion_rule_id'
|
43
|
+
add_index :spree_promotion_rules_users, [:user_id], :name => 'index_promotion_rules_users_on_user_id'
|
44
|
+
end
|
45
|
+
end
|
data/lib/spree/promo.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Spree
|
2
|
+
module Promo
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
isolate_namespace Spree
|
5
|
+
engine_name 'spree_promo'
|
6
|
+
|
7
|
+
def self.activate
|
8
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../../../app/**/*_decorator*.rb')) do |c|
|
9
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
10
|
+
end
|
11
|
+
|
12
|
+
Spree::StoreController.class_eval do
|
13
|
+
# Include list of visited paths in notification payload hash
|
14
|
+
def default_notification_payload
|
15
|
+
{ :user => try_spree_current_user, :order => current_order, :visited_paths => session[:visited_paths] }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
21
|
+
config.to_prepare &method(:activate).to_proc
|
22
|
+
|
23
|
+
initializer 'spree.promo.environment', :after => 'spree.environment' do |app|
|
24
|
+
app.config.spree.add_class('promotions')
|
25
|
+
app.config.spree.promotions = Spree::Promo::Environment.new
|
26
|
+
end
|
27
|
+
|
28
|
+
initializer 'spree.promo.register.promotion.calculators' do |app|
|
29
|
+
app.config.spree.calculators.add_class('promotion_actions_create_adjustments')
|
30
|
+
app.config.spree.calculators.promotion_actions_create_adjustments = [
|
31
|
+
Spree::Calculator::FlatPercentItemTotal,
|
32
|
+
Spree::Calculator::FlatRate,
|
33
|
+
Spree::Calculator::FlexiRate,
|
34
|
+
Spree::Calculator::PerItem,
|
35
|
+
Spree::Calculator::PercentPerItem,
|
36
|
+
Spree::Calculator::FreeShipping
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
initializer 'spree.promo.register.promotions.rules' do |app|
|
41
|
+
app.config.spree.promotions.rules = [
|
42
|
+
Spree::Promotion::Rules::ItemTotal,
|
43
|
+
Spree::Promotion::Rules::Product,
|
44
|
+
Spree::Promotion::Rules::User,
|
45
|
+
Spree::Promotion::Rules::FirstOrder,
|
46
|
+
Spree::Promotion::Rules::UserLoggedIn]
|
47
|
+
end
|
48
|
+
|
49
|
+
initializer 'spree.promo.register.promotions.actions' do |app|
|
50
|
+
app.config.spree.promotions.actions = [Spree::Promotion::Actions::CreateAdjustment,
|
51
|
+
Spree::Promotion::Actions::CreateLineItems]
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/spree_promo.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'spree/promo'
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dup_spree_promo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0.rc1
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- David North
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: spree_core
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.3.0.rc1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.3.0.rc1
|
30
|
+
description: Required dependency for Spree
|
31
|
+
email: david@spreecommerce.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- LICENSE
|
37
|
+
- app/assets/javascripts/admin/promotions.js
|
38
|
+
- app/assets/javascripts/admin/spree_promo.js
|
39
|
+
- app/assets/javascripts/store/spree_promo.js
|
40
|
+
- app/assets/stylesheets/admin/spree_promo.css
|
41
|
+
- app/assets/stylesheets/store/spree_promo.css
|
42
|
+
- app/controllers/spree/admin/promotion_actions_controller.rb
|
43
|
+
- app/controllers/spree/admin/promotion_rules_controller.rb
|
44
|
+
- app/controllers/spree/admin/promotions_controller.rb
|
45
|
+
- app/controllers/spree/checkout_controller_decorator.rb
|
46
|
+
- app/controllers/spree/content_controller_decorator.rb
|
47
|
+
- app/controllers/spree/orders_controller_decorator.rb
|
48
|
+
- app/controllers/spree/store_controller_decorator.rb
|
49
|
+
- app/helpers/spree/promotion_rules_helper.rb
|
50
|
+
- app/models/spree/adjustment_decorator.rb
|
51
|
+
- app/models/spree/calculator/free_shipping.rb
|
52
|
+
- app/models/spree/calculator/percent_per_item.rb
|
53
|
+
- app/models/spree/order_decorator.rb
|
54
|
+
- app/models/spree/order_updater_decorator.rb
|
55
|
+
- app/models/spree/payment_decorator.rb
|
56
|
+
- app/models/spree/product_decorator.rb
|
57
|
+
- app/models/spree/promotion/actions/create_adjustment.rb
|
58
|
+
- app/models/spree/promotion/actions/create_line_items.rb
|
59
|
+
- app/models/spree/promotion/rules/first_order.rb
|
60
|
+
- app/models/spree/promotion/rules/item_total.rb
|
61
|
+
- app/models/spree/promotion/rules/product.rb
|
62
|
+
- app/models/spree/promotion/rules/user.rb
|
63
|
+
- app/models/spree/promotion/rules/user_logged_in.rb
|
64
|
+
- app/models/spree/promotion.rb
|
65
|
+
- app/models/spree/promotion_action.rb
|
66
|
+
- app/models/spree/promotion_action_line_item.rb
|
67
|
+
- app/models/spree/promotion_rule.rb
|
68
|
+
- app/overrides/promo_admin_tabs.rb
|
69
|
+
- app/overrides/promo_cart_coupon_code_field.rb
|
70
|
+
- app/overrides/promo_coupon_code_field.rb
|
71
|
+
- app/overrides/promo_product_properties.rb
|
72
|
+
- app/views/spree/admin/promotion_actions/create.js.erb
|
73
|
+
- app/views/spree/admin/promotion_actions/destroy.js.erb
|
74
|
+
- app/views/spree/admin/promotion_rules/create.js.erb
|
75
|
+
- app/views/spree/admin/promotion_rules/destroy.js.erb
|
76
|
+
- app/views/spree/admin/promotions/_actions.html.erb
|
77
|
+
- app/views/spree/admin/promotions/_form.html.erb
|
78
|
+
- app/views/spree/admin/promotions/_promotion_action.html.erb
|
79
|
+
- app/views/spree/admin/promotions/_promotion_rule.html.erb
|
80
|
+
- app/views/spree/admin/promotions/_rules.html.erb
|
81
|
+
- app/views/spree/admin/promotions/_tab.html.erb
|
82
|
+
- app/views/spree/admin/promotions/actions/_create_adjustment.html.erb
|
83
|
+
- app/views/spree/admin/promotions/actions/_create_line_items.html.erb
|
84
|
+
- app/views/spree/admin/promotions/edit.html.erb
|
85
|
+
- app/views/spree/admin/promotions/index.html.erb
|
86
|
+
- app/views/spree/admin/promotions/new.html.erb
|
87
|
+
- app/views/spree/admin/promotions/rules/_first_order.html.erb
|
88
|
+
- app/views/spree/admin/promotions/rules/_item_total.html.erb
|
89
|
+
- app/views/spree/admin/promotions/rules/_landing_page.html.erb
|
90
|
+
- app/views/spree/admin/promotions/rules/_product.html.erb
|
91
|
+
- app/views/spree/admin/promotions/rules/_user.html.erb
|
92
|
+
- app/views/spree/admin/promotions/rules/_user_logged_in.html.erb
|
93
|
+
- app/views/spree/checkout/_coupon_code_field.html.erb
|
94
|
+
- app/views/spree/orders/_coupon_code_field.html.erb
|
95
|
+
- app/views/spree/products/_promotions.html.erb
|
96
|
+
- config/locales/en.yml
|
97
|
+
- config/routes.rb
|
98
|
+
- lib/spree/promo/engine.rb
|
99
|
+
- lib/spree/promo/environment.rb
|
100
|
+
- lib/spree/promo.rb
|
101
|
+
- lib/spree_promo.rb
|
102
|
+
- db/migrate/20120831092359_spree_promo_one_two.rb
|
103
|
+
homepage: http://spreecommerce.com
|
104
|
+
licenses:
|
105
|
+
- BSD-3
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 1.8.7
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ! '>'
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 1.3.1
|
122
|
+
requirements:
|
123
|
+
- none
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 1.8.24
|
126
|
+
signing_key:
|
127
|
+
specification_version: 3
|
128
|
+
summary: Promotion functionality for use with Spree.
|
129
|
+
test_files: []
|