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.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -9
- data/README.md +1 -0
- data/app/assets/images/shop/ikkuna.jpg +0 -0
- data/app/assets/images/shop/violetti-lev.jpg +0 -0
- data/app/assets/javascripts/admin.js +2 -2
- data/app/assets/javascripts/shop.js +2 -1
- data/app/assets/stylesheets/shop-receipt.css.scss +1 -1
- data/app/assets/stylesheets/shop.css.scss +52 -31
- data/app/controllers/application_controller.rb +11 -5
- data/app/controllers/baskets_controller.rb +3 -27
- data/app/controllers/categories_controller.rb +2 -1
- data/app/controllers/clerks_controller.rb +3 -8
- data/app/controllers/manage_controller.rb +7 -0
- data/app/controllers/orders_controller.rb +16 -2
- data/app/controllers/products_controller.rb +20 -40
- data/app/controllers/purchases_controller.rb +2 -1
- data/app/controllers/sessions_controller.rb +15 -22
- data/app/helpers/admin_helper.rb +6 -8
- data/app/helpers/orders_helper.rb +6 -0
- data/app/models/basket.rb +1 -2
- data/app/models/category.rb +2 -0
- data/app/models/product.rb +43 -17
- data/app/models/purchase.rb +7 -6
- data/app/views/baskets/edit.html.haml +6 -8
- data/app/views/baskets/show.html.haml +1 -1
- data/app/views/clerks/edit.html.haml +1 -1
- data/app/views/layouts/_admin_menu.html.haml +2 -0
- data/app/views/layouts/admin.html.haml +9 -4
- data/app/views/layouts/shop.html.haml +8 -5
- data/app/views/manage/all.haml +3 -0
- data/app/views/orders/ship.haml +91 -0
- data/app/views/orders/show.html.haml +12 -4
- data/app/views/products/_head.haml +12 -0
- data/app/views/products/_line.html.haml +4 -8
- data/app/views/products/_online.html.haml +1 -1
- data/app/views/products/edit.html.haml +1 -7
- data/app/views/products/index.html.haml +4 -1
- data/app/views/products/show.html.haml +4 -18
- data/app/views/purchases/show.html.haml +3 -3
- data/app/views/sessions/{new.html.haml → sign_in.haml} +1 -1
- data/app/views/sessions/{new_clerk.html.haml → sign_up.haml} +2 -2
- data/app/views/shop/checkout.haml +3 -3
- data/app/views/shop/liikkeemme.html.haml +59 -0
- data/app/views/shop/order.haml +20 -15
- data/app/views/shop/product_list.html.haml +16 -13
- data/app/views/shop/tilaushistoria.html.haml +221 -0
- data/app/views/shop/toimitusehdot.html.haml +99 -0
- data/config/locales/config.yml +2 -1
- data/config/locales/en.yml +4 -5
- data/config/locales/fi.yml +13 -6
- data/config/routes.rb +11 -12
- data/lib/office_clerk/shipping_method.rb +1 -1
- data/office_clerk.gemspec +1 -1
- data/spec/controllers/products_controller_spec.rb +3 -3
- data/spec/controllers/sessions_controller_spec.rb +11 -3
- data/spec/factories/orders.rb +7 -1
- data/spec/factories/products.rb +16 -0
- data/spec/factories/purchases.rb +8 -4
- data/spec/features/baskets/buttons_spec.rb +1 -2
- data/spec/features/baskets/index_spec.rb +10 -4
- data/spec/features/clerks_spec.rb +22 -6
- data/spec/features/orders_spec.rb +18 -0
- data/spec/features/products/edit_spec.rb +32 -0
- data/spec/features/products/header_spec.rb +48 -0
- data/spec/features/products/index_spec.rb +4 -18
- data/spec/features/purchases_spec.rb +19 -0
- data/spec/features/sessions_spec.rb +58 -0
- data/spec/features/shop_spec.rb +63 -0
- data/spec/features/suppliers_spec.rb +2 -0
- data/spec/models/product_spec.rb +54 -8
- data/spec/models/purchase_spec.rb +20 -1
- data/spec/models/shipping_spec.rb +25 -0
- metadata +22 -9
- data/app/views/products/_name.html.haml +0 -4
- data/spec/features/products/new_spec.rb +0 -20
- data/spec/features/shops_spec.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80c600db3f486aa78978af20f03c4db991244347
|
4
|
+
data.tar.gz: 44db9c4bae59fc5b10fdc97d13b9256ec78e53f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
15
|
+
revision: 180a37904680284caf2fe4d37c739f69fa76f621
|
16
16
|
specs:
|
17
|
-
accountant_clerk (0.
|
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:
|
29
|
+
revision: e8933edc2ecf62eed79417f7db92e5f5c1ace53e
|
28
30
|
specs:
|
29
|
-
post_clerk (0.
|
30
|
-
office_clerk (~> 0.
|
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:
|
36
|
+
revision: c73c5f7bcb7f0af73b37bc627fa2d0fa0faee6f0
|
35
37
|
specs:
|
36
|
-
print_clerk (0.
|
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.
|
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.
|
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
|
[](https://travis-ci.org/rubyclerks/office_clerk)
|
3
|
+
[](http://badge.fury.io/rb/office_clerk)
|
3
4
|
[](https://codeclimate.com/github/rubyclerks/office_clerk)
|
4
5
|
[](https://codeclimate.com/github/rubyclerks/office_clerk)
|
5
6
|
|
Binary file
|
Binary file
|
@@ -6,7 +6,7 @@
|
|
6
6
|
//= require bootstrap
|
7
7
|
//= require_self
|
8
8
|
|
9
|
-
$.datepicker.setDefaults( $.datepicker.regional[
|
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(
|
17
|
+
$('.barcode').each(function(){
|
18
18
|
$(this).barcode($(this).attr('data-barcode'), $(this).attr('data-type-barcode'));
|
19
19
|
});
|
20
20
|
|
@@ -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(
|
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
|
-
|
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
|
-
|
179
|
-
|
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
|
-
|
198
|
-
|
199
|
-
|
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
|
-
|
233
|
-
|
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(
|
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
|
-
|
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 => :
|
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
|
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 , :
|
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
|
-
|
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)
|
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
|
-
|
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
|
@@ -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
|