office_clerk 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -2
- data/Gemfile.lock +159 -100
- data/Guardfile +3 -0
- data/README.md +7 -2
- data/Rakefile +9 -0
- data/app/assets/images/missing_list.png +0 -0
- data/app/assets/images/missing_product.png +0 -0
- data/app/assets/images/missing_thumb.png +0 -0
- data/app/assets/javascripts/office_clerk.js +7 -5
- data/app/assets/stylesheets/office_clerk.css.scss +89 -14
- data/app/controllers/baskets_controller.rb +37 -26
- data/app/controllers/orders_controller.rb +44 -29
- data/app/controllers/products_controller.rb +6 -6
- data/app/controllers/purchases_controller.rb +18 -8
- data/app/helpers/admin_helper.rb +16 -21
- data/app/helpers/baskets_helper.rb +31 -0
- data/app/helpers/categories_helper.rb +3 -0
- data/app/helpers/office_helper.rb +34 -7
- data/app/helpers/orders_helper.rb +2 -3
- data/app/models/basket.rb +46 -20
- data/app/models/clerk.rb +6 -1
- data/app/models/item.rb +7 -0
- data/app/models/order.rb +18 -6
- data/app/models/product.rb +23 -8
- data/app/views/addresses/show.html.haml +2 -2
- data/app/views/baskets/_small.html.haml +2 -2
- data/app/views/baskets/edit.html.haml +19 -16
- data/app/views/baskets/index.html.haml +13 -5
- data/app/views/baskets/show.html.haml +3 -3
- data/app/views/categories/_treeview.html.haml +1 -2
- data/app/views/categories/edit.html.haml +4 -5
- data/app/views/categories/index.html.haml +7 -7
- data/app/views/categories/show.html.haml +3 -4
- data/app/views/clerks/edit.html.haml +4 -3
- data/app/views/clerks/index.html.haml +6 -6
- data/app/views/clerks/show.html.haml +3 -3
- data/app/views/layouts/_admin_menu.html.haml +8 -8
- data/app/views/layouts/_messages.html.haml +2 -2
- data/app/views/layouts/office_clerk.haml +10 -27
- data/app/views/order_mailer/confirm.text.erb +1 -2
- data/app/views/order_mailer/shipped.text.erb +2 -1
- data/app/views/orders/index.csv.erb +6 -6
- data/app/views/orders/index.html.haml +25 -20
- data/app/views/orders/shipment.haml +57 -0
- data/app/views/orders/show.html.haml +106 -39
- data/app/views/products/_head.haml +1 -2
- data/app/views/products/_line.html.haml +1 -1
- data/app/views/products/_preview_box.haml +14 -10
- data/app/views/products/_triple.html.haml +1 -1
- data/app/views/products/edit.html.haml +4 -4
- data/app/views/products/index.html.haml +24 -13
- data/app/views/products/show.html.haml +15 -12
- data/app/views/purchases/index.html.haml +11 -7
- data/app/views/purchases/show.html.haml +42 -25
- data/app/views/sessions/sign_up.haml +10 -10
- data/app/views/suppliers/edit.html.haml +2 -2
- data/app/views/suppliers/index.html.haml +6 -7
- data/app/views/suppliers/show.html.haml +2 -3
- data/config/i18n-tasks.yml +97 -0
- data/config/initializers/migrate.rb +11 -1
- data/config/initializers/paperclip.rb +17 -0
- data/config/locales/config.yml +0 -1
- data/config/locales/en.yml +99 -116
- data/config/locales/fi.yml +101 -117
- data/config/routes.rb +18 -15
- data/db/migrate/20131226143612_categories.rb +2 -2
- data/db/migrate/20131226151332_products.rb +3 -3
- data/lib/office_clerk/engine.rb +5 -8
- data/lib/office_clerk/shipping_method.rb +12 -1
- data/lib/office_clerk/version.rb +1 -1
- data/office_clerk.gemspec +5 -5
- data/spec/controllers/baskets_controller_spec.rb +2 -2
- data/spec/controllers/orders_controller_spec.rb +0 -29
- data/spec/controllers/products_controller_spec.rb +4 -3
- data/spec/controllers/purchases_controller_spec.rb +3 -4
- data/spec/factories/orders.rb +6 -1
- data/spec/factories/products.rb +3 -0
- data/spec/features/baskets/edit_spec.rb +6 -1
- data/spec/features/baskets/index_spec.rb +1 -0
- data/spec/features/baskets/search_spec.rb +1 -1
- data/spec/features/orders/filter_spec.rb +19 -0
- data/spec/features/orders/inventory_spec.rb +19 -0
- data/spec/features/orders/ordering_spec.rb +84 -0
- data/spec/features/paginate_spec.rb +11 -0
- data/spec/features/sessions_spec.rb +2 -1
- data/spec/{models/locale_spec.rb → i18n_spec.rb} +19 -1
- data/spec/mailers/order_mailer_spec.rb +2 -1
- data/spec/models/baskets/inventory_spec.rb +9 -2
- data/spec/models/baskets/items_spec.rb +6 -1
- data/spec/models/order_spec.rb +20 -1
- data/spec/routing/baskets_routing_spec.rb +5 -1
- data/spec/routing/orders_routing_spec.rb +0 -12
- data/spec/spec_helper.rb +16 -3
- data/test_app/bin/setup +29 -0
- data/test_app/config/application.rb +3 -0
- data/test_app/config/boot.rb +1 -2
- data/test_app/config/environment.rb +1 -1
- data/test_app/config/environments/development.rb +1 -1
- data/test_app/config/environments/production.rb +20 -21
- data/test_app/config/environments/test.rb +7 -4
- data/test_app/config/initializers/assets.rb +11 -0
- data/test_app/config/initializers/cookies_serializer.rb +3 -0
- data/test_app/config/initializers/mime_types.rb +0 -1
- data/test_app/config/initializers/session_store.rb +1 -1
- data/test_app/config/routes.rb +1 -2
- data/test_app/config/secrets.yml +22 -0
- data/test_app/db/migrate/20141114205526_suppliers.office.rb +1 -1
- data/test_app/db/migrate/20141114205527_categories.office.rb +3 -3
- data/test_app/db/migrate/20141114205528_items.office.rb +1 -1
- data/test_app/db/migrate/20141114205529_orders.office.rb +1 -1
- data/test_app/db/migrate/20141114205530_baskets.office.rb +1 -1
- data/test_app/db/migrate/20141114205531_purchases.office.rb +1 -1
- data/test_app/db/migrate/20141114205532_products.office.rb +4 -4
- data/test_app/db/schema.rb +26 -26
- metadata +35 -28
- data/app/views/orders/edit.html.haml +0 -25
- data/app/views/orders/ship.haml +0 -91
- data/app/views/purchases/edit.html.haml +0 -9
- data/spec/features/orders_spec.rb +0 -37
@@ -1,25 +0,0 @@
|
|
1
|
-
%h2
|
2
|
-
= t params["action"]
|
3
|
-
= t(:order)
|
4
|
-
= bootstrap_form_for(@order) do |f|
|
5
|
-
.col-md-6
|
6
|
-
= f.date_field :ordered_on
|
7
|
-
.col-md-6
|
8
|
-
= f.text_field :shipment_price
|
9
|
-
.col-md-6
|
10
|
-
= f.text_field :shipment_tax
|
11
|
-
.col-md-6
|
12
|
-
= f.text_field :email
|
13
|
-
.col-md-6
|
14
|
-
= f.date_field :paid_on
|
15
|
-
.col-md-6
|
16
|
-
= f.date_field :shipped_on
|
17
|
-
.col-md-6
|
18
|
-
= f.date_field :paid_on
|
19
|
-
.col-md-6
|
20
|
-
= f.date_field :canceled_on
|
21
|
-
.col-md-6
|
22
|
-
= f.text_field :shipment_type
|
23
|
-
.form-actions
|
24
|
-
= f.submit :class => "btn btn-success"
|
25
|
-
= link_to t(:back), order_path(@order), :class => "btn btn-warning"
|
data/app/views/orders/ship.haml
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
= bootstrap_form_for @order, :url => ship_order_path do |f|
|
2
|
-
.row
|
3
|
-
= f.alert_message t(:fix_errors) , error_summary: false
|
4
|
-
|
5
|
-
.row
|
6
|
-
.col-md-3
|
7
|
-
%h4.highlight
|
8
|
-
Valitse toimitustapa
|
9
|
-
.row
|
10
|
-
.col-md-10
|
11
|
-
%br
|
12
|
-
- extra = OfficeClerk.config("defaults.free_shipping") - @order.basket.total_price
|
13
|
-
- if extra > 0
|
14
|
-
.frame.bg-high8
|
15
|
-
%b= t(:notice) + "!"
|
16
|
-
= t(:order_more_for_free_shipping , :more => extra.round(2))
|
17
|
-
|
18
|
-
.col-md-9
|
19
|
-
.row
|
20
|
-
.col-md-7
|
21
|
-
%h4
|
22
|
-
Valitse toimitustapa
|
23
|
-
= @order.shipment_type
|
24
|
-
- OfficeClerk::ShippingMethod.all.each_value do |s|
|
25
|
-
.radio
|
26
|
-
= radio_button_tag "order[shipment_type]" , s.type , s.type.to_s == @order.shipment_type , "data-price" => s.price_for(@order.basket).round(2)
|
27
|
-
= s.name
|
28
|
-
= s.price_for(@order.basket).round(2)
|
29
|
-
€
|
30
|
-
|
31
|
-
.col-md-4
|
32
|
-
%h4
|
33
|
-
= t(:order)
|
34
|
-
= @order.number
|
35
|
-
|
36
|
-
%table.table.table-condensed.basket-total
|
37
|
-
%thead
|
38
|
-
%tr
|
39
|
-
%th Tuotteet yhteensä
|
40
|
-
%td.text-right
|
41
|
-
%span#basket_total= @order.basket.total_price.round(2)
|
42
|
-
€
|
43
|
-
%tbody
|
44
|
-
%tr
|
45
|
-
%th Toimituskulut
|
46
|
-
%td.text-right
|
47
|
-
%span#shipping_cost= @order.shipment_price
|
48
|
-
€
|
49
|
-
%tr
|
50
|
-
%th Tilaus yhteensä
|
51
|
-
%th.text-right
|
52
|
-
%span#order_total= @order.total_price.round(2)
|
53
|
-
€
|
54
|
-
.col-md-1
|
55
|
-
|
56
|
-
|
57
|
-
.row
|
58
|
-
%hr
|
59
|
-
.col-md-3
|
60
|
-
.row
|
61
|
-
.col-md-9
|
62
|
-
%h4.highlight Anna yhteystiedot
|
63
|
-
%br/
|
64
|
-
|
65
|
-
%b Tallennetut osoitteet
|
66
|
-
|
67
|
-
.frame#previous_address
|
68
|
-
%span.name Anna Asiakas
|
69
|
-
%br/
|
70
|
-
%span.street Mallikatu 3
|
71
|
-
%br/
|
72
|
-
%span.city 10300 Karjaa
|
73
|
-
%br/
|
74
|
-
%span.phone 040 333 4455
|
75
|
-
%br/
|
76
|
-
%br/
|
77
|
-
%button.btn.btn-primary.btn-xs#fill_address{:type => "button"} Käytä tätä osoitetta
|
78
|
-
|
79
|
-
.col-md-9
|
80
|
-
.row
|
81
|
-
.col-md-9#address_form
|
82
|
-
%h4 Yhteystiedot
|
83
|
-
= f.text_field :name , :placeholder => t(:name)
|
84
|
-
= f.text_field :street , :placeholder => t(:street)
|
85
|
-
= f.text_field :city , :placeholder => t(:city)
|
86
|
-
= f.text_field :phone , :placeholder => t(:phone)
|
87
|
-
= f.email_field :email, :placeholder => t(:email)
|
88
|
-
%hr
|
89
|
-
%button.btn.btn-primary.btn-lg#make_order{:type => "submit"} Tee tilaus
|
90
|
-
|
91
|
-
.col-md-3
|
@@ -1,9 +0,0 @@
|
|
1
|
-
%h2
|
2
|
-
= t params["action"]
|
3
|
-
= t(:purchase)
|
4
|
-
= bootstrap_form_for(@purchase) do |f|
|
5
|
-
= f.test_field :name
|
6
|
-
= f.date_field :ordered_on
|
7
|
-
= f.date_field :received_on
|
8
|
-
= f.submit :class => "btn btn-success"
|
9
|
-
= link_to t(:back), purchases_path, :class => "btn btn-warning"
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Orders" do
|
4
|
-
before(:each) do
|
5
|
-
sign_in
|
6
|
-
end
|
7
|
-
it "lists orders" do
|
8
|
-
visit_path orders_path
|
9
|
-
end
|
10
|
-
it "should render" do
|
11
|
-
order = create :order
|
12
|
-
visit_path order_path order
|
13
|
-
end
|
14
|
-
it "creates order from basket" do
|
15
|
-
basket = create(:basket_with_item)
|
16
|
-
visit_path edit_basket_path(basket)
|
17
|
-
find(".make_order").click
|
18
|
-
ensure_path order_path(basket.reload.kori)
|
19
|
-
end
|
20
|
-
it "orders a order" do
|
21
|
-
order = create(:order_ordered)
|
22
|
-
visit_path order_path(order)
|
23
|
-
find(".pay_now").click
|
24
|
-
end
|
25
|
-
it "inventories a order" do
|
26
|
-
order = create(:order_paid)
|
27
|
-
visit_path order_path(order)
|
28
|
-
start = order.basket.items.first.product.inventory
|
29
|
-
find(".ship_now").click
|
30
|
-
# expect(order.basket.items.first.product.inventory).to be order.basket.items.first.quantity
|
31
|
-
end
|
32
|
-
it "filters by email" do
|
33
|
-
order_ab :email =>[ "torsten@villataika.fi", "raisa@villataika.fi"]
|
34
|
-
fill_in("q[email_cont]" , :with => "torsten")
|
35
|
-
expect(order_count).to eq 1
|
36
|
-
end
|
37
|
-
end
|