spree_favorite_products 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.travis.yml +2 -2
- data/Gemfile +5 -5
- data/Gemfile.lock +168 -117
- data/README.md +18 -13
- data/app/models/spree/favorite.rb +1 -2
- data/app/overrides/add_favorite_products_per_page_configuration.rb +6 -7
- data/app/overrides/add_favorite_products_to_products_tab.rb +4 -9
- data/app/views/spree/admin/favorite_products/index.html.erb +1 -4
- data/app/views/spree/admin/favorite_products/users.html.erb +0 -3
- data/config/locales/en.yml +1 -2
- data/spec/controllers/spree/admin/favorite_products_controller_spec.rb +21 -18
- data/spec/controllers/spree/favorite_products_controller_spec.rb +24 -21
- data/spec/spec_helper.rb +2 -0
- data/spree_favorite_products.gemspec +3 -3
- metadata +4 -5
- data/app/overrides/add_favorite_products_tab.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f11f3c8880f83651bdb24fe9c818946085b4d8d0
|
4
|
+
data.tar.gz: 6628a06e36d08be97e9c6fd6b567b8f9228c1a78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fe013be6540e9c4797b8a71ec3f0c87d8f52841a8cfe18639a380bc4cd7e1b6d99cebd41730d1a16ff3910339d99b516a6213747a4220b56f2add2040803a09
|
7
|
+
data.tar.gz: 0d72ec7b52bb628f6b0e67fc056da1c79b610c90264257f4a129a448f48572dbb1aa87e1e6bcf2ee85ac3fd5119440cbd6def1350de2def05fd884e2f87afe24
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
# Provides basic authentication functionality for testing parts of your engine
|
4
|
-
gem 'spree', '
|
5
|
-
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '
|
4
|
+
gem 'spree', '~> 3.0.0'
|
5
|
+
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
|
6
6
|
gem 'mysql2'
|
7
|
+
gem 'sass-rails', '~> 5.0'
|
7
8
|
|
8
|
-
group :assets do
|
9
|
+
group :assets do
|
9
10
|
gem 'coffee-rails', '4.0.1'
|
10
|
-
gem 'sass-rails'
|
11
11
|
end
|
12
12
|
|
13
13
|
group :test do
|
14
14
|
gem 'rspec-rails', '~> 2.10'
|
15
|
-
gem 'shoulda-matchers', '2.
|
15
|
+
gem 'shoulda-matchers', '2.2.0'
|
16
16
|
gem 'simplecov', :require => false
|
17
17
|
gem 'database_cleaner'
|
18
18
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,75 +1,85 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/spree/spree_auth_devise.git
|
3
|
-
revision:
|
4
|
-
branch:
|
3
|
+
revision: f231fce43686d66fe3e6d65ba8595b4474c49895
|
4
|
+
branch: 3-0-stable
|
5
5
|
specs:
|
6
|
-
spree_auth_devise (
|
7
|
-
devise (~> 3.
|
6
|
+
spree_auth_devise (3.0.0)
|
7
|
+
devise (~> 3.4.1)
|
8
8
|
devise-encryptable (= 0.1.2)
|
9
9
|
json
|
10
10
|
multi_json
|
11
|
-
spree_core (~>
|
11
|
+
spree_core (~> 3.0.0)
|
12
12
|
|
13
13
|
PATH
|
14
14
|
remote: .
|
15
15
|
specs:
|
16
|
-
spree_favorite_products (2.3
|
17
|
-
spree_core (~>
|
16
|
+
spree_favorite_products (2.2.3)
|
17
|
+
spree_core (~> 3.0.0)
|
18
18
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
-
actionmailer (4.
|
23
|
-
actionpack (= 4.
|
24
|
-
actionview (= 4.
|
22
|
+
actionmailer (4.2.5)
|
23
|
+
actionpack (= 4.2.5)
|
24
|
+
actionview (= 4.2.5)
|
25
|
+
activejob (= 4.2.5)
|
25
26
|
mail (~> 2.5, >= 2.5.4)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
28
|
+
actionpack (4.2.5)
|
29
|
+
actionview (= 4.2.5)
|
30
|
+
activesupport (= 4.2.5)
|
31
|
+
rack (~> 1.6)
|
30
32
|
rack-test (~> 0.6.2)
|
31
|
-
|
32
|
-
|
33
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
35
|
+
actionview (4.2.5)
|
36
|
+
activesupport (= 4.2.5)
|
33
37
|
builder (~> 3.1)
|
34
38
|
erubis (~> 2.7.0)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
40
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
41
|
+
activejob (4.2.5)
|
42
|
+
activesupport (= 4.2.5)
|
43
|
+
globalid (>= 0.3.0)
|
44
|
+
activemerchant (1.47.0)
|
45
|
+
activesupport (>= 3.2.14, < 5.0.0)
|
41
46
|
builder (>= 2.1.2, < 4.0.0)
|
42
|
-
i18n (
|
43
|
-
json (~> 1.7)
|
44
|
-
money (< 7.0.0)
|
47
|
+
i18n (>= 0.6.9)
|
45
48
|
nokogiri (~> 1.4)
|
46
|
-
activemodel (4.
|
47
|
-
activesupport (= 4.
|
49
|
+
activemodel (4.2.5)
|
50
|
+
activesupport (= 4.2.5)
|
48
51
|
builder (~> 3.1)
|
49
|
-
activerecord (4.
|
50
|
-
activemodel (= 4.
|
51
|
-
activesupport (= 4.
|
52
|
-
arel (~>
|
53
|
-
activesupport (4.
|
54
|
-
i18n (~> 0.
|
52
|
+
activerecord (4.2.5)
|
53
|
+
activemodel (= 4.2.5)
|
54
|
+
activesupport (= 4.2.5)
|
55
|
+
arel (~> 6.0)
|
56
|
+
activesupport (4.2.5)
|
57
|
+
i18n (~> 0.7)
|
55
58
|
json (~> 1.7, >= 1.7.7)
|
56
59
|
minitest (~> 5.1)
|
57
|
-
thread_safe (~> 0.
|
60
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
58
61
|
tzinfo (~> 1.1)
|
59
|
-
acts_as_list (0.
|
62
|
+
acts_as_list (0.7.2)
|
60
63
|
activerecord (>= 3.0)
|
61
|
-
|
64
|
+
addressable (2.3.8)
|
65
|
+
arel (6.0.3)
|
66
|
+
autoprefixer-rails (6.1.1)
|
67
|
+
execjs
|
68
|
+
json
|
62
69
|
awesome_nested_set (3.0.2)
|
63
70
|
activerecord (>= 4.0.0, < 5)
|
64
|
-
aws-sdk (1.27.0)
|
65
|
-
json (~> 1.4)
|
66
|
-
nokogiri (>= 1.4.4)
|
67
|
-
uuidtools (~> 2.1)
|
68
71
|
bcrypt (3.1.10)
|
72
|
+
bootstrap-sass (3.3.6)
|
73
|
+
autoprefixer-rails (>= 5.2.1)
|
74
|
+
sass (>= 3.3.4)
|
69
75
|
builder (3.2.2)
|
70
|
-
|
76
|
+
camertron-eprun (1.1.0)
|
77
|
+
cancancan (1.10.1)
|
71
78
|
canonical-rails (0.0.11)
|
72
79
|
rails (>= 3.1, < 5.0)
|
80
|
+
carmen (1.0.2)
|
81
|
+
activesupport (>= 3.0.0)
|
82
|
+
cldr-plurals-runtime-rb (1.0.1)
|
73
83
|
climate_control (0.0.3)
|
74
84
|
activesupport (>= 3.0)
|
75
85
|
cocaine (0.5.8)
|
@@ -82,16 +92,19 @@ GEM
|
|
82
92
|
execjs
|
83
93
|
coffee-script-source (1.10.0)
|
84
94
|
colorize (0.7.7)
|
95
|
+
css_parser (1.3.7)
|
96
|
+
addressable
|
85
97
|
database_cleaner (1.5.1)
|
86
98
|
deface (1.0.2)
|
87
99
|
colorize (>= 0.5.8)
|
88
100
|
nokogiri (~> 1.6.0)
|
89
101
|
polyglot
|
90
102
|
rails (>= 3.1)
|
91
|
-
devise (3.
|
103
|
+
devise (3.4.1)
|
92
104
|
bcrypt (~> 3.0)
|
93
105
|
orm_adapter (~> 0.1)
|
94
106
|
railties (>= 3.2.6, < 5)
|
107
|
+
responders
|
95
108
|
thread_safe (~> 0.1)
|
96
109
|
warden (~> 1.2.3)
|
97
110
|
devise-encryptable (0.1.2)
|
@@ -103,22 +116,28 @@ GEM
|
|
103
116
|
ffaker (1.32.1)
|
104
117
|
font-awesome-rails (4.5.0.0)
|
105
118
|
railties (>= 3.2, < 5.0)
|
106
|
-
friendly_id (5.0
|
119
|
+
friendly_id (5.1.0)
|
107
120
|
activerecord (>= 4.0.0)
|
121
|
+
globalid (0.3.6)
|
122
|
+
activesupport (>= 4.1.0)
|
108
123
|
highline (1.6.21)
|
124
|
+
htmlentities (4.3.4)
|
109
125
|
httparty (0.13.7)
|
110
126
|
json (~> 1.8)
|
111
127
|
multi_xml (>= 0.5.2)
|
112
|
-
i18n (0.
|
113
|
-
jquery-rails (
|
114
|
-
|
128
|
+
i18n (0.7.0)
|
129
|
+
jquery-rails (4.0.5)
|
130
|
+
rails-dom-testing (~> 1.0)
|
131
|
+
railties (>= 4.2.0)
|
115
132
|
thor (>= 0.14, < 2.0)
|
116
|
-
jquery-ui-rails (
|
117
|
-
railties (>= 3.
|
133
|
+
jquery-ui-rails (5.0.5)
|
134
|
+
railties (>= 3.2.16)
|
118
135
|
json (1.8.3)
|
119
|
-
kaminari (0.
|
136
|
+
kaminari (0.16.3)
|
120
137
|
actionpack (>= 3.0.0)
|
121
138
|
activesupport (>= 3.0.0)
|
139
|
+
loofah (2.0.3)
|
140
|
+
nokogiri (>= 1.5.9)
|
122
141
|
mail (2.6.3)
|
123
142
|
mime-types (>= 1.16, < 3)
|
124
143
|
mime-types (2.99)
|
@@ -134,43 +153,60 @@ GEM
|
|
134
153
|
nokogiri (1.6.7)
|
135
154
|
mini_portile2 (~> 2.0.0.rc2)
|
136
155
|
orm_adapter (0.5.0)
|
137
|
-
paperclip (4.
|
138
|
-
activemodel (>= 3.
|
139
|
-
activesupport (>= 3.
|
140
|
-
cocaine (~> 0.5.
|
156
|
+
paperclip (4.2.4)
|
157
|
+
activemodel (>= 3.2.0)
|
158
|
+
activesupport (>= 3.2.0)
|
159
|
+
cocaine (~> 0.5.5)
|
141
160
|
mime-types
|
142
161
|
paranoia (2.1.4)
|
143
162
|
activerecord (~> 4.0)
|
144
|
-
polyamorous (1.
|
163
|
+
polyamorous (1.2.0)
|
145
164
|
activerecord (>= 3.0)
|
146
165
|
polyglot (0.3.5)
|
166
|
+
premailer (1.8.6)
|
167
|
+
css_parser (>= 1.3.6)
|
168
|
+
htmlentities (>= 4.0.0)
|
169
|
+
premailer-rails (1.8.2)
|
170
|
+
actionmailer (>= 3, < 5)
|
171
|
+
premailer (~> 1.7, >= 1.7.9)
|
147
172
|
rabl (0.9.4.pre1)
|
148
173
|
activesupport (>= 2.3.14)
|
149
|
-
rack (1.
|
174
|
+
rack (1.6.4)
|
150
175
|
rack-test (0.6.3)
|
151
176
|
rack (>= 1.0)
|
152
|
-
rails (4.
|
153
|
-
actionmailer (= 4.
|
154
|
-
actionpack (= 4.
|
155
|
-
actionview (= 4.
|
156
|
-
|
157
|
-
|
158
|
-
|
177
|
+
rails (4.2.5)
|
178
|
+
actionmailer (= 4.2.5)
|
179
|
+
actionpack (= 4.2.5)
|
180
|
+
actionview (= 4.2.5)
|
181
|
+
activejob (= 4.2.5)
|
182
|
+
activemodel (= 4.2.5)
|
183
|
+
activerecord (= 4.2.5)
|
184
|
+
activesupport (= 4.2.5)
|
159
185
|
bundler (>= 1.3.0, < 2.0)
|
160
|
-
railties (= 4.
|
161
|
-
sprockets-rails
|
162
|
-
|
163
|
-
|
164
|
-
|
186
|
+
railties (= 4.2.5)
|
187
|
+
sprockets-rails
|
188
|
+
rails-deprecated_sanitizer (1.0.3)
|
189
|
+
activesupport (>= 4.2.0.alpha)
|
190
|
+
rails-dom-testing (1.0.7)
|
191
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
192
|
+
nokogiri (~> 1.6.0)
|
193
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
194
|
+
rails-html-sanitizer (1.0.2)
|
195
|
+
loofah (~> 2.0)
|
196
|
+
railties (4.2.5)
|
197
|
+
actionpack (= 4.2.5)
|
198
|
+
activesupport (= 4.2.5)
|
165
199
|
rake (>= 0.8.7)
|
166
200
|
thor (>= 0.18.1, < 2.0)
|
167
201
|
rake (10.4.2)
|
168
|
-
ransack (1.
|
202
|
+
ransack (1.4.1)
|
169
203
|
actionpack (>= 3.0)
|
170
204
|
activerecord (>= 3.0)
|
171
205
|
activesupport (>= 3.0)
|
172
206
|
i18n
|
173
|
-
polyamorous (~> 1.
|
207
|
+
polyamorous (~> 1.1)
|
208
|
+
responders (2.1.0)
|
209
|
+
railties (>= 4.2.0, < 5)
|
174
210
|
rspec-collection_matchers (1.1.2)
|
175
211
|
rspec-expectations (>= 2.99.0.beta1)
|
176
212
|
rspec-core (2.99.2)
|
@@ -193,80 +229,95 @@ GEM
|
|
193
229
|
sprockets (>= 2.8, < 4.0)
|
194
230
|
sprockets-rails (>= 2.0, < 4.0)
|
195
231
|
tilt (>= 1.1, < 3)
|
196
|
-
select2-rails (3.5.9.
|
232
|
+
select2-rails (3.5.9.1)
|
197
233
|
thor (~> 0.14)
|
198
|
-
shoulda-matchers (2.
|
234
|
+
shoulda-matchers (2.2.0)
|
199
235
|
activesupport (>= 3.0.0)
|
200
|
-
simplecov (0.11.
|
236
|
+
simplecov (0.11.0)
|
201
237
|
docile (~> 1.1.0)
|
202
238
|
json (~> 1.8)
|
203
239
|
simplecov-html (~> 0.10.0)
|
204
240
|
simplecov-html (0.10.0)
|
205
|
-
spree (
|
206
|
-
spree_api (=
|
207
|
-
spree_backend (=
|
208
|
-
spree_cmd (=
|
209
|
-
spree_core (=
|
210
|
-
spree_frontend (=
|
211
|
-
spree_sample (=
|
212
|
-
spree_api (
|
241
|
+
spree (3.0.4)
|
242
|
+
spree_api (= 3.0.4)
|
243
|
+
spree_backend (= 3.0.4)
|
244
|
+
spree_cmd (= 3.0.4)
|
245
|
+
spree_core (= 3.0.4)
|
246
|
+
spree_frontend (= 3.0.4)
|
247
|
+
spree_sample (= 3.0.4)
|
248
|
+
spree_api (3.0.4)
|
213
249
|
rabl (~> 0.9.4.pre1)
|
214
|
-
spree_core (=
|
250
|
+
spree_core (= 3.0.4)
|
215
251
|
versioncake (~> 2.3.1)
|
216
|
-
spree_backend (
|
217
|
-
|
218
|
-
jquery-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
252
|
+
spree_backend (3.0.4)
|
253
|
+
bootstrap-sass (~> 3.3.1)
|
254
|
+
jquery-rails (~> 4.0.3)
|
255
|
+
jquery-ui-rails (~> 5.0.0)
|
256
|
+
select2-rails (= 3.5.9.1)
|
257
|
+
spree_api (= 3.0.4)
|
258
|
+
spree_core (= 3.0.4)
|
259
|
+
sprockets-rails (~> 2.2)
|
260
|
+
spree_cmd (3.0.4)
|
223
261
|
thor (~> 0.14)
|
224
|
-
spree_core (
|
225
|
-
activemerchant (~> 1.
|
226
|
-
acts_as_list (
|
227
|
-
awesome_nested_set (~> 3.0.
|
228
|
-
|
229
|
-
|
262
|
+
spree_core (3.0.4)
|
263
|
+
activemerchant (~> 1.47.0)
|
264
|
+
acts_as_list (~> 0.6)
|
265
|
+
awesome_nested_set (~> 3.0.1)
|
266
|
+
cancancan (~> 1.10.1)
|
267
|
+
carmen (~> 1.0.0)
|
230
268
|
deface (~> 1.0.0)
|
231
269
|
ffaker (~> 1.16)
|
232
270
|
font-awesome-rails (~> 4.0)
|
233
|
-
friendly_id (~> 5.0
|
271
|
+
friendly_id (~> 5.1.0)
|
234
272
|
highline (~> 1.6.18)
|
235
273
|
httparty (~> 0.11)
|
236
|
-
i18n (= 0.6.9)
|
237
274
|
json (~> 1.7)
|
238
|
-
kaminari (~> 0.15.
|
239
|
-
monetize
|
240
|
-
paperclip (~> 4.
|
241
|
-
paranoia (~> 2.0)
|
242
|
-
rails
|
243
|
-
|
244
|
-
|
245
|
-
|
275
|
+
kaminari (~> 0.15, >= 0.15.1)
|
276
|
+
monetize (~> 1.1)
|
277
|
+
paperclip (~> 4.2.0)
|
278
|
+
paranoia (~> 2.1.0)
|
279
|
+
premailer-rails
|
280
|
+
rails (~> 4.2.2)
|
281
|
+
ransack (~> 1.4.1)
|
282
|
+
responders
|
283
|
+
state_machines-activerecord (~> 0.2)
|
284
|
+
stringex
|
246
285
|
truncate_html (= 0.9.2)
|
247
|
-
|
286
|
+
twitter_cldr (~> 3.0)
|
287
|
+
spree_frontend (3.0.4)
|
288
|
+
bootstrap-sass (~> 3.3.1)
|
248
289
|
canonical-rails (~> 0.0.4)
|
249
|
-
jquery-rails (~>
|
250
|
-
spree_api (=
|
251
|
-
spree_core (=
|
252
|
-
|
253
|
-
spree_sample (
|
254
|
-
spree_core (=
|
290
|
+
jquery-rails (~> 4.0.3)
|
291
|
+
spree_api (= 3.0.4)
|
292
|
+
spree_core (= 3.0.4)
|
293
|
+
sprockets-rails (~> 2.2)
|
294
|
+
spree_sample (3.0.4)
|
295
|
+
spree_core (= 3.0.4)
|
255
296
|
sprockets (3.4.1)
|
256
297
|
rack (> 1, < 3)
|
257
298
|
sprockets-rails (2.3.3)
|
258
299
|
actionpack (>= 3.0)
|
259
300
|
activesupport (>= 3.0)
|
260
301
|
sprockets (>= 2.8, < 4.0)
|
261
|
-
|
262
|
-
|
302
|
+
state_machines (0.4.0)
|
303
|
+
state_machines-activemodel (0.3.0)
|
304
|
+
activemodel (~> 4.1)
|
305
|
+
state_machines (>= 0.4.0)
|
306
|
+
state_machines-activerecord (0.3.0)
|
307
|
+
activerecord (~> 4.1)
|
308
|
+
state_machines-activemodel (>= 0.3.0)
|
309
|
+
stringex (2.5.2)
|
263
310
|
thor (0.19.1)
|
264
311
|
thread_safe (0.3.5)
|
265
312
|
tilt (2.0.1)
|
266
313
|
truncate_html (0.9.2)
|
314
|
+
twitter_cldr (3.2.1)
|
315
|
+
camertron-eprun
|
316
|
+
cldr-plurals-runtime-rb (~> 1.0.0)
|
317
|
+
json
|
318
|
+
tzinfo
|
267
319
|
tzinfo (1.2.2)
|
268
320
|
thread_safe (~> 0.1)
|
269
|
-
uuidtools (2.1.5)
|
270
321
|
versioncake (2.3.1)
|
271
322
|
actionpack (>= 3.2)
|
272
323
|
activesupport (>= 3.2)
|
@@ -283,10 +334,10 @@ DEPENDENCIES
|
|
283
334
|
database_cleaner
|
284
335
|
mysql2
|
285
336
|
rspec-rails (~> 2.10)
|
286
|
-
sass-rails
|
287
|
-
shoulda-matchers (= 2.
|
337
|
+
sass-rails (~> 5.0)
|
338
|
+
shoulda-matchers (= 2.2.0)
|
288
339
|
simplecov
|
289
|
-
spree (
|
340
|
+
spree (~> 3.0.0)
|
290
341
|
spree_auth_devise!
|
291
342
|
spree_favorite_products!
|
292
343
|
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ This extension adds the following features:
|
|
5
5
|
|
6
6
|
1. Adds a link 'Mark as favorite' on product detail page.
|
7
7
|
2. Favorite Products tab on header
|
8
|
-
3. Favorite Products tab in admin section
|
8
|
+
3. Favorite Products tab in admin section
|
9
9
|
|
10
10
|
Installation
|
11
11
|
------------
|
@@ -13,10 +13,25 @@ Installation
|
|
13
13
|
Add spree_favorite_products to your Gemfile:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem 'spree_favorite_products', github:
|
16
|
+
gem 'spree_favorite_products', github: 'vinsol/spree_favorite_products', branch: '3-0-stable'
|
17
17
|
```
|
18
18
|
|
19
|
-
|
19
|
+
For older versions of spree.
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# Spree 2.2.x
|
23
|
+
gem 'spree_favorite_products', '2.2.3'
|
24
|
+
```
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
# Spree 2.1.x
|
28
|
+
gem 'spree_favorite_products', '2.0.3'
|
29
|
+
```
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Spree 2.0.x
|
33
|
+
gem 'spree_favorite_products', '1.0.0'
|
34
|
+
```
|
20
35
|
|
21
36
|
Bundle your dependencies and run the installation generator:
|
22
37
|
|
@@ -43,16 +58,6 @@ Simply add this require statement to your spec_helper:
|
|
43
58
|
require 'spree_favorite_products/factories'
|
44
59
|
```
|
45
60
|
|
46
|
-
Thought you should know:
|
47
|
-
During the test app build, there will be two warnings that arise due to a habtm issue, see [rails issue #15022](https://github.com/rails/rails/issues/15022)
|
48
|
-
|
49
|
-
```shell
|
50
|
-
/Users/deft/vendor/bundle/gems/activerecord-4.1.6/lib/active_record/associations.rb:1585: warning: already initialized constant Spree::ShippingMethod::HABTM_Zones
|
51
|
-
/Users/deft/vendor/bundle/gems/activerecord-4.1.6/lib/active_record/associations.rb:1585: warning: previous definition of HABTM_Zones was here
|
52
|
-
```
|
53
|
-
These warnings do not appear to interfere with functionality. Please let me know otherwise.
|
54
|
-
|
55
|
-
|
56
61
|
Contributing
|
57
62
|
------------
|
58
63
|
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module Spree
|
2
2
|
class Favorite < ActiveRecord::Base
|
3
3
|
belongs_to :product
|
4
|
-
|
5
4
|
belongs_to :user
|
6
5
|
validates :user_id, :product_id, :presence => true
|
7
6
|
validates :product_id, :uniqueness => { :scope => :user_id, :message => "already marked as favorite" }
|
8
7
|
validates :product, :presence => { :message => "is invalid" }, :if => :product_id
|
9
8
|
end
|
10
|
-
end
|
9
|
+
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
Deface::Override.new(
|
2
2
|
:virtual_path => 'spree/admin/general_settings/edit',
|
3
3
|
:name => 'add_favorite_products_per_page_configuration',
|
4
|
-
:
|
4
|
+
:insert_before => "#preferences fieldset .form-actions",
|
5
5
|
:text => %Q{
|
6
6
|
<div class="row">
|
7
|
-
<
|
8
|
-
<
|
9
|
-
|
10
|
-
<%= label_tag :favorite_products_per_page, Spree.t(:favorite_products_per_page) %><br>
|
7
|
+
<div class="col-md-6">
|
8
|
+
<div class="form-group" data-hook="admin_general_setting_favorite_products_per_page">
|
9
|
+
<%= label_tag :favorite_products_per_page, Spree.t(:favorite_products_per_page) %>
|
11
10
|
<%= text_field_tag :favorite_products_per_page, Spree::Config[:favorite_products_per_page], :size => 3 %>
|
12
11
|
</div>
|
13
|
-
</
|
12
|
+
</div>
|
14
13
|
</div>
|
15
14
|
}
|
16
|
-
)
|
15
|
+
)
|
@@ -1,11 +1,6 @@
|
|
1
1
|
Deface::Override.new(
|
2
|
-
:virtual_path => 'spree/admin/shared/
|
2
|
+
:virtual_path => 'spree/admin/shared/sub_menu/_product',
|
3
3
|
:name => 'select_products_tab',
|
4
|
-
:
|
5
|
-
:
|
6
|
-
|
7
|
-
<% if can? :admin, Spree::Product %>
|
8
|
-
<%= tab :products, :option_types, :properties, :prototypes, :variants, :product_properties, :taxonomies, :favorite_products, :icon => 'icon-th-large' %>
|
9
|
-
<% end %>
|
10
|
-
}
|
11
|
-
)
|
4
|
+
:insert_bottom => "#sidebar-product",
|
5
|
+
:text => %Q{ <%= tab :favorite_products %> }
|
6
|
+
)
|
@@ -2,12 +2,10 @@
|
|
2
2
|
<%= Spree.t(:listing_favorite_products) %>
|
3
3
|
<% end %>
|
4
4
|
|
5
|
-
<%= render :partial => 'spree/admin/shared/product_sub_menu' %>
|
6
|
-
|
7
5
|
<%= paginate @favorite_products %>
|
8
6
|
|
9
7
|
<% if @favorite_products.any? %>
|
10
|
-
<table class="
|
8
|
+
<table class="table" id="listing_products">
|
11
9
|
<colgroup>
|
12
10
|
<col style="width: 15%;">
|
13
11
|
<col style="width: 10%;">
|
@@ -43,4 +41,3 @@
|
|
43
41
|
<% end %>
|
44
42
|
|
45
43
|
<%= paginate @favorite_products %>
|
46
|
-
|
data/config/locales/en.yml
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
3
|
|
4
4
|
en:
|
5
|
-
hello: "Hello world"
|
6
5
|
spree:
|
7
6
|
favorite_products_settings: "Favorite Products Settings"
|
8
|
-
favorite_products_per_page: "Per Page"
|
7
|
+
favorite_products_per_page: "Favorite Products Shown Per Page"
|
9
8
|
mark_as_favorite: "Mark as favorite"
|
10
9
|
unmark_as_favorite: "Unmark as favorite"
|
@@ -4,24 +4,27 @@ describe Spree::Admin::FavoriteProductsController do
|
|
4
4
|
let(:role) { Spree::Role.create!(:name => 'user') }
|
5
5
|
let(:roles) { [role] }
|
6
6
|
let(:product) { mock_model( Spree::Product) }
|
7
|
+
let(:proxy_object) { Object.new }
|
7
8
|
|
8
9
|
before(:each) do
|
9
10
|
@user = mock_model(Spree::User, :generate_spree_api_key! => false)
|
10
|
-
@user.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
allow(@user).to receive(:roles).and_return(proxy_object)
|
12
|
+
allow(proxy_object).to receive(:includes).and_return([])
|
13
|
+
|
14
|
+
allow(@user).to receive(:has_spree_role?).with('admin').and_return(true)
|
15
|
+
allow(controller).to receive(:spree_user_signed_in?).and_return(true)
|
16
|
+
allow(controller).to receive(:spree_current_user).and_return(@user)
|
17
|
+
allow(@user).to receive(:roles).and_return(roles)
|
18
|
+
allow(roles).to receive(:includes).with(:permissions).and_return(roles)
|
19
|
+
allow(controller).to receive(:authorize_admin).and_return(true)
|
20
|
+
allow(controller).to receive(:authorize!).and_return(true)
|
18
21
|
|
19
22
|
@favorite_products = double('favorite_products')
|
20
|
-
@favorite_products.
|
23
|
+
allow(@favorite_products).to receive(:order_by_favorite_users_count).and_return(@favorite_products)
|
21
24
|
@search = double('search', :result => @favorite_products)
|
22
|
-
@favorite_products.
|
23
|
-
@favorite_products.
|
24
|
-
Spree::Product.
|
25
|
+
allow(@favorite_products).to receive(:search).and_return(@search)
|
26
|
+
allow(@favorite_products).to receive(:page).and_return(@favorite_products)
|
27
|
+
allow(Spree::Product).to receive(:favorite).and_return(@favorite_products)
|
25
28
|
end
|
26
29
|
|
27
30
|
describe "GET index" do
|
@@ -76,10 +79,10 @@ describe Spree::Admin::FavoriteProductsController do
|
|
76
79
|
describe "#users" do
|
77
80
|
before do
|
78
81
|
@users = [@user]
|
79
|
-
@users.
|
80
|
-
product.
|
82
|
+
allow(@users).to receive(:page).and_return(@users)
|
83
|
+
allow(product).to receive(:favorite_users).and_return(@users)
|
81
84
|
@products = [product]
|
82
|
-
Spree::Product.
|
85
|
+
allow(Spree::Product).to receive(:where).with(:id => product.id).and_return(@products)
|
83
86
|
end
|
84
87
|
|
85
88
|
def send_request
|
@@ -100,7 +103,7 @@ describe Spree::Admin::FavoriteProductsController do
|
|
100
103
|
end
|
101
104
|
|
102
105
|
describe "#sort_in_ascending_users_count?" do
|
103
|
-
|
106
|
+
|
104
107
|
context 'when favorite_user_count asc present in params[q][s]' do
|
105
108
|
it "is true" do
|
106
109
|
get :index, :page => 1 ,:use_route => 'spree', :q => { 's' => 'favorite_users_count asc' }
|
@@ -111,8 +114,8 @@ describe Spree::Admin::FavoriteProductsController do
|
|
111
114
|
context 'when favorite_user_count not present in params' do
|
112
115
|
it "is false" do
|
113
116
|
get :index, :page => 1 ,:use_route => 'spree', :q => { 's' => 'name asc' }
|
114
|
-
controller.send(:sort_in_ascending_users_count?).should
|
117
|
+
controller.send(:sort_in_ascending_users_count?).should be false
|
115
118
|
end
|
116
119
|
end
|
117
120
|
end
|
118
|
-
end
|
121
|
+
end
|
@@ -2,10 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Spree::FavoriteProductsController do
|
4
4
|
|
5
|
+
let(:proxy_object) { Object.new }
|
6
|
+
|
5
7
|
shared_examples_for "request which requires user authentication" do
|
6
8
|
it "authenticates user" do
|
7
9
|
controller.should_receive(:authenticate_spree_user!)
|
8
|
-
send_request
|
10
|
+
send_request
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
@@ -33,15 +35,15 @@ describe Spree::FavoriteProductsController do
|
|
33
35
|
|
34
36
|
before(:each) do
|
35
37
|
@favorite = mock_model(Spree::Favorite, :save => true)
|
36
|
-
controller.
|
37
|
-
Spree::Favorite.
|
38
|
+
allow(controller).to receive(:authenticate_spree_user!).and_return(true)
|
39
|
+
allow(Spree::Favorite).to receive(:new).and_return(@favorite)
|
38
40
|
@user = mock_model(Spree::User, :favorites => Spree::Favorite, :generate_spree_api_key! => false, :last_incomplete_spree_order => nil)
|
39
|
-
controller.
|
41
|
+
allow(controller).to receive(:spree_current_user).and_return(@user)
|
40
42
|
end
|
41
43
|
|
42
44
|
it_behaves_like "request which requires user authentication"
|
43
45
|
|
44
|
-
|
46
|
+
|
45
47
|
it "creates favorite" do
|
46
48
|
Spree::Favorite.should_receive(:new).with(:product_id => 1)
|
47
49
|
send_request
|
@@ -66,8 +68,9 @@ describe Spree::FavoriteProductsController do
|
|
66
68
|
|
67
69
|
context "when favorite not saved sucessfully" do
|
68
70
|
before(:each) do
|
69
|
-
@favorite.
|
70
|
-
@favorite.
|
71
|
+
allow(@favorite).to receive(:save).and_return(false)
|
72
|
+
allow(@favorite).to receive(:errors).and_return(proxy_object)
|
73
|
+
allow(proxy_object).to receive(:full_messages).and_return(["Product already marked as favorite"])
|
71
74
|
end
|
72
75
|
|
73
76
|
it "renders create template" do
|
@@ -89,12 +92,12 @@ describe Spree::FavoriteProductsController do
|
|
89
92
|
|
90
93
|
before(:each) do
|
91
94
|
@favorite_products = double('favorite_products')
|
92
|
-
@favorite_products.
|
93
|
-
@favorite_products.
|
94
|
-
Spree::Config.
|
95
|
+
allow(@favorite_products).to receive(:page).and_return(@favorite_products)
|
96
|
+
allow(@favorite_products).to receive(:per).and_return(@favorite_products)
|
97
|
+
allow(Spree::Config).to receive(:favorite_products_per_page).and_return('favorite_products_per_page')
|
95
98
|
@user = mock_model(Spree::User, :favorite_products => @favorite_products, :generate_spree_api_key! => false, :last_incomplete_spree_order => nil)
|
96
|
-
controller.
|
97
|
-
controller.
|
99
|
+
allow(controller).to receive(:authenticate_spree_user!).and_return(true)
|
100
|
+
allow(controller).to receive(:spree_current_user).and_return(@user)
|
98
101
|
end
|
99
102
|
|
100
103
|
it "authenticates user" do
|
@@ -131,13 +134,13 @@ describe Spree::FavoriteProductsController do
|
|
131
134
|
before do
|
132
135
|
@favorite = mock_model(Spree::Favorite)
|
133
136
|
@current_user_favorites = double('spree_favorites')
|
134
|
-
@current_user_favorites.
|
135
|
-
@current_user_favorites.
|
137
|
+
allow(@current_user_favorites).to receive(:where).and_return([@favorite])
|
138
|
+
allow(@current_user_favorites).to receive(:readonly).and_return(@current_user_favorites)
|
136
139
|
@favorites = double('spree_favorites')
|
137
|
-
@favorites.
|
140
|
+
allow(@favorites).to receive(:joins).with(:product).and_return(@current_user_favorites)
|
138
141
|
@user = mock_model(Spree::User, :favorites => @favorites, :generate_spree_api_key! => false, :last_incomplete_spree_order => nil)
|
139
|
-
controller.
|
140
|
-
controller.
|
142
|
+
allow(controller).to receive(:authenticate_spree_user!).and_return(true)
|
143
|
+
allow(controller).to receive(:spree_current_user).and_return(@user)
|
141
144
|
end
|
142
145
|
|
143
146
|
it_behaves_like "request which requires user authentication"
|
@@ -155,18 +158,18 @@ describe Spree::FavoriteProductsController do
|
|
155
158
|
|
156
159
|
context 'when destroyed successfully' do
|
157
160
|
before(:each) do
|
158
|
-
@favorite.
|
161
|
+
allow(@favorite).to receive(:destroy).and_return(true)
|
159
162
|
end
|
160
163
|
|
161
164
|
it "sets @success to true" do
|
162
165
|
send_request
|
163
166
|
assigns(:success).should eq(true)
|
164
|
-
end
|
167
|
+
end
|
165
168
|
end
|
166
169
|
|
167
170
|
context 'when not destroyed' do
|
168
171
|
before(:each) do
|
169
|
-
@favorite.
|
172
|
+
allow(@favorite).to receive(:destroy).and_return(false)
|
170
173
|
end
|
171
174
|
|
172
175
|
it 'sets @success to false' do
|
@@ -177,4 +180,4 @@ describe Spree::FavoriteProductsController do
|
|
177
180
|
end
|
178
181
|
|
179
182
|
end
|
180
|
-
end
|
183
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_favorite_products'
|
5
|
-
s.version = '
|
5
|
+
s.version = '3.0.0'
|
6
6
|
s.summary = 'Favorite Products in Spree'
|
7
7
|
s.description = 'This extension adds the following features: 1. Adds a link Mark as favorite on product detail page. 2. Favorite Products tab on header 3. Favorite Products tab in admin section'
|
8
|
-
s.required_ruby_version = '>=
|
8
|
+
s.required_ruby_version = '>= 2.0.0'
|
9
9
|
|
10
10
|
s.author = 'Mohit Bansal'
|
11
11
|
s.email = 'info@vinsol.com'
|
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_path = 'lib'
|
18
18
|
s.requirements << 'none'
|
19
19
|
|
20
|
-
s.add_dependency 'spree_core', '~>
|
20
|
+
s.add_dependency 'spree_core', '~> 3.0.0'
|
21
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_favorite_products
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mohit Bansal
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.0
|
27
27
|
description: 'This extension adds the following features: 1. Adds a link Mark as favorite
|
28
28
|
on product detail page. 2. Favorite Products tab on header 3. Favorite Products
|
29
29
|
tab in admin section'
|
@@ -54,7 +54,6 @@ files:
|
|
54
54
|
- app/models/spree/user_decorator.rb
|
55
55
|
- app/overrides/.DS_Store
|
56
56
|
- app/overrides/add_favorite_products_per_page_configuration.rb
|
57
|
-
- app/overrides/add_favorite_products_tab.rb
|
58
57
|
- app/overrides/add_favorite_products_to_products_tab.rb
|
59
58
|
- app/overrides/add_link_to_mark_product_as_favorite.rb
|
60
59
|
- app/overrides/add_link_to_users_favorite_products.rb
|
@@ -93,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
92
|
requirements:
|
94
93
|
- - ">="
|
95
94
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
95
|
+
version: 2.0.0
|
97
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
97
|
requirements:
|
99
98
|
- - ">="
|