refinerycms-stores 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/Gemfile +26 -0
  2. data/Gemfile.lock +306 -0
  3. data/Guardfile +27 -0
  4. data/LICENSE.txt +20 -0
  5. data/Rakefile +65 -0
  6. data/VERSION +1 -0
  7. data/app/assets/stylesheets/refinery/refinerycms-stores.sass +76 -0
  8. data/app/controllers/refinery/addresses/admin/addresses_controller.rb +12 -0
  9. data/app/controllers/refinery/orders/admin/orders_controller.rb +12 -0
  10. data/app/controllers/refinery/orders/orders_controller.rb +96 -0
  11. data/app/controllers/refinery/products/admin/products_controller.rb +12 -0
  12. data/app/controllers/refinery/products/products_controller.rb +17 -0
  13. data/app/controllers/refinery/stores/admin/stores_controller.rb +12 -0
  14. data/app/controllers/refinery/stores/stores_controller.rb +80 -0
  15. data/app/helpers/refinery/orders/orders_helper.rb +11 -0
  16. data/app/models/refinery/addresses/address.rb +12 -0
  17. data/app/models/refinery/orders/line_item.rb +24 -0
  18. data/app/models/refinery/orders/order.rb +364 -0
  19. data/app/models/refinery/products/product.rb +17 -0
  20. data/app/models/refinery/stores/store.rb +33 -0
  21. data/app/views/refinery/addresses/admin/addresses/_actions.html.erb +25 -0
  22. data/app/views/refinery/addresses/admin/addresses/_address.html.erb +16 -0
  23. data/app/views/refinery/addresses/admin/addresses/_addresses.html.erb +2 -0
  24. data/app/views/refinery/addresses/admin/addresses/_form.html.erb +89 -0
  25. data/app/views/refinery/addresses/admin/addresses/_records.html.erb +18 -0
  26. data/app/views/refinery/addresses/admin/addresses/_sortable_list.html.erb +5 -0
  27. data/app/views/refinery/addresses/admin/addresses/edit.html.erb +1 -0
  28. data/app/views/refinery/addresses/admin/addresses/index.html.erb +7 -0
  29. data/app/views/refinery/addresses/admin/addresses/new.html.erb +1 -0
  30. data/app/views/refinery/orders/admin/orders/_actions.html.erb +25 -0
  31. data/app/views/refinery/orders/admin/orders/_form.html.erb +122 -0
  32. data/app/views/refinery/orders/admin/orders/_order.html.erb +20 -0
  33. data/app/views/refinery/orders/admin/orders/_orders.html.erb +2 -0
  34. data/app/views/refinery/orders/admin/orders/_records.html.erb +18 -0
  35. data/app/views/refinery/orders/admin/orders/_sortable_list.html.erb +5 -0
  36. data/app/views/refinery/orders/admin/orders/edit.html.erb +1 -0
  37. data/app/views/refinery/orders/admin/orders/index.html.erb +7 -0
  38. data/app/views/refinery/orders/admin/orders/new.html.erb +1 -0
  39. data/app/views/refinery/orders/orders/_address_form.html.haml +35 -0
  40. data/app/views/refinery/orders/orders/_card_form.html.haml +63 -0
  41. data/app/views/refinery/orders/orders/_order_snapshot.html.haml +44 -0
  42. data/app/views/refinery/orders/orders/confirmation.html.haml +26 -0
  43. data/app/views/refinery/orders/orders/edit.html.haml +36 -0
  44. data/app/views/refinery/orders/orders/index.html.haml +6 -0
  45. data/app/views/refinery/orders/orders/purchase.html.haml +25 -0
  46. data/app/views/refinery/orders/orders/show.html.haml +36 -0
  47. data/app/views/refinery/products/admin/products/_actions.html.erb +25 -0
  48. data/app/views/refinery/products/admin/products/_form.html.erb +127 -0
  49. data/app/views/refinery/products/admin/products/_product.html.erb +20 -0
  50. data/app/views/refinery/products/admin/products/_products.html.erb +2 -0
  51. data/app/views/refinery/products/admin/products/_records.html.erb +18 -0
  52. data/app/views/refinery/products/admin/products/_sortable_list.html.erb +5 -0
  53. data/app/views/refinery/products/admin/products/edit.html.erb +4 -0
  54. data/app/views/refinery/products/admin/products/index.html.erb +10 -0
  55. data/app/views/refinery/products/admin/products/new.html.erb +4 -0
  56. data/app/views/refinery/products/products/show.html.erb +105 -0
  57. data/app/views/refinery/stores/admin/stores/_actions.html.erb +57 -0
  58. data/app/views/refinery/stores/admin/stores/_form.html.erb +56 -0
  59. data/app/views/refinery/stores/admin/stores/_records.html.erb +18 -0
  60. data/app/views/refinery/stores/admin/stores/_sortable_list.html.erb +5 -0
  61. data/app/views/refinery/stores/admin/stores/_store.html.erb +20 -0
  62. data/app/views/refinery/stores/admin/stores/_stores.html.erb +2 -0
  63. data/app/views/refinery/stores/admin/stores/edit.html.erb +4 -0
  64. data/app/views/refinery/stores/admin/stores/index.html.erb +13 -0
  65. data/app/views/refinery/stores/admin/stores/new.html.erb +4 -0
  66. data/app/views/refinery/stores/stores/_cart.html.erb +22 -0
  67. data/app/views/refinery/stores/stores/_cart_item.html.erb +9 -0
  68. data/app/views/refinery/stores/stores/_list_product.html.erb +16 -0
  69. data/app/views/refinery/stores/stores/index.html.erb +11 -0
  70. data/app/views/refinery/stores/stores/show.html.erb +28 -0
  71. data/config/locales/en.yml +143 -0
  72. data/config/locales/es.yml +143 -0
  73. data/config/locales/fr.yml +139 -0
  74. data/config/locales/nb.yml +143 -0
  75. data/config/locales/nl.yml +143 -0
  76. data/config/routes.rb +81 -0
  77. data/db/migrate/1_create_stores_stores.rb +29 -0
  78. data/db/migrate/2_create_products_products.rb +44 -0
  79. data/db/migrate/3_create_orders_orders.rb +44 -0
  80. data/db/migrate/4_create_orders_line_items.rb +20 -0
  81. data/db/migrate/5_create_addresses_addresses.rb +39 -0
  82. data/db/seeds.rb +23 -0
  83. data/lib/generators/refinery/stores_generator.rb +17 -0
  84. data/lib/refinery/addresses/engine.rb +31 -0
  85. data/lib/refinery/addresses.rb +21 -0
  86. data/lib/refinery/cart.rb +36 -0
  87. data/lib/refinery/cart_item.rb +28 -0
  88. data/lib/refinery/orders/engine.rb +31 -0
  89. data/lib/refinery/orders.rb +21 -0
  90. data/lib/refinery/products/engine.rb +31 -0
  91. data/lib/refinery/products.rb +21 -0
  92. data/lib/refinery/store_gateway.rb +106 -0
  93. data/lib/refinery/stores/engine.rb +31 -0
  94. data/lib/refinery/stores.rb +21 -0
  95. data/lib/refinerycms-stores.rb +7 -0
  96. data/lib/tasks/refinery/stores.rake +13 -0
  97. data/readme.md +10 -0
  98. data/refinerycms-stores.gemspec +261 -0
  99. data/spec/models/refinery/addresses/address_spec.rb +18 -0
  100. data/spec/models/refinery/orders/order_spec.rb +18 -0
  101. data/spec/models/refinery/products/product_spec.rb +18 -0
  102. data/spec/models/refinery/stores/store_spec.rb +18 -0
  103. data/spec/requests/refinery/addresses/admin/addresses_spec.rb +101 -0
  104. data/spec/requests/refinery/orders/admin/orders_spec.rb +101 -0
  105. data/spec/requests/refinery/products/admin/products_spec.rb +101 -0
  106. data/spec/requests/refinery/stores/admin/stores_spec.rb +101 -0
  107. data/spec/spec_helper.rb +53 -0
  108. data/spec/support/factories/refinery/addresses.rb +7 -0
  109. data/spec/support/factories/refinery/orders.rb +7 -0
  110. data/spec/support/factories/refinery/products.rb +7 -0
  111. data/spec/support/factories/refinery/stores.rb +7 -0
  112. data/tasks/rspec.rake +6 -0
  113. data/tasks/testing.rake +8 -0
  114. data/test/helper.rb +17 -0
  115. data/test/test_refinerycms-cart.rb +7 -0
  116. metadata +571 -0
