office_clerk 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +15 -0
  3. data/Gemfile +0 -13
  4. data/Gemfile.lock +50 -83
  5. data/Guardfile +28 -0
  6. data/app/controllers/admin_controller.rb +6 -2
  7. data/app/controllers/baskets_controller.rb +2 -1
  8. data/app/controllers/categories_controller.rb +2 -1
  9. data/app/controllers/office_controller.rb +5 -0
  10. data/app/controllers/products_controller.rb +1 -1
  11. data/app/controllers/sessions_controller.rb +5 -0
  12. data/app/helpers/shop_helper.rb +0 -11
  13. data/app/models/basket.rb +2 -2
  14. data/app/models/clerk.rb +1 -3
  15. data/app/models/order.rb +3 -3
  16. data/app/views/baskets/_small.html.haml +1 -0
  17. data/app/views/baskets/index.html.haml +3 -3
  18. data/app/views/baskets/show.html.haml +1 -2
  19. data/app/views/categories/edit.html.haml +2 -1
  20. data/app/views/categories/index.html.haml +19 -8
  21. data/app/views/categories/show.html.haml +31 -26
  22. data/app/views/clerks/index.html.haml +4 -4
  23. data/app/views/layouts/_header_extra.haml +1 -2
  24. data/app/views/layouts/office_clerk.csv.erb +1 -0
  25. data/app/views/order_mailer/cancel.text.erb +24 -0
  26. data/app/views/order_mailer/confirm.text.erb +36 -0
  27. data/app/views/order_mailer/paid.text.erb +28 -0
  28. data/app/views/order_mailer/shipped.text.erb +24 -0
  29. data/app/views/orders/index.csv.erb +5 -0
  30. data/app/views/orders/index.html.haml +39 -45
  31. data/app/views/orders/show.html.haml +23 -11
  32. data/app/views/products/_triple.html.haml +2 -2
  33. data/app/views/products/index.html.haml +37 -19
  34. data/app/views/purchases/index.html.haml +4 -3
  35. data/app/views/shop/_product_box.haml +12 -12
  36. data/app/views/suppliers/index.html.haml +5 -5
  37. data/bin/rake +0 -4
  38. data/bin/rspec +0 -4
  39. data/config/locales/en.yml +5 -0
  40. data/config/locales/fi.yml +5 -0
  41. data/config/spring.rb +1 -0
  42. data/lib/office_clerk.rb +3 -1
  43. data/lib/office_clerk/engine.rb +5 -1
  44. data/lib/office_clerk/shipping_method.rb +1 -1
  45. data/lib/office_clerk/version.rb +1 -1
  46. data/office_clerk.gemspec +3 -1
  47. data/spec/features/categories_search_spec.rb +47 -0
  48. data/spec/features/products/index_spec.rb +58 -9
  49. data/spec/models/clerk/email_spec.rb +4 -4
  50. data/spec/spec_helper.rb +6 -47
  51. data/spec/support/basket_helper.rb +9 -0
  52. data/spec/support/product_helper.rb +25 -0
  53. data/spec/support/request_helper.rb +4 -4
  54. data/spec/support/setup/admin.rb +4 -0
  55. data/spec/support/setup/capybara.rb +14 -0
  56. data/spec/support/setup/cleaner.rb +22 -0
  57. data/spec/support/setup/email.rb +6 -0
  58. data/spec/support/setup/factory_girl.rb +3 -0
  59. metadata +95 -51
  60. data/app/views/order_mailer/cancel.html.haml +0 -6
  61. data/app/views/order_mailer/confirm.html.haml +0 -7
  62. data/app/views/order_mailer/paid.html.haml +0 -6
  63. data/app/views/order_mailer/shipped.html.haml +0 -6
  64. data/config/i18n-tasks.yml +0 -11
  65. data/spec/support/factory_girl.rb +0 -6
  66. data/test_app/spec/rails_helper.rb +0 -50
  67. data/test_app/spec/spec_helper.rb +0 -85
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56d6271f7a086331b09afec3ae09a147a9597258
4
- data.tar.gz: 30ebd8fbf11b488f2a05d00d316ee64c8f693e3f
3
+ metadata.gz: 1ddc45855a851af3f02607825a7d2fd94ed802c9
4
+ data.tar.gz: ddfab4362620b9043574d8eb7d97793b8a49132b
5
5
  SHA512:
6
- metadata.gz: aa365643d22ae66f4c82b55d9d6715122dfca353c6cdb6684dcb7d0f57800caef83b910889d769108be317e4bc6c666a96a2d7e20e497aa34c7b4f93b591a3ee
7
- data.tar.gz: 15932e74f50c0fca75818e3e2ef099c5d6b33370f72b0796ddfcad556dae7f02dd32cb43c41396fda97f10267277ccf2db224abbc61fe94635f1487e71c7e6aa
6
+ metadata.gz: 51b6b48dfcabe21eef92716f31fe282d571b440ce453ebd73a77e7995c8e15c7b2bdfdad080d0497b6df434fcd70efe5604a90df40897dda1b994cbdb9fe55a2
7
+ data.tar.gz: bdf6744c2b0c661b66ce56d04e6f1f4dc2ff3109d7dafc1fc1f4d71c3f76c4900628ec5e66da41828501cc63d72328611952feee2e93b06ece5765ee09d1236b
data/ChangeLog.md ADDED
@@ -0,0 +1,15 @@
1
+ ### 0.6
2
+
3
+ - Remove simpleform
4
+ - Fix some date-formats
5
+ - improve searching for non-existing fields
6
+ - introduce product/category summary field (for lists)
7
+ - Start to unse gon and make other clerks independant
8
+ - ssl configuration possible
9
+ - better payment/shipment for orders (tbc)
10
+ - second production site
11
+
12
+ ### prior 0.5
13
+
14
+ Basic core has been stable and in produciton for 9 months.
15
+ Since no gem realease were done before production versions go quite quickly towards 1
data/Gemfile CHANGED
@@ -4,30 +4,18 @@ gem "office_clerk" , :path => "../"
4
4
 
5
5
  gem 'sqlite3'
6
6
 
7
- # template
8
- gem "ransack", github: "activerecord-hackery/ransack", branch: "rails-4"
9
-
10
- #misc
11
- gem "valid_email" , :require => 'valid_email/email_validator' #no mx checking
12
- gem 'db_fixtures_dump' , :github => 'rubyclerks/db_fixtures_dump' #backup
13
-
14
7
  #asset / production reelated
15
8
  gem "therubyracer"
16
9
  gem "libv8" , "3.16.14.3"
17
10
  gem "rb-readline"
18
11
  gem 'uglifier', '>= 1.3.0'
19
- gem 'coffee-rails'
20
12
 
21
13
  group :development do
22
14
  gem 'better_errors' , :platforms=>[:mri_20, :mri_21, :rbx]
23
15
  gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :mri_21,:rbx]
24
- gem "i18n-tasks"
25
16
  gem 'quiet_assets'
26
- # gem "jeweler", "> 1.6.4"
27
17
  end
28
18
  group :test do
29
- # gem "poltergeist"
30
- # gem "phantomjs"
31
19
  gem "codeclimate-test-reporter"
32
20
  gem 'rspec-rails'
33
21
  gem 'capybara'
@@ -36,7 +24,6 @@ group :test do
36
24
  gem "factory_girl_rails"
37
25
  gem 'email_spec'
38
26
  gem 'i18n-spec'
39
- gem 'guard-bundler'
40
27
  gem 'guard-rails'
41
28
  gem 'guard-rspec'
42
29
  end
data/Gemfile.lock CHANGED
@@ -1,21 +1,3 @@
1
- GIT
2
- remote: git://github.com/activerecord-hackery/ransack.git
3
- revision: d1fc95b3c21c8294e69c70e3995459d11dabfd67
4
- branch: rails-4
5
- specs:
6
- ransack (1.2.3)
7
- actionpack (>= 4.0)
8
- activerecord (>= 4.0)
9
- activesupport (>= 4.0)
10
- i18n
11
- polyamorous (~> 1.1)
12
-
13
- GIT
14
- remote: git://github.com/rubyclerks/db_fixtures_dump.git
15
- revision: 2d00815c8cb4a9bf143564a8a1de082b6e30282c
16
- specs:
17
- db_fixtures_dump (0.0.9)
18
-
19
1
  PATH
20
2
  remote: ../
21
3
  specs:
@@ -30,40 +12,44 @@ PATH
30
12
  jquery-ui-rails (~> 5.0)
31
13
  kramdown (~> 1.5)
32
14
  paperclip (~> 4.1)
33
- rails (~> 4.0, >= 4.0.1)
15
+ rails (~> 4.1, <= 4.2)
34
16
  rails-i18n (~> 4.0)
17
+ ransack (>= 1.5.1)
35
18
  sass-rails (~> 4.0)
19
+ valid_email
36
20
  will_paginate-bootstrap (~> 1.0)
37
21
 
38
22
  GEM
39
23
  remote: https://rubygems.org/
40
24
  specs:
