spree_promo 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,29 +9,31 @@ function cleanUsers(data) {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
$(document).ready(function() {
|
12
|
-
$('
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
ajax: {
|
21
|
-
url: Spree.routes.user_search,
|
22
|
-
datatype: 'json',
|
23
|
-
data: function(term, page) {
|
24
|
-
return { q: term }
|
12
|
+
if ($('user_picker').length > 0) {
|
13
|
+
$('.user_picker').select2({
|
14
|
+
minimumInputLength: 1,
|
15
|
+
multiple: true,
|
16
|
+
initSelection: function(element, callback) {
|
17
|
+
$.get(Spree.routes.user_search, { ids: element.val() }, function(data) {
|
18
|
+
callback(cleanUsers(data))
|
19
|
+
})
|
25
20
|
},
|
26
|
-
|
27
|
-
|
21
|
+
ajax: {
|
22
|
+
url: Spree.routes.user_search,
|
23
|
+
datatype: 'json',
|
24
|
+
data: function(term, page) {
|
25
|
+
return { q: term }
|
26
|
+
},
|
27
|
+
results: function(data, page) {
|
28
|
+
return { results: cleanUsers(data) }
|
29
|
+
}
|
30
|
+
},
|
31
|
+
formatResult: function(user) {
|
32
|
+
return user.email;
|
33
|
+
},
|
34
|
+
formatSelection: function(user) {
|
35
|
+
return user.email;
|
28
36
|
}
|
29
|
-
}
|
30
|
-
|
31
|
-
return user.email;
|
32
|
-
},
|
33
|
-
formatSelection: function(user) {
|
34
|
-
return user.email;
|
35
|
-
}
|
36
|
-
});
|
37
|
+
});
|
38
|
+
}
|
37
39
|
})
|
@@ -4,7 +4,17 @@ module Spree
|
|
4
4
|
class FirstOrder < PromotionRule
|
5
5
|
def eligible?(order, options = {})
|
6
6
|
user = order.try(:user) || options[:user]
|
7
|
-
|
7
|
+
if user
|
8
|
+
return orders_by_email(user.email) == 0
|
9
|
+
elsif order.email
|
10
|
+
return orders_by_email(order.email) == 0
|
11
|
+
end
|
12
|
+
|
13
|
+
return false
|
14
|
+
end
|
15
|
+
|
16
|
+
def orders_by_email(email)
|
17
|
+
Spree::Order.where(:email => email).count
|
8
18
|
end
|
9
19
|
end
|
10
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_promo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,19 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- - =
|
19
|
+
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.2.
|
21
|
+
version: 1.2.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.2.3
|
25
30
|
description: Required dependency for Spree
|
26
31
|
email: david@spreecommerce.com
|
27
32
|
executables: []
|
@@ -107,7 +112,8 @@ files:
|
|
107
112
|
- db/migrate/20120119024708_create_spree_pending_promotions.rb
|
108
113
|
- db/migrate/20120119024721_content_visited_event.rb
|
109
114
|
homepage: http://spreecommerce.com
|
110
|
-
licenses:
|
115
|
+
licenses:
|
116
|
+
- BSD-3
|
111
117
|
post_install_message:
|
112
118
|
rdoc_options: []
|
113
119
|
require_paths:
|
@@ -126,11 +132,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
132
|
version: '0'
|
127
133
|
segments:
|
128
134
|
- 0
|
129
|
-
hash:
|
135
|
+
hash: 3116838314541820160
|
130
136
|
requirements:
|
131
137
|
- none
|
132
138
|
rubyforge_project:
|
133
|
-
rubygems_version: 1.8.
|
139
|
+
rubygems_version: 1.8.23
|
134
140
|
signing_key:
|
135
141
|
specification_version: 3
|
136
142
|
summary: Promotion functionality for use with Spree.
|