spree_promo 0.50.4 → 0.60.0.RC1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/admin/promotion_rules_controller.rb +22 -23
- data/app/controllers/admin/promotions_controller.rb +12 -9
- data/app/controllers/orders_controller_decorator.rb +10 -0
- data/app/views/admin/promotion_rules/create.js.erb +5 -5
- data/app/views/admin/promotion_rules/destroy.js.erb +1 -1
- data/config/locales/en.yml +2 -1
- metadata +28 -19
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
class Admin::PromotionRulesController < Admin::BaseController
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
def create
|
|
3
|
+
@promotion = Promotion.find(params[:promotion_id])
|
|
4
|
+
@promotion_rule = params[:promotion_rule][:type].constantize.new(params[:promotion_rule])
|
|
5
|
+
@promotion_rule.promotion = @promotion
|
|
6
|
+
if @promotion_rule.save
|
|
7
|
+
flash[:notice] = I18n.t(:successfully_created, :resource => I18n.t(:promotion_rule))
|
|
8
|
+
end
|
|
9
|
+
respond_to do |format|
|
|
10
|
+
format.html { redirect_to edit_admin_promotion_path(@promotion)}
|
|
11
|
+
format.js { render :layout => false }
|
|
12
|
+
end
|
|
12
13
|
end
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@object = params[:promotion_rule][:type].constantize.new(object_params)
|
|
20
|
-
@object.promotion = parent_object
|
|
21
|
-
else
|
|
22
|
-
@object = end_of_association_chain.build(object_params)
|
|
23
|
-
end
|
|
24
|
-
@object
|
|
14
|
+
|
|
15
|
+
def destroy
|
|
16
|
+
@promotion = Promotion.find(params[:promotion_id])
|
|
17
|
+
@promotion_rule = @promotion.promotion_rules.find(params[:id])
|
|
18
|
+
if @promotion_rule.destroy
|
|
19
|
+
flash[:notice] = I18n.t(:successfully_removed, :resource => I18n.t(:promotion_rule))
|
|
25
20
|
end
|
|
26
|
-
|
|
21
|
+
respond_to do |format|
|
|
22
|
+
format.html { redirect_to edit_admin_promotion_path(@promotion)}
|
|
23
|
+
format.js { render :layout => false }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
27
26
|
end
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
class Admin::PromotionsController < Admin::
|
|
2
|
-
resource_controller
|
|
1
|
+
class Admin::PromotionsController < Admin::ResourceController
|
|
3
2
|
before_filter :load_data
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
create.wants.html { redirect_to edit_object_url }
|
|
7
|
-
destroy.success.wants.js { render_js_for_destroy }
|
|
4
|
+
protected
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
def build_resource
|
|
7
|
+
@promotion = Promotion.new(params[:promotion])
|
|
8
|
+
if params[:promotion] && params[:promotion][:calculator_type]
|
|
9
|
+
@promotion.calculator = params[:promotion][:calculator_type].constantize.new
|
|
10
|
+
end
|
|
11
|
+
@promotion
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def location_after_save
|
|
15
|
+
edit_admin_promotion_url(@promotion)
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
def load_data
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
jQuery('#rules').append('<%= escape_javascript( render(:partial => 'admin/promotions/promotion_rule', :object =>
|
|
2
|
-
jQuery('#<%= dom_id
|
|
3
|
-
jQuery('#<%= dom_id
|
|
1
|
+
jQuery('#rules').append('<%= escape_javascript( render(:partial => 'admin/promotions/promotion_rule', :object => @promotion_rule) ) %>');
|
|
2
|
+
jQuery('#<%= dom_id @promotion_rule %>').hide();
|
|
3
|
+
jQuery('#<%= dom_id @promotion_rule %>').fadeIn();
|
|
4
4
|
initProductRuleSourceField();
|
|
5
|
-
jQuery('#<%= dom_id
|
|
6
|
-
jQuery('#<%= dom_id
|
|
5
|
+
jQuery('#<%= dom_id @promotion_rule %> .tokeninput.products').productPicker();
|
|
6
|
+
jQuery('#<%= dom_id @promotion_rule %> .tokeninput.users').userPicker();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
jQuery('#<%= dom_id
|
|
1
|
+
jQuery('#<%= dom_id @promotion_rule %>').fadeOut().remove();
|
data/config/locales/en.yml
CHANGED
|
@@ -18,6 +18,7 @@ en:
|
|
|
18
18
|
may_be_combined_with_other_promotions: May be combined with other promotions
|
|
19
19
|
new_promotion: New Promotion
|
|
20
20
|
no_rules_added: No rules added
|
|
21
|
+
promotion: Promotion
|
|
21
22
|
promotions: Promotions
|
|
22
23
|
promotion_form:
|
|
23
24
|
match_policies:
|
|
@@ -39,7 +40,7 @@ en:
|
|
|
39
40
|
description: Must be the customer's first order
|
|
40
41
|
product_rule:
|
|
41
42
|
choose_products: Choose products
|
|
42
|
-
label: "Order must contain {
|
|
43
|
+
label: "Order must contain %{select} of these products"
|
|
43
44
|
match_any: at least one
|
|
44
45
|
match_all: all
|
|
45
46
|
product_source:
|
metadata
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_promo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 11094359
|
|
5
|
+
prerelease: 7
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
8
|
+
- 60
|
|
9
|
+
- 0
|
|
10
|
+
- RC
|
|
11
|
+
- 1
|
|
12
|
+
version: 0.60.0.RC1
|
|
11
13
|
platform: ruby
|
|
12
14
|
authors:
|
|
13
15
|
- David North
|
|
@@ -15,24 +17,27 @@ autorequire:
|
|
|
15
17
|
bindir: bin
|
|
16
18
|
cert_chain: []
|
|
17
19
|
|
|
18
|
-
date: 2011-
|
|
20
|
+
date: 2011-05-03 00:00:00 -04:00
|
|
21
|
+
default_executable:
|
|
19
22
|
dependencies:
|
|
20
23
|
- !ruby/object:Gem::Dependency
|
|
21
|
-
|
|
24
|
+
name: spree_core
|
|
25
|
+
prerelease: false
|
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
22
27
|
none: false
|
|
23
28
|
requirements:
|
|
24
29
|
- - "="
|
|
25
30
|
- !ruby/object:Gem::Version
|
|
26
|
-
hash:
|
|
31
|
+
hash: 11094359
|
|
27
32
|
segments:
|
|
28
33
|
- 0
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
- 60
|
|
35
|
+
- 0
|
|
36
|
+
- RC
|
|
37
|
+
- 1
|
|
38
|
+
version: 0.60.0.RC1
|
|
33
39
|
type: :runtime
|
|
34
|
-
|
|
35
|
-
name: spree_core
|
|
40
|
+
version_requirements: *id001
|
|
36
41
|
description: Required dependancy for Spree
|
|
37
42
|
email: david@railsdog.com
|
|
38
43
|
executables: []
|
|
@@ -44,6 +49,7 @@ extra_rdoc_files: []
|
|
|
44
49
|
files:
|
|
45
50
|
- app/controllers/admin/promotion_rules_controller.rb
|
|
46
51
|
- app/controllers/admin/promotions_controller.rb
|
|
52
|
+
- app/controllers/orders_controller_decorator.rb
|
|
47
53
|
- app/models/calculator/free_shipping.rb
|
|
48
54
|
- app/models/promotion/rules/first_order.rb
|
|
49
55
|
- app/models/promotion/rules/item_total.rb
|
|
@@ -83,6 +89,7 @@ files:
|
|
|
83
89
|
- db/migrate/20100923095305_update_calculable_type_for_promotions.rb
|
|
84
90
|
- public/javascripts/admin/promotions.js
|
|
85
91
|
- public/stylesheets/admin/promotions.css
|
|
92
|
+
has_rdoc: true
|
|
86
93
|
homepage: http://spreecommerce.com
|
|
87
94
|
licenses: []
|
|
88
95
|
|
|
@@ -105,16 +112,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
105
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
113
|
none: false
|
|
107
114
|
requirements:
|
|
108
|
-
- - "
|
|
115
|
+
- - ">"
|
|
109
116
|
- !ruby/object:Gem::Version
|
|
110
|
-
hash:
|
|
117
|
+
hash: 25
|
|
111
118
|
segments:
|
|
112
|
-
-
|
|
113
|
-
|
|
119
|
+
- 1
|
|
120
|
+
- 3
|
|
121
|
+
- 1
|
|
122
|
+
version: 1.3.1
|
|
114
123
|
requirements:
|
|
115
124
|
- none
|
|
116
125
|
rubyforge_project: spree_promo
|
|
117
|
-
rubygems_version: 1.
|
|
126
|
+
rubygems_version: 1.4.2
|
|
118
127
|
signing_key:
|
|
119
128
|
specification_version: 3
|
|
120
129
|
summary: Promotion functionality for use with Spree.
|