data/Gemfile ADDED
@@ -0,0 +1,26 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'refinerycms', '~> 2.0.0'
6
+
7
+ # Refinery/rails should pull in the proper versions of these
8
+ group :assets do
9
+ gem 'sass-rails'
10
+ gem 'coffee-rails'
11
+ gem 'uglifier'
12
+ end
13
+
14
+ gem 'jquery-rails'
15
+
16
+ group :development, :test do
17
+ gem 'refinerycms-testing', '~> 2.0.0'
18
+ gem 'factory_girl_rails'
19
+ gem 'generator_spec'
20
+ gem 'jeweler'
21
+ gem 'simplecov'
22
+
23
+ gem 'rb-inotify', '>= 0.5.1'
24
+ gem 'libnotify', '~> 0.1.3'
25
+
26
+ end # group do
data/Gemfile.lock ADDED
@@ -0,0 +1,306 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ refinerycms-stores (0.0.1)
5
+ jquery-rails
6
+ refinerycms (~> 2.0.0)
7
+ refinerycms-stores
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ actionmailer (3.2.2)
13
+ actionpack (= 3.2.2)
14
+ mail (~> 2.4.0)
15
+ actionpack (3.2.2)
16
+ activemodel (= 3.2.2)
17
+ activesupport (= 3.2.2)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ journey (~> 1.0.1)
21
+ rack (~> 1.4.0)
22
+ rack-cache (~> 1.1)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.1.2)
25
+ activemodel (3.2.2)
26
+ activesupport (= 3.2.2)
27
+ builder (~> 3.0.0)
28
+ activerecord (3.2.2)
29
+ activemodel (= 3.2.2)
30
+ activesupport (= 3.2.2)
31
+ arel (~> 3.0.2)
32
+ tzinfo (~> 0.3.29)
33
+ activerecord-jdbc-adapter (1.2.2)
34
+ activerecord-jdbcmysql-adapter (1.2.2)
35
+ activerecord-jdbc-adapter (~> 1.2.2)
36
+ jdbc-mysql (~> 5.1.0)
37
+ activerecord-jdbcpostgresql-adapter (1.2.2)
38
+ activerecord-jdbc-adapter (~> 1.2.2)
39
+ jdbc-postgres (>= 9.0, < 9.2)
40
+ activerecord-jdbcsqlite3-adapter (1.2.2)
41
+ activerecord-jdbc-adapter (~> 1.2.2)
42
+ jdbc-sqlite3 (~> 3.7.2)
43
+ activeresource (3.2.2)
44
+ activemodel (= 3.2.2)
45
+ activesupport (= 3.2.2)
46
+ activesupport (3.2.2)
47
+ i18n (~> 0.6)
48
+ multi_json (~> 1.0)
49
+ acts_as_indexed (0.7.7)
50
+ addressable (2.2.7)
51
+ arel (3.0.2)
52
+ awesome_nested_set (2.1.2)
53
+ activerecord (>= 3.0.0)
54
+ babosa (0.3.5)
55
+ bcrypt-ruby (3.0.1)
56
+ builder (3.0.0)
57
+ capybara (1.1.2)
58
+ mime-types (>= 1.16)
59
+ nokogiri (>= 1.3.3)
60
+ rack (>= 1.0.0)
61
+ rack-test (>= 0.5.4)
62
+ selenium-webdriver (~> 2.0)
63
+ xpath (~> 0.1.4)
64
+ childprocess (0.3.1)
65
+ ffi (~> 1.0.6)
66
+ coffee-rails (3.2.2)
67
+ coffee-script (>= 2.2.0)
68
+ railties (~> 3.2.0)
69
+ coffee-script (2.2.0)
70
+ coffee-script-source
71
+ execjs
72
+ coffee-script-source (1.2.0)
73
+ database_cleaner (0.7.1)
74
+ devise (2.0.4)
75
+ bcrypt-ruby (~> 3.0)
76
+ orm_adapter (~> 0.0.3)
77
+ railties (~> 3.1)
78
+ warden (~> 1.1.1)
79
+ diff-lcs (1.1.3)
80
+ dragonfly (0.9.10)
81
+ rack
82
+ erubis (2.7.0)
83
+ execjs (1.3.0)
84
+ multi_json (~> 1.0)
85
+ factory_girl (2.5.2)
86
+ activesupport (>= 2.3.9)
87
+ factory_girl_rails (1.6.0)
88
+ factory_girl (~> 2.5.0)
89
+ railties (>= 3.0.0)
90
+ ffi (1.0.11)
91
+ friendly_id (4.0.1)
92
+ fuubar (1.0.0)
93
+ rspec (~> 2.0)
94
+ rspec-instafail (~> 0.2.0)
95
+ ruby-progressbar (~> 0.0.10)
96
+ generator_spec (0.8.5)
97
+ rails (>= 3.0, < 4.0)
98
+ rspec-rails
99
+ git (1.2.5)
100
+ globalize3 (0.2.0)
101
+ activemodel (>= 3.0.0)
102
+ activerecord (>= 3.0.0)
103
+ paper_trail (~> 2)
104
+ guard (1.0.0)
105
+ ffi (>= 0.5.0)
106
+ thor (~> 0.14.6)
107
+ guard-rspec (0.6.0)
108
+ guard (>= 0.10.0)
109
+ guard-spork (0.5.2)
110
+ guard (>= 0.10.0)
111
+ spork (>= 0.8.4)
112
+ hike (1.2.1)
113
+ i18n (0.6.0)
114
+ jdbc-mysql (5.1.13)
115
+ jdbc-postgres (9.1.901)
116
+ jdbc-sqlite3 (3.7.2)
117
+ jeweler (1.8.3)
118
+ bundler (~> 1.0)
119
+ git (>= 1.2.5)
120
+ rake
121
+ rdoc
122
+ journey (1.0.3)
123
+ jquery-rails (2.0.1)
124
+ railties (>= 3.2.0, < 5.0)
125
+ thor (~> 0.14)
126
+ json (1.6.5)
127
+ json_pure (1.6.5)
128
+ launchy (2.0.5)
129
+ addressable (~> 2.2.6)
130
+ libnotify (0.1.4)
131
+ ffi (>= 0.6.2)
132
+ mail (2.4.1)
133
+ i18n (>= 0.4.0)
134
+ mime-types (~> 1.16)
135
+ treetop (~> 1.4.8)
136
+ mime-types (1.17.2)
137
+ multi_json (1.1.0)
138
+ mysql2 (0.3.11)
139
+ nokogiri (1.5.0)
140
+ orm_adapter (0.0.6)
141
+ paper_trail (2.6.0)
142
+ rails (~> 3)
143
+ pg (0.13.2)
144
+ polyglot (0.3.3)
145
+ rack (1.4.1)
146
+ rack-cache (1.2)
147
+ rack (>= 0.4)
148
+ rack-ssl (1.3.2)
149
+ rack
150
+ rack-test (0.6.1)
151
+ rack (>= 1.0)
152
+ rails (3.2.2)
153
+ actionmailer (= 3.2.2)
154
+ actionpack (= 3.2.2)
155
+ activerecord (= 3.2.2)
156
+ activeresource (= 3.2.2)
157
+ activesupport (= 3.2.2)
158
+ bundler (~> 1.0)
159
+ railties (= 3.2.2)
160
+ railties (3.2.2)
161
+ actionpack (= 3.2.2)
162
+ activesupport (= 3.2.2)
163
+ rack-ssl (~> 1.3.2)
164
+ rake (>= 0.8.7)
165
+ rdoc (~> 3.4)
166
+ thor (~> 0.14.6)
167
+ rake (0.9.2.2)
168
+ rb-fchange (0.0.5)
169
+ ffi
170
+ rb-inotify (0.8.8)
171
+ ffi (>= 0.5.0)
172
+ rb-notifu (0.0.4)
173
+ rdoc (3.12)
174
+ json (~> 1.4)
175
+ refinerycms (2.0.1)
176
+ bundler (~> 1.0)
177
+ refinerycms-authentication (= 2.0.1)
178
+ refinerycms-core (= 2.0.1)
179
+ refinerycms-dashboard (= 2.0.1)
180
+ refinerycms-images (= 2.0.1)
181
+ refinerycms-pages (= 2.0.1)
182
+ refinerycms-resources (= 2.0.1)
183
+ refinerycms-authentication (2.0.1)
184
+ devise (~> 2.0.0)
185
+ refinerycms-core (= 2.0.1)
186
+ refinerycms-core (2.0.1)
187
+ acts_as_indexed (~> 0.7.7)
188
+ awesome_nested_set (~> 2.1.0)
189
+ coffee-rails (~> 3.2.1)
190
+ friendly_id (~> 4.0.1)
191
+ globalize3 (~> 0.2.0)
192
+ jquery-rails (~> 2.0.0)
193
+ rails (>= 3.1.3, < 3.3)
194
+ sass-rails (~> 3.2.3)
195
+ truncate_html (~> 0.5)
196
+ uglifier (>= 1.0.3)
197
+ will_paginate (~> 3.0.2)
198
+ refinerycms-dashboard (2.0.1)
199
+ refinerycms-core (= 2.0.1)
200
+ refinerycms-images (2.0.1)
201
+ dragonfly (~> 0.9.8)
202
+ rack-cache (>= 0.5.3)
203
+ refinerycms-core (= 2.0.1)
204
+ refinerycms-pages (2.0.1)
205
+ awesome_nested_set (~> 2.1.0)
206
+ babosa (!= 0.3.6)
207
+ refinerycms-core (= 2.0.1)
208
+ seo_meta (~> 1.2.0)
209
+ refinerycms-resources (2.0.1)
210
+ dragonfly (~> 0.9.8)
211
+ rack-cache (>= 0.5.3)
212
+ refinerycms-core (= 2.0.1)
213
+ refinerycms-testing (2.0.1)
214
+ capybara (~> 1.1.0)
215
+ database_cleaner (~> 0.7.1)
216
+ factory_girl_rails (~> 1.6.0)
217
+ fuubar
218
+ guard-rspec (~> 0.6.0)
219
+ guard-spork (~> 0.5.2)
220
+ json_pure
221
+ launchy
222
+ rack-test (~> 0.6.0)
223
+ refinerycms-core (= 2.0.1)
224
+ rspec-instafail
225
+ rspec-rails (~> 2.8.1)
226
+ rspec (2.8.0)
227
+ rspec-core (~> 2.8.0)
228
+ rspec-expectations (~> 2.8.0)
229
+ rspec-mocks (~> 2.8.0)
230
+ rspec-core (2.8.0)
231
+ rspec-expectations (2.8.0)
232
+ diff-lcs (~> 1.1.2)
233
+ rspec-instafail (0.2.2)
234
+ rspec-mocks (2.8.0)
235
+ rspec-rails (2.8.1)
236
+ actionpack (>= 3.0)
237
+ activesupport (>= 3.0)
238
+ railties (>= 3.0)
239
+ rspec (~> 2.8.0)
240
+ ruby-progressbar (0.0.10)
241
+ rubyzip (0.9.6.1)
242
+ sass (3.1.15)
243
+ sass-rails (3.2.4)
244
+ railties (~> 3.2.0)
245
+ sass (>= 3.1.10)
246
+ tilt (~> 1.3)
247
+ selenium-webdriver (2.20.0)
248
+ childprocess (>= 0.2.5)
249
+ ffi (~> 1.0)
250
+ multi_json (~> 1.0)
251
+ rubyzip
252
+ seo_meta (1.2.0)
253
+ railties (>= 3.0.0)
254
+ simplecov (0.6.1)
255
+ multi_json (~> 1.0)
256
+ simplecov-html (~> 0.5.3)
257
+ simplecov-html (0.5.3)
258
+ spork (0.9.0.rc9)
259
+ sprockets (2.1.2)
260
+ hike (~> 1.2)
261
+ rack (~> 1.0)
262
+ tilt (~> 1.1, != 1.3.0)
263
+ sqlite3 (1.3.5)
264
+ thor (0.14.6)
265
+ tilt (1.3.3)
266
+ treetop (1.4.10)
267
+ polyglot
268
+ polyglot (>= 0.3.1)
269
+ truncate_html (0.5.4)
270
+ tzinfo (0.3.32)
271
+ uglifier (1.2.3)
272
+ execjs (>= 0.3.0)
273
+ multi_json (>= 1.0.2)
274
+ warden (1.1.1)
275
+ rack (>= 1.0)
276
+ will_paginate (3.0.3)
277
+ xpath (0.1.4)
278
+ nokogiri (~> 1.3)
279
+
280
+ PLATFORMS
281
+ ruby
282
+
283
+ DEPENDENCIES
284
+ activerecord-jdbcmysql-adapter
285
+ activerecord-jdbcpostgresql-adapter
286
+ activerecord-jdbcsqlite3-adapter
287
+ coffee-rails
288
+ factory_girl_rails
289
+ generator_spec
290
+ guard-spork
291
+ jeweler
292
+ jquery-rails
293
+ libnotify (~> 0.1.3)
294
+ mysql2
295
+ pg
296
+ rb-fchange (~> 0.0.5)
297
+ rb-inotify (>= 0.5.1)
298
+ rb-notifu (~> 0.0.4)
299
+ refinerycms (~> 2.0.0)
300
+ refinerycms-stores!
301
+ refinerycms-testing (~> 2.0.0)
302
+ sass-rails
303
+ simplecov
304
+ spork (= 0.9.0.rc9)
305
+ sqlite3
306
+ uglifier
data/Guardfile ADDED
@@ -0,0 +1,27 @@
1
+ guard 'spork', :wait => 60, :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do
2
+ watch('config/application.rb')
3
+ watch('config/environment.rb')
4
+ watch(%r{^config/environments/.+\.rb$})
5
+ watch(%r{^config/initializers/.+\.rb$})
6
+ watch('spec/spec_helper.rb')
7
+ watch(%r{^spec/support/.+\.rb$})
8
+ watch(%r{^vendor/engines/(.+)/spec/support/.+\.rb$})
9
+ end
10
+
11
+ guard 'rspec', :version => 2, :cli => "--color --drb --format Fuubar", :all_on_start => false, :all_after_pass => false do
12
+ watch(%r{^spec/.+_spec\.rb$})
13
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
14
+ watch('spec/spec_helper.rb') { "spec" }
15
+
16
+ # Rails example
17
+ watch(%r{^spec/.+_spec\.rb$})
18
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
19
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
20
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
21
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
22
+ watch('spec/spec_helper.rb') { "spec" }
23
+ watch('config/routes.rb') { "spec/routing" }
24
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
25
+ # Capybara request specs
26
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
27
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Daudi Amani
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ ENGINE_PATH = File.dirname(__FILE__)
9
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
10
+
11
+ if File.exists?(APP_RAKEFILE)
12
+ load 'rails/tasks/engine.rake'
13
+ end
14
+
15
+ # require "refinerycms-testing"
16
+ #
17
+ # Refinery::Testing::Railtie.load_tasks
18
+ # Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
19
+
20
+ # load File.expand_path('../tasks/testing.rake', __FILE__)
21
+ # load File.expand_path('../tasks/rspec.rake', __FILE__)
22
+
23
+
24
+
25
+ # encoding: utf-8
26
+
27
+ require 'rubygems'
28
+ require 'rake'
29
+ require 'jeweler'
30
+
31
+ Jeweler::Tasks.new do |gem|
32
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
33
+ gem.name = "refinerycms-stores"
34
+ gem.homepage = "http://github.com/dsaronin@gmail.com/refinerycms-stores"
35
+ gem.license = "MIT"
36
+ gem.summary = %Q{refinerycms shopping cart engine}
37
+ gem.description = %Q{Complete engine for shopping cart to be used with a RefineryCMS project}
38
+ gem.email = "dsaronin@gmail.com"
39
+ gem.authors = ["Daudi Amani"]
40
+ # dependencies defined in Gemfile
41
+ end
42
+ Jeweler::RubygemsDotOrgTasks.new
43
+
44
+ require 'rake/testtask'
45
+ Rake::TestTask.new(:test) do |test|
46
+ test.libs << 'lib' << 'test'
47
+ test.pattern = 'test/**/test_*.rb'
48
+ test.verbose = true
49
+ end
50
+
51
+ require 'simplecov'
52
+ SimpleCov.start 'rails'
53
+
54
+ task :default => :test
55
+
56
+ require 'rdoc/task'
57
+ Rake::RDocTask.new do |rdoc|
58
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
59
+
60
+ rdoc.rdoc_dir = 'rdoc'
61
+ rdoc.title = "refinerycms-stores #{version}"
62
+ rdoc.rdoc_files.include('README*')
63
+ rdoc.rdoc_files.include('lib/**/*.rb')
64
+ end
65
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,76 @@
1
+ .comments_icon
2
+ background-image: url('icons/comments.png')
3
+
4
+ .comment_icon
5
+ background-image: url('icons/comment.png')
6
+
7
+ .comment_cross_icon
8
+ background-image: url('icons/comment_cross.png')
9
+
10
+ .comment_tick_icon
11
+ background-image: url('icons/comment_tick.png')
12
+
13
+ .folder_icon
14
+ background-image: url('icons/folder.png')
15
+
16
+ .folder_add_icon
17
+ background-image: url('icons/folder_add.png')
18
+
19
+ .folder_edit_icon
20
+ background-image: url('icons/folder_edit.png')
21
+
22
+ .settings_icon
23
+ background-image: url('icons/cog.png')
24
+
25
+ .page_icon
26
+ background-image: url('icons/page.png')
27
+
28
+ .page_copy_icon
29
+ background-image: url('icons/page_copy.png')
30
+
31
+ .page_add_icon
32
+ background-image: url('icons/page_add.png')
33
+
34
+
35
+ textarea.wymeditor, .wym_skin_refinery .wym_iframe iframe
36
+ height: auto
37
+
38
+
39
+ #content .float-field
40
+ width: 25%
41
+ float: left
42
+
43
+
44
+ section.catalog-brief-list
45
+ dl
46
+ float: left
47
+ text-align: center
48
+ font-size: 12px
49
+ dt, dd
50
+ width: 100px
51
+ float: left
52
+ color: #333
53
+
54
+ a
55
+ font-size: 12px
56
+ color: #333
57
+ dt
58
+ margin-bottom: 4em
59
+ // vertical space between the images
60
+ dd
61
+ text-align: center
62
+ font-weight: bold
63
+ margin: 120px 0 0 -95px
64
+ img
65
+ vertical-align: bottom
66
+ border: 0
67
+ width: 80px
68
+
69
+ table.product-header
70
+ td.mainpic
71
+ margin: 1em
72
+ padding: 2em
73
+ align: right
74
+ border: outset 2px lightgray
75
+
76
+
@@ -0,0 +1,12 @@
1
+ module Refinery
2
+ module Addresses
3
+ module Admin
4
+ class AddressesController < ::Refinery::AdminController
5
+
6
+ crudify :'refinery/addresses/address',
7
+ :title_attribute => 'first_name', :xhr_paging => true
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module Refinery
2
+ module Orders
3
+ module Admin
4
+ class OrdersController < ::Refinery::AdminController
5
+
6
+ crudify :'refinery/orders/order',
7
+ :title_attribute => 'order_status', :xhr_paging => true
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,96 @@
1
+ module Refinery
2
+ module Orders
3
+ class OrdersController < ::ApplicationController
4
+
5
+ # force/ensure SSL
6
+ # ensure user registration unless anon orders okay
7
+ # ensure state machine transitions
8
+
9
+ before_filter :find_all_orders, :only => :index
10
+ before_filter :find_order, :except => :index
11
+ before_filter :setup_payment_gateway, :only => [:edit, :update, :purchase, :re_edit]
12
+
13
+ def index
14
+ # you can use meta fields from your model instead (e.g. browser_title)
15
+ # by swapping @page for @order in the line below:
16
+ present(@order)
17
+ end
18
+
19
+ def show
20
+ # you can use meta fields from your model instead (e.g. browser_title)
21
+ # by swapping @page for @order in the line below:
22
+ present(@order)
23
+ end
24
+
25
+ # update must proceed within confines of order state machine
26
+ # but must validate params as well
27
+ def update
28
+ @billing_address, @shipping_address = @order.handle_update( params )
29
+ edit
30
+ end
31
+
32
+ # edit must present the view appropriate to order state
33
+ def edit
34
+ if (@action = @order.get_render_template).nil?
35
+ flash[:notice] = "invalid order processing attempted"
36
+ redirect_to refinery.stores_stores_path
37
+ else
38
+ prep_edit_view
39
+ render :action => @action
40
+ end # if..then..else no action
41
+ end
42
+
43
+ # displays the successful purchase page
44
+ def purchase
45
+
46
+ @order.confirm_purchase!
47
+ @order.process_purchase( @payment_gateway )
48
+
49
+ if @order.errors.empty?
50
+ @action = :purchase_complete
51
+ @purchase_status = "thank you for your purchase"
52
+ else
53
+ @action = :purchase_pending
54
+ @purchase_status = "Purchase unsuccessful; please correct errors and try again."
55
+ end
56
+ end
57
+
58
+ def cancel_order
59
+ @order.cancel_process!
60
+ flash[:notice] = "you may continue your order any time"
61
+ redirect_to refinery.stores_stores_path
62
+ end
63
+
64
+ def re_edit
65
+ @order.restart_checkout!
66
+ edit
67
+ end
68
+
69
+ protected
70
+
71
+ def find_all_orders
72
+ @orders = Order.order('position ASC')
73
+ end
74
+
75
+ def find_order
76
+ @order = Order.find(params[:id])
77
+ end
78
+
79
+ def find_page
80
+ @page = ::Refinery::Page.where(:link_url => "/orders").first
81
+ end
82
+
83
+ def setup_payment_gateway
84
+ @payment_gateway = ::Refinery::StoreGateway.new( @order.line_items.first.product.store )
85
+ end
86
+
87
+ def prep_edit_view
88
+ if @billing_address.nil?
89
+ @billing_address, @shipping_address = @order.get_billship_addresses
90
+ end
91
+ end
92
+
93
+ end # class OrdersController
94
+ end # module Orders
95
+ end # module Refinery
96
+
@@ -0,0 +1,12 @@
1
+ module Refinery
2
+ module Products
3
+ module Admin
4
+ class ProductsController < ::Refinery::AdminController
5
+
6
+ crudify :'refinery/products/product',
7
+ :title_attribute => 'name', :xhr_paging => true
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ module Refinery
2
+ module Products
3
+ class ProductsController < ::ApplicationController
4
+
5
+ def show
6
+ @product = Product.find(params[:id])
7
+
8
+ # you can use meta fields from your model instead (e.g. browser_title)
9
+ # by swapping @page for @product in the line below:
10
+ present(@page)
11
+ end
12
+
13
+ protected
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module Refinery
2
+ module Stores
3
+ module Admin
4
+ class StoresController < ::Refinery::AdminController
5
+
6
+ crudify :'refinery/stores/store',
7
+ :title_attribute => 'name', :xhr_paging => true
8
+
9
+ end
10
+ end
11
+ end
12
+ end