office_clerk 0.0.1 → 0.1

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +14 -9
  3. data/README.md +1 -0
  4. data/app/assets/images/shop/ikkuna.jpg +0 -0
  5. data/app/assets/images/shop/violetti-lev.jpg +0 -0
  6. data/app/assets/javascripts/admin.js +2 -2
  7. data/app/assets/javascripts/shop.js +2 -1
  8. data/app/assets/stylesheets/shop-receipt.css.scss +1 -1
  9. data/app/assets/stylesheets/shop.css.scss +52 -31
  10. data/app/controllers/application_controller.rb +11 -5
  11. data/app/controllers/baskets_controller.rb +3 -27
  12. data/app/controllers/categories_controller.rb +2 -1
  13. data/app/controllers/clerks_controller.rb +3 -8
  14. data/app/controllers/manage_controller.rb +7 -0
  15. data/app/controllers/orders_controller.rb +16 -2
  16. data/app/controllers/products_controller.rb +20 -40
  17. data/app/controllers/purchases_controller.rb +2 -1
  18. data/app/controllers/sessions_controller.rb +15 -22
  19. data/app/helpers/admin_helper.rb +6 -8
  20. data/app/helpers/orders_helper.rb +6 -0
  21. data/app/models/basket.rb +1 -2
  22. data/app/models/category.rb +2 -0
  23. data/app/models/product.rb +43 -17
  24. data/app/models/purchase.rb +7 -6
  25. data/app/views/baskets/edit.html.haml +6 -8
  26. data/app/views/baskets/show.html.haml +1 -1
  27. data/app/views/clerks/edit.html.haml +1 -1
  28. data/app/views/layouts/_admin_menu.html.haml +2 -0
  29. data/app/views/layouts/admin.html.haml +9 -4
  30. data/app/views/layouts/shop.html.haml +8 -5
  31. data/app/views/manage/all.haml +3 -0
  32. data/app/views/orders/ship.haml +91 -0
  33. data/app/views/orders/show.html.haml +12 -4
  34. data/app/views/products/_head.haml +12 -0
  35. data/app/views/products/_line.html.haml +4 -8
  36. data/app/views/products/_online.html.haml +1 -1
  37. data/app/views/products/edit.html.haml +1 -7
  38. data/app/views/products/index.html.haml +4 -1
  39. data/app/views/products/show.html.haml +4 -18
  40. data/app/views/purchases/show.html.haml +3 -3
  41. data/app/views/sessions/{new.html.haml → sign_in.haml} +1 -1
  42. data/app/views/sessions/{new_clerk.html.haml → sign_up.haml} +2 -2
  43. data/app/views/shop/checkout.haml +3 -3
  44. data/app/views/shop/liikkeemme.html.haml +59 -0
  45. data/app/views/shop/order.haml +20 -15
  46. data/app/views/shop/product_list.html.haml +16 -13
  47. data/app/views/shop/tilaushistoria.html.haml +221 -0
  48. data/app/views/shop/toimitusehdot.html.haml +99 -0
  49. data/config/locales/config.yml +2 -1
  50. data/config/locales/en.yml +4 -5
  51. data/config/locales/fi.yml +13 -6
  52. data/config/routes.rb +11 -12
  53. data/lib/office_clerk/shipping_method.rb +1 -1
  54. data/office_clerk.gemspec +1 -1
  55. data/spec/controllers/products_controller_spec.rb +3 -3
  56. data/spec/controllers/sessions_controller_spec.rb +11 -3
  57. data/spec/factories/orders.rb +7 -1
  58. data/spec/factories/products.rb +16 -0
  59. data/spec/factories/purchases.rb +8 -4
  60. data/spec/features/baskets/buttons_spec.rb +1 -2
  61. data/spec/features/baskets/index_spec.rb +10 -4
  62. data/spec/features/clerks_spec.rb +22 -6
  63. data/spec/features/orders_spec.rb +18 -0
  64. data/spec/features/products/edit_spec.rb +32 -0
  65. data/spec/features/products/header_spec.rb +48 -0
  66. data/spec/features/products/index_spec.rb +4 -18
  67. data/spec/features/purchases_spec.rb +19 -0
  68. data/spec/features/sessions_spec.rb +58 -0
  69. data/spec/features/shop_spec.rb +63 -0
  70. data/spec/features/suppliers_spec.rb +2 -0
  71. data/spec/models/product_spec.rb +54 -8
  72. data/spec/models/purchase_spec.rb +20 -1
  73. data/spec/models/shipping_spec.rb +25 -0
  74. metadata +22 -9
  75. data/app/views/products/_name.html.haml +0 -4
  76. data/spec/features/products/new_spec.rb +0 -20
  77. data/spec/features/shops_spec.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88f1e5f9c12249c9ad964adec5940713cfb69419