41
- actionmailer (4.0.11)
42
- actionpack (= 4.0.11)
25
+ actionmailer (4.1.8)
26
+ actionpack (= 4.1.8)
27
+ actionview (= 4.1.8)
43
28
  mail (~> 2.5, >= 2.5.4)
44
- actionpack (4.0.11)
45
- activesupport (= 4.0.11)
46
- builder (~> 3.1.0)
47
- erubis (~> 2.7.0)
29
+ actionpack (4.1.8)
30
+ actionview (= 4.1.8)
31
+ activesupport (= 4.1.8)
48
32
  rack (~> 1.5.2)
49
33
  rack-test (~> 0.6.2)
50
- activemodel (4.0.11)
51
- activesupport (= 4.0.11)
52
- builder (~> 3.1.0)
53
- activerecord (4.0.11)
54
- activemodel (= 4.0.11)
55
- activerecord-deprecated_finders (~> 1.0.2)
56
- activesupport (= 4.0.11)
57
- arel (~> 4.0.0)
58
- activerecord-deprecated_finders (1.0.3)
59
- activesupport (4.0.11)
34
+ actionview (4.1.8)
35
+ activesupport (= 4.1.8)
36
+ builder (~> 3.1)
37
+ erubis (~> 2.7.0)
38
+ activemodel (4.1.8)
39
+ activesupport (= 4.1.8)
40
+ builder (~> 3.1)
41
+ activerecord (4.1.8)
42
+ activemodel (= 4.1.8)
43
+ activesupport (= 4.1.8)
44
+ arel (~> 5.0.0)
45
+ activesupport (4.1.8)
60
46
  i18n (~> 0.6, >= 0.6.9)
61
- minitest (~> 4.2)
62
- multi_json (~> 1.3)
47
+ json (~> 1.7, >= 1.7.7)
48
+ minitest (~> 5.1)
63
49
  thread_safe (~> 0.1)
64
- tzinfo (~> 0.3.37)
50
+ tzinfo (~> 1.1)
65
51
  addressable (2.3.6)
66
- arel (4.0.2)
52
+ arel (5.0.1.20140414130214)
67
53
  bcrypt (3.1.9)
68
54
  bcrypt-ruby (3.1.5)
69
55
  bcrypt (>= 3.1.3)
@@ -76,7 +62,7 @@ GEM
76
62
  bootstrap-sass (3.3.1.0)
77
63
  sass (~> 3.2)
78
64
  bootstrap_form (2.2.0)
79
- builder (3.1.4)
65
+ builder (3.2.2)
80
66
  capybara (2.4.4)
81
67
  mime-types (>= 1.16)
82
68
  nokogiri (>= 1.3.3)
@@ -96,7 +82,7 @@ GEM
96
82
  codeclimate-test-reporter (0.4.1)
97
83
  simplecov (>= 0.7.1, < 1.0.0)
98
84
  coderay (1.1.0)
99
- coffee-rails (4.0.1)
85
+ coffee-rails (4.1.0)
100
86
  coffee-script (>= 2.2.0)
101
87
  railties (>= 4.0.0, < 5.0)
102
88
  coffee-script (2.3.0)
@@ -108,10 +94,6 @@ GEM
108
94
  debug_inspector (0.0.2)
109
95
  diff-lcs (1.2.5)
110
96
  docile (1.1.5)
111
- easy_translate (0.5.0)
112
- json
113
- thread
114
- thread_safe
115
97
  email_spec (1.6.0)
116
98
  launchy (~> 2.1)
117
99
  mail (~> 2.2)
@@ -135,9 +117,6 @@ GEM
135
117
  lumberjack (~> 1.0)
136
118
  pry (>= 0.9.12)
137
119
  thor (>= 0.18.1)
138
- guard-bundler (2.0.0)
139
- bundler (~> 1.0)
140
- guard (~> 2.2)
141
120
  guard-rails (0.7.0)
142
121
  guard (~> 2.0)
143
122
  guard-rspec (4.3.1)
@@ -145,21 +124,11 @@ GEM
145
124
  rspec (>= 2.14, < 4.0)
146
125
  haml (4.0.5)
147
126
  tilt
148
- highline (1.6.21)
149
127
  hike (1.2.3)
150
128
  hitimes (1.2.2)
151
129
  i18n (0.6.11)
152
130
  i18n-spec (0.6.0)
153
131
  iso
154
- i18n-tasks (0.7.8)
155
- activesupport
156
- easy_translate (>= 0.5.0)
157
- erubis
158
- highline
159
- i18n
160
- slop (>= 3.5.0)
161
- term-ansicolor
162
- terminal-table
163
132
  iso (0.2.1)
164
133
  i18n
165
134
  jquery-rails (3.1.2)
@@ -172,7 +141,7 @@ GEM
172
141
  launchy (2.4.3)
173
142
  addressable (~> 2.3)
174
143
  libv8 (3.16.14.3)
175
- listen (2.7.12)
144
+ listen (2.8.1)
176
145
  celluloid (>= 0.15.2)
177
146
  rb-fsevent (>= 0.9.3)
178
147
  rb-inotify (>= 0.9)
@@ -182,7 +151,7 @@ GEM
182
151
  method_source (0.8.2)
183
152
  mime-types (2.4.3)
184
153
  mini_portile (0.6.1)
185
- minitest (4.7.5)
154
+ minitest (5.4.3)
186
155
  multi_json (1.10.1)
187
156
  nokogiri (1.6.4.1)
188
157
  mini_portile (~> 0.6.0)
@@ -202,23 +171,31 @@ GEM
202
171
  rack (1.5.2)
203
172
  rack-test (0.6.2)
204
173
  rack (>= 1.0)
205
- rails (4.0.11)
206
- actionmailer (= 4.0.11)
207
- actionpack (= 4.0.11)
208
- activerecord (= 4.0.11)
209
- activesupport (= 4.0.11)
174
+ rails (4.1.8)
175
+ actionmailer (= 4.1.8)
176
+ actionpack (= 4.1.8)
177
+ actionview (= 4.1.8)
178
+ activemodel (= 4.1.8)
179
+ activerecord (= 4.1.8)
180
+ activesupport (= 4.1.8)
210
181
  bundler (>= 1.3.0, < 2.0)
211
- railties (= 4.0.11)
182
+ railties (= 4.1.8)
212
183
  sprockets-rails (~> 2.0)
213
184
  rails-i18n (4.0.3)
214
185
  i18n (~> 0.6)
215
186
  railties (~> 4.0)
216
- railties (4.0.11)
217
- actionpack (= 4.0.11)
218
- activesupport (= 4.0.11)
187
+ railties (4.1.8)
188
+ actionpack (= 4.1.8)
189
+ activesupport (= 4.1.8)
219
190
  rake (>= 0.8.7)
220
191
  thor (>= 0.18.1, < 2.0)
221
- rake (10.3.2)
192
+ rake (10.4.0)
193
+ ransack (1.5.1)
194
+ actionpack (>= 3.0)
195
+ activerecord (>= 3.0)
196
+ activesupport (>= 3.0)
197
+ i18n
198
+ polyamorous (~> 1.1)
222
199
  rb-fsevent (0.9.4)
223
200
  rb-inotify (0.9.5)
224
201
  ffi (>= 0.5.0)
@@ -262,25 +239,21 @@ GEM
262
239
  multi_json (~> 1.0)
263
240
  rack (~> 1.0)
264
241
  tilt (~> 1.1, != 1.3.0)
265
- sprockets-rails (2.2.0)
242
+ sprockets-rails (2.2.1)
266
243
  actionpack (>= 3.0)
267
244
  activesupport (>= 3.0)
268
245
  sprockets (>= 2.8, < 4.0)
269
246
  sqlite3 (1.3.10)
270
- term-ansicolor (1.3.0)
271
- tins (~> 1.0)
272
- terminal-table (1.4.5)
273
247
  therubyracer (0.12.1)
274
248
  libv8 (~> 3.16.14.0)
275
249
  ref
276
250
  thor (0.19.1)
277
- thread (0.1.4)
278
251
  thread_safe (0.3.4)
279
252
  tilt (1.4.1)
280
253
  timers (4.0.1)
281
254
  hitimes
282
- tins (1.3.3)
283
- tzinfo (0.3.42)
255
+ tzinfo (1.2.2)
256
+ thread_safe (~> 0.1)
284
257
  uglifier (2.5.3)
285
258
  execjs (>= 0.3.0)
286
259
  json (>= 1.8.0)
@@ -302,23 +275,17 @@ DEPENDENCIES
302
275
  capybara
303
276
  capybara-screenshot
304
277
  codeclimate-test-reporter
305
- coffee-rails
306
278
  database_cleaner
307
- db_fixtures_dump!
308
279
  email_spec
309
280
  factory_girl_rails
310
- guard-bundler
311
281
  guard-rails
312
282
  guard-rspec
313
283
  i18n-spec
314
- i18n-tasks
315
284
  libv8 (= 3.16.14.3)
316
285
  office_clerk!
317
286
  quiet_assets
318
- ransack!
319
287
  rb-readline
320
288
  rspec-rails
321
289
  sqlite3
322
290
  therubyracer
323
291
  uglifier (>= 1.3.0)
324
- valid_email
data/Guardfile ADDED
@@ -0,0 +1,28 @@
1
+ command = "rspec"
2
+ begin
3
+ require "rubygems"
4
+ require "spring/version" #safe to try
5
+ command = "spring rspec"
6
+ rescue LoadError
7
+ end
8
+ guard :rspec , :cmd => command do
9
+ watch(%r{^spec/.+_spec\.rb$})
10
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
11
+ watch('spec/spec_helper.rb') { "spec" }
12
+
13
+ # Rails example
14
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
15
+ watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
16
+ 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/acceptance/#{m[1]}_spec.rb"] }
17
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
18
+ watch('config/routes.rb') { "spec/routing" }
19
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
20
+
21
+ # Capybara features specs
22
+ watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
23
+
24
+ # Turnip features and steps
25
+ watch(%r{^spec/acceptance/(.+)\.feature$})
26
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
27
+ end
28
+
@@ -10,9 +10,13 @@ class AdminController < OfficeController
10
10
  def require_admin
11
11
  clerk = current_clerk
12
12
  return if clerk and clerk.admin
13
- redirect_to sign_in_url
13
+ redirect_to sign_in
14
14
  end
15
-
15
+
16
+ def sign_in
17
+ has_ssl? ? sign_in_path(:protocol => :https) : sign_in_url
18
+ end
19
+
16
20
  def clean_search
17
21
  q = params[:q]
18
22
  return unless q
@@ -27,6 +27,7 @@ class BasketsController < AdminController
27
27
  end
28
28
 
29
29
  def show
30
+ gon.basket_id = @basket.id
30
31
  end
31
32
 
32
33
  #as an action this order is meant as a verb, ie order this basket
@@ -150,7 +151,7 @@ class BasketsController < AdminController
150
151
  end
151
152
 
152
153
  def params_for_basket
153
- return if params[:basket].blank? or params[:basket].empty?
154
+ return {} if params[:basket].blank? or params[:basket].empty?
154
155
  params.require(:basket).permit( :items_attributes => [:quantity , :price , :id] )
155
156
  end
156
157
  end
@@ -64,7 +64,8 @@ class CategoriesController < AdminController
64
64
  end
65
65
 
66
66
  def params_for_model
67
- params.require(:category).permit(:category_id,:name,:link,:main_picture,:extra_picture,:position, :online, :description)
67
+ params.require(:category).permit(:category_id,:name,:link,:main_picture,:extra_picture,:position, :online,
68
+ :summary, :description)
68
69
  end
69
70
  end
70
71
 
@@ -42,6 +42,11 @@ class OfficeController < ApplicationController
42
42
  end
43
43
 
44
44
  private
45
+ def has_ssl?
46
+ return false unless Rails.env.production?
47
+ OfficeClerk.config(:has_ssl) == true
48
+ end
49
+
45
50
  # when the order is made and the basket locked, it's time to make a new one
46
51
  def new_basket
47
52
  session[:current_basket] = nil
@@ -66,7 +66,7 @@ class ProductsController < AdminController
66
66
  end
67
67
 
68
68
  def params_for_model
69
- params.require(:product).permit(:price,:cost,:weight,:name,:description, :online,
69
+ params.require(:product).permit(:price,:cost,:weight,:name,:description, :online, :summary,
70
70
  :link,:ean,:tax,:properties,:scode,:product_id,:category_id,:supplier_id, :main_picture,:extra_picture
71
71
  )
72
72
  end
@@ -1,6 +1,8 @@
1
1
  class SessionsController < OfficeController
2
2
  layout "sales_clerk"
3
3
 
4
+ force_ssl :if => :has_ssl?
5
+
4
6
  def sign_in
5
7
  end
6
8
 
@@ -32,6 +34,9 @@ class SessionsController < OfficeController
32
34
  end
33
35
  end
34
36
  end
37
+
38
+ private
39
+
35
40
  def params_for_clerk
36
41
  params.require(:clerk).permit(:email,:password,:password_confirmation)
37
42
  end
@@ -15,15 +15,4 @@ module ShopHelper
15
15
  prods.delete(product)
16
16
  prods.sample(get)
17
17
  end
18
-
19
- # a short version of a desciption text. now we use markdown and often have a bold "header"
20
- # so one can give a char sequence
21
- def short text , chop = "**"
22
- ind = text.index( chop , 10)
23
- if ind
24
- return text[0 .. ind + 1]
25
- else
26
- return text[0 .. 100]
27
- end
28
- end
29
18
  end