4
- data.tar.gz: 0125c7e1a20918192569fe08db7420e7a2772d38
3
+ metadata.gz: 80c600db3f486aa78978af20f03c4db991244347
4
+ data.tar.gz: 44db9c4bae59fc5b10fdc97d13b9256ec78e53f0
5
5
  SHA512:
6
- metadata.gz: 61ac0c3ec3cd94a38bdf5d9aa4a7b5b604c05a1f25111cc6fb82cfd168d36330c1cce46bd11c4f5f9658228e33269795f2fe40c5de80b57a80584d21ec915736
7
- data.tar.gz: 08145c33042db2e00ed140b279659c5127cda4364f69d5ba66a286ec072478024bebbeb39a0e41343e1370e2f2081e65f47ac0ac68cb29a392591a32ce344bbd
6
+ metadata.gz: 0f10654de1d7f3ab735d07d1f10491ec41f2482aaca8fe92933616f0974c9e9f530c38d0e3fc9074dc8a63a910e10c5187bcbf08666e4e43c3c5f4e47da8d9af
7
+ data.tar.gz: c8d865084809f8fdb68a70c497945bf0ba7d32faed891b103b48f2c4a88911a55ba3ebf22380af18b5a5d6e3b50022a964d5784e5a26fa4e1c6cd360a25e6b8d
data/Gemfile.lock CHANGED
@@ -12,9 +12,11 @@ GIT
12
12
 
13
13
  GIT
14
14
  remote: git://github.com/rubyclerks/accountant_clerk.git
15
- revision: a9ef40d1a4b56364240416ff17e2c45b24df67b2
15
+ revision: 180a37904680284caf2fe4d37c739f69fa76f621
16
16
  specs:
17
- accountant_clerk (0.1)
17
+ accountant_clerk (0.2)
18
+ flot-rails (~> 0.0.6)
19
+ office_clerk (~> 0.1)
18
20
 
19
21
  GIT
20
22
  remote: git://github.com/rubyclerks/db_fixtures_dump.git
@@ -24,21 +26,22 @@ GIT
24
26
 
25
27
  GIT
26
28
  remote: git://github.com/rubyclerks/post_clerk.git
27
- revision: ceca98ccf99bd54ad9119fa4f1fffb1a54aa5910
29
+ revision: e8933edc2ecf62eed79417f7db92e5f5c1ace53e
28
30
  specs:
29
- post_clerk (0.0.1)
30
- office_clerk (~> 0.0.1)
31
+ post_clerk (0.4)
32
+ office_clerk (~> 0.1)
31
33
 
32
34
  GIT
33
35
  remote: git://github.com/rubyclerks/print_clerk.git
34
- revision: 485dfc1f1e77081575a77afa6972af2b5b492183
36
+ revision: c73c5f7bcb7f0af73b37bc627fa2d0fa0faee6f0
35
37
  specs:
36
- print_clerk (0.1)
38
+ print_clerk (0.2)
39
+ office_clerk (~> 0.1)
37
40
 
38
41
  PATH
39
42
  remote: .
40
43
  specs:
41
- office_clerk (0.0.1)
44
+ office_clerk (0.1)
42
45
  barby
43
46
  bcrypt-ruby
44
47
  bootstrap-sass (~> 3.1.0)
@@ -148,6 +151,8 @@ GEM
148
151
  factory_girl (~> 4.5.0)
149
152
  railties (>= 3.0.0)
150
153
  ffi (1.9.6)
154
+ flot-rails (0.0.6)
155
+ jquery-rails
151
156
  formatador (0.2.5)
152
157
  guard (2.8.0)
153
158
  formatador (>= 0.2.4)
@@ -313,7 +318,7 @@ GEM
313
318
  hitimes
314
319
  tins (1.3.3)
315
320
  ttfunk (1.4.0)
316
- turbolinks (2.5.1)
321
+ turbolinks (2.5.2)
317
322
  coffee-rails
318
323
  tzinfo (0.3.42)
319
324
  uglifier (2.5.3)
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ## Office Clerk
2
2
  [![Build Status](https://travis-ci.org/rubyclerks/office_clerk.svg?branch=master)](https://travis-ci.org/rubyclerks/office_clerk)
3
+ [![Gem Version](https://badge.fury.io/rb/office_clerk.svg)](http://badge.fury.io/rb/office_clerk)
3
4
  [![Code Climate](https://codeclimate.com/github/rubyclerks/office_clerk/badges/gpa.svg)](https://codeclimate.com/github/rubyclerks/office_clerk)
4
5
  [![Test Coverage](https://codeclimate.com/github/rubyclerks/office_clerk/badges/coverage.svg)](https://codeclimate.com/github/rubyclerks/office_clerk)
5
6
 
Binary file
@@ -6,7 +6,7 @@
6
6
  //= require bootstrap
7
7
  //= require_self
8
8
 
9
- $.datepicker.setDefaults( $.datepicker.regional[ "fi" ] );
9
+ $.datepicker.setDefaults( $.datepicker.regional[ 'fi' ] );
10
10
 
11
11
  $(function() {
12
12
  $( ".datepicker" ).datepicker( );
@@ -14,7 +14,7 @@ $(function() {
14
14
 
15
15
  function initPage(){
16
16
  // Barcode
17
- $('.barcode').each(function(index){
17
+ $('.barcode').each(function(){
18
18
  $(this).barcode($(this).attr('data-barcode'), $(this).attr('data-type-barcode'));
19
19
  });
20
20
 
@@ -1,9 +1,10 @@
1
1
 
2
- //= require jquery
2
+ //= require jquery.min
3
3
  //= require jquery-ui
4
4
  //= require jquery_ujs
5
5
  //= require turbolinks
6
6
  //= require bootstrap
7
+ //= require bootstrap/dropdown
7
8
  //= require_self
8
9
 
9
10
  function shipmentSelected(){
@@ -27,7 +27,7 @@ div#header {
27
27
  .shop { font-weight: bold; font-size: 40px; line-height: 1.2;}
28
28
  .info { padding: 6px; font-size: 30px; text-align: center; line-height: 1.3; width: 700px;}
29
29
 
30
- .line_items {
30
+ .product_items {
31
31
  width: 700px;
32
32
  }
33
33
 
@@ -2,6 +2,7 @@
2
2
  // They will automatically be included in application.css.
3
3
  // You can use Sass (SCSS) here: http://sass-lang.com/
4
4
  /*
5
+ *= require_self
5
6
  *= require rails_bootstrap_forms
6
7
  */
7
8
 
@@ -91,7 +92,7 @@ ul.cat {
91
92
  color: #FFF;
92
93
  background: black;
93
94
  /* fallback color */
94
- background: rgba(3, 142, 235, 0.25);
95
+ background: rgba(8, 106, 212, 0.54);
95
96
  text-shadow: black 1px 1px 03px;
96
97
  margin: 0px;
97
98
  width: 100%;
@@ -157,51 +158,54 @@ text-shadow: rgb(255, 255, 255) 0px 0px 10px;
157
158
  margin-bottom: 12px;
158
159
  }
159
160
 
161
+ .product-listing {
162
+ width: 870px;
163
+ }
164
+
160
165
  .product-container {
161
166
  margin-bottom: 31px;
162
- padding: 0 0 86px;
163
- text-align: center;
164
167
  position: relative;
165
168
  border: 1px solid #cae3fb;
166
169
  box-shadow: 2px 2px 5px #E8EDF0;
167
- border-radius: 4px;
168
- height: 375px;
169
- width: 185px;
170
+ overflow: hidden;
170
171
  }
171
172
 
173
+ .product-container h4 {
174
+ position: absolute;
175
+ left: 0;
176
+ padding: 10px;
177
+ color: $highlight;
178
+ font-size: 1.5rem;
179
+ background: black;
180
+ /* fallback color */
181
+ background: rgba(3, 142, 235, 0.12);
182
+ margin: 0px;
183
+ width: 100%;
184
+ z-index: 1;
185
+ }
172
186
 
173
187
  .square-image {
174
- height: 200px;}
175
-
188
+ height: 200px;
189
+ }
176
190
 
177
191
  .square-image img {
178
- border-top-left-radius: 4px;
179
- border-top-right-radius: 4px;
180
- display: block;
181
- height: 190px;
182
- max-width: 100%;
183
- margin: auto;
184
- padding-top: 10px;
192
+ position: absolute;
193
+ bottom: 4px;
185
194
  }
186
195
 
187
-
188
-
189
196
  .product-fact {
190
- height: 49px;
191
- position: absolute;
192
- padding-right: 24px;
193
- padding-left: 24px;
194
- width: 100%;
195
- margin-bottom: 3px;
196
197
  border-top: 1px solid #0078ff;
197
- margin-right: 0;
198
- text-align: left;
199
- p {
198
+ background: rgba(255, 255, 255, 0.70);
199
+ padding: 5px 10px 0 5px;
200
+ position: relative;
201
+ top: 80px;
202
+ }
203
+
204
+ .product-fact p {
200
205
  font-size: 1.2rem;
201
206
  color: #000000;
202
207
  line-height: 110%;
203
208
  margin-bottom: 3px;
204
- }
205
209
  }
206
210
 
207
211
  h5.product-name {
@@ -209,6 +213,12 @@ h5.product-name {
209
213
  margin-bottom: 3px;
210
214
  }
211
215
 
216
+
217
+ h4.text {
218
+ font-size: 16px;
219
+ }
220
+
221
+
212
222
  h1.product-title {
213
223
  font-size: 2.3rem;
214
224
  color: $highlight;
@@ -229,8 +239,8 @@ h1.product-title {
229
239
 
230
240
  .price.selling {
231
241
  color: $highlight;
232
- font-weight: 300;
233
- font-size: 1.8rem;
242
+ font-weight: 400;
243
+ font-size: 2rem;
234
244
  text-align: right;
235
245
  }
236
246
 
@@ -321,7 +331,7 @@ body {
321
331
  }
322
332
 
323
333
  .taustalogo {
324
- background: url(/assets/shop/kansi.jpg) no-repeat scroll;
334
+ background: image-url("shop/kansi.jpg") no-repeat scroll;
325
335
  height: 107px;
326
336
  }
327
337
 
@@ -390,7 +400,6 @@ background-color: #0A6779; }
390
400
  background-color: $highlight-9;
391
401
  }
392
402
 
393
-
394
403
  .welcome {
395
404
  max-width: 92%;
396
405
  margin: 20px auto 0; }
@@ -401,3 +410,15 @@ background-color: #0A6779; }
401
410
  line-height: 1.33;
402
411
  border-radius: 6px;
403
412
  }
413
+
414
+ .dropdown-menu {
415
+ background-color: $highlight-2;
416
+ color: #ffffff;
417
+ }
418
+
419
+ .dropdown-menu > li > a {
420
+ color: #ffffff;
421
+ }
422
+
423
+ .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
424
+ background-color: $highlight-8; }
@@ -2,7 +2,7 @@ class ApplicationController < ActionController::Base
2
2
  # Prevent CSRF attacks by raising an exception.
3
3
  # For APIs, you may want to use :null_session instead.
4
4
  protect_from_forgery with: :exception
5
- helper_method :current_clerk , :current_basket
5
+ helper_method :current_clerk , :current_basket , :current_basket_or_nil
6
6
 
7
7
  # users are stored in the session by email
8
8
  # if user is not logged i , return nil
@@ -17,15 +17,20 @@ class ApplicationController < ActionController::Base
17
17
  redirect_to "/"
18
18
  end
19
19
 
20
+ def current_basket_or_nil
21
+ return @current_basket unless @current_basket.nil?
22
+ if session[:current_basket]
23
+ Basket.where( :id => session[:current_basket] ).limit(1).first
24
+ else
25
+ nil
26
+ end
27
+ end
20
28
  # the current user has a shopping basket which is also stored in the session
21
29
  # we *always* return a basket, even if we have to create one (and then store in the session)
22
30
  # this is not associated with the user until an order is finalized at which point the order gets the users email (not id)
23
31
  # that way people don't have to log in to order, but if they are we can retrieve their orders by email
24
32
  def current_basket
25
- return @current_basket unless @current_basket.nil?
26
- if session[:current_basket]
27
- @current_basket = Basket.where( :id => session[:current_basket] ).limit(1).first
28
- end
33
+ @current_basket = current_basket_or_nil
29
34
  if @current_basket.nil?
30
35
  @current_basket = Basket.new(:kori_type => "Order")
31
36
  @current_basket.save!
@@ -34,6 +39,7 @@ class ApplicationController < ActionController::Base
34
39
  @current_basket
35
40
  end
36
41
 
42
+ private
37
43
  # when the order is made and the basket locked, it's time to make a new one
38
44
  def new_basket
39
45
  session[:current_basket] = nil
@@ -18,19 +18,19 @@ class BasketsController < AdminController
18
18
  order = @basket.kori || Order.new( :basket => @basket )
19
19
  order.pos_checkout( current_clerk.email )
20
20
  order.save!
21
- redirect_to :action => :invoice , :controller => :orders , :id => order.id
21
+ redirect_to :action => :receipt , :controller => :orders , :id => order.id
22
22
  end
23
23
 
24
24
  def show
25
25
  end
26
26
 
27
- #as an action this order is mean as a verb, ie order this basket
27
+ #as an action this order is meant as a verb, ie order this basket
28
28
  def order
29
29
  if @basket.empty?
30
30
  render :edit , :notice => t(:basket_empty)
31
31
  return
32
32
  end
33
- order = Order.create! :basket => @basket , :email => current_clerk.email , :orderd_on => Date.today
33
+ order = Order.create! :basket => @basket , :email => current_clerk.email , :ordered_on => Date.today
34
34
  redirect_to :action => :show , :controller => :orders , :id => order.id
35
35
  end
36
36
 
@@ -124,30 +124,6 @@ class BasketsController < AdminController
124
124
  redirect_to baskets_url
125
125
  end
126
126
 
127
- def inventory
128
- if @order.state == "complete"
129
- flash[:error] = "Order was already completed (printed), please start with a new customer to add inventory"
130
- render :edit
131
- return
132
- end
133
- as = params[:as]
134
- num = 0
135
- prods = @order.basket.items.length
136
- @order.basket.items.each do |item |
137
- variant = item.variant
138
- num += item.quantity
139
- if as
140
- variant.on_hand = item.quantity
141
- else
142
- variant.on_hand += item.quantity
143
- end
144
- variant.save!
145
- end
146
- @order.basket.items.clear
147
- flash.notice = "Total of #{num} items #{as ? 'inventoried': 'added'} for #{prods} products "
148
- render :edit
149
- end
150
-
151
127
  private
152
128
 
153
129
  # check if the @basket is locked (no edits allowed)
@@ -26,7 +26,8 @@ class CategoriesController < AdminController
26
26
  def create
27
27
  @category = Category.create(params_for_model)
28
28
  if @category.save
29
- redirect_to category_path(@category), :notice => t(:create_success, :model => "category")
29
+ flash.notice = t(:create_success, :model => "category")
30
+ redirect_to category_path(@category)
30
31
  else
31
32
  render :edit
32
33
  end
@@ -9,7 +9,7 @@ class ClerksController < AdminController
9
9
  def index
10
10
  @q = Clerk.search params[:q]
11
11
  @clerk_scope = @q.result(:distinct => true)
12
- @clerks = @clerk_scope.paginate( :page => params[:page],:per_page => 20).to_a
12
+ @clerks = @clerk_scope.paginate( :page => params[:page],:per_page => 20)
13
13
  end
14
14
 
15
15
  def show
@@ -26,7 +26,8 @@ class ClerksController < AdminController
26
26
  def create
27
27
  @clerk = Clerk.create(params_for_model)
28
28
  if @clerk.save
29
- redirect_to clerk_path(@clerk), :notice => t(:create_success, :model => "clerk")
29
+ flash.notice = t(:create_success, :model => "clerk")
30
+ redirect_to clerk_path(@clerk)
30
31
  else
31
32
  render :edit
32
33
  end
@@ -45,12 +46,6 @@ class ClerksController < AdminController
45
46
  end
46
47
  end
47
48
 
48
- def destroy
49
- #should the whole method go ? probably
50
- #@clerk.destroy
51
- redirect_to clerks_url
52
- end
53
-
54
49
  private
55
50
 
56
51
  def load_clerk
@@ -0,0 +1,7 @@
1
+ # encoding : utf-8
2
+ class ManageController < AdminController
3
+
4
+
5
+ def all
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
1
  # encoding : utf-8
2
2
  class OrdersController < AdminController
3
3
 
4
- before_filter :load_order, :only => [:show, :edit, :update ]
4
+ before_filter :load_order, :only => [:show, :edit, :update , :pay , :ship]
5
5
 
6
6
  # Uncomment for check abilities with CanCan
7
7
  #authorize_resource
@@ -21,8 +21,22 @@ class OrdersController < AdminController
21
21
  render :edit
22
22
  end
23
23
 
24
+ def pay
25
+ @order.paid_on = Date.today
26
+ @order.save!
27
+ render :show
28
+ end
29
+ def ship
30
+ return if request.get?
31
+ order_ps = params.require(:order).permit( :email,:name , :street , :city , :phone , :shipment_type )
32
+ order_ps[:shipped_on] = Date.today
33
+ if @order.update_attributes(order_ps)
34
+ redirect_to order_path(@order), :notice => t(:OK)
35
+ return
36
+ end
37
+ end
38
+
24
39
  def edit
25
-
26
40
  end
27
41
 
28
42
  def create