office_clerk 0.0.1 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -3,7 +3,7 @@
3
3
  /[if IE 7 ] <html class="ie ie7" lang="en">
4
4
  /[if IE 8 ] <html class="ie ie8" lang="en">
5
5
  /[if IE 9 ] <html class="ie ie9" lang="en">
6
- %html{lang: "fi"}
6
+ %html{lang: (I18n.locale || I18n.default_locale)}
7
7
  %head
8
8
  %meta{charset: "utf-8"}/
9
9
  %title Auringosta Itään, Kuusta Länteen
@@ -31,20 +31,23 @@
31
31
  Auringosta Itään, Kuusta Länteen
32
32
  %b.caret
33
33
  %ul.dropdown-menu
34
- %li Liikkeemme
35
- %li Toimitusehdot
34
+ %li{:role => "presentation"}
35
+ %a{:href => "/page/liikkeemme", :role => "menuitem", :tabindex => "-1"} Liikkeemme
36
+
37
+ %li{:role => "presentation"}
38
+ %a{:href => "/page/toimitusehdot", :role => "menuitem", :tabindex => "-1"} Toimitusehdot
36
39
 
37
40
  %li#link-to-cart{"data-no-turbolink" => true}
38
41
  %a{href: shop_checkout_path}
39
42
  = t(:basket)
40
- - if current_basket.items.count == 0
43
+ - if current_basket_or_nil.nil? or current_basket.items.count == 0
41
44
  = t(:empty)
42
45
  -else
43
46
  = current_basket.items.count
44
47
  = t(:items)
45
48
  %li.dropdown
46
49
  %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
47
- = current_clerk ? current_clerk.email : "Login"
50
+ = current_clerk ? current_clerk.email : t(:sign_in)
48
51
  %b.caret
49
52
  %ul.dropdown-menu
50
53
  - if current_clerk
@@ -0,0 +1,3 @@
1
+ Config
2
+
3
+ link to report
@@ -0,0 +1,91 @@
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
@@ -19,10 +19,17 @@
19
19
  .col-md-4
20
20
  %p
21
21
  %b
22
- = t(:paid_on) + " : " + date(@order.paid_on)
22
+ -if @order.paid_on
23
+ %b= t(:paid_on) + " : " + date(@order.paid_on)
24
+ -else
25
+ = link_to t(:paid), pay_order_path(@order), :class => "btn btn-info pay_now"
26
+
23
27
  %p
24
- %b
25
- = t(:shipped_on) + " : " + date(@order.shipped_on)
28
+ -if @order.shipped_on
29
+ %b
30
+ = t(:shipped_on) + " : " + date(@order.shipped_on)
31
+ -else
32
+ = link_to t(:ship), ship_order_path(@order), :class => "btn btn-info ship_now"
26
33
  %p
27
34
  %b
28
35
  = t(:canceled_on) + " : " + date(@order.canceled_on)
@@ -34,4 +41,5 @@
34
41
 
35
42
  .col-md-12{"data-no-turbolink" => true}
36
43
  = link_to t(:back), orders_path, :class => "btn btn-warning"
37
- = link_to t(:print), invoice_order_path(@order), :class => "btn btn-primary" , :target => "_blank"
44
+ - print_styles.each do |style|
45
+ = link_to t("print_" + style) , print_path(style), :class => "btn btn-primary" , :target => "_blank"
@@ -0,0 +1,12 @@
1
+ .row
2
+ .col-md-2
3
+ = t params["action"]
4
+ %h3= t @product.type
5
+ .col-md-10
6
+ %h3
7
+ - if @product.product_item?
8
+ = link_to @product.product.name , product_url(@product.product)
9
+ = @product.name
10
+ %small
11
+ = @product.online ? t(:online) : t(:not_online)
12
+
@@ -1,25 +1,21 @@
1
- %h2
2
- = t(:product_line)
3
- = @product.name
4
- = render "online" , :object => @product
5
1
  %table.table.table-bordered.table-condensed
6
2
  %tbody
7
3
  %tr.line-1
8
- %td=t("name")
4
+ %td=t(:name)
9
5
  - @product.products.each do |product|
10
6
  %td
11
7
  = image_tag product.main_picture.url(:thumb)
12
8
  =link_to product.name , product_path(product)
13
9
  %tr.line-2
14
- %td=t("price")
10
+ %td=t(:price)
15
11
  - @product.products.each do |product|
16
12
  %td=euros(product.price)
17
13
  %tr.line-1
18
14
  %td
19
- =t("inventory")
15
+ =t(:inventory)
20
16
  - @product.products.each do |product|
21
17
  %td=product.inventory
22
18
  %tr.line-2
23
- %td=t("ean")
19
+ %td=t(:ean)
24
20
  - @product.products.each do |product|
25
21
  %td=product.ean
@@ -1,2 +1,2 @@
1
1
  %small
2
- = object.online ? t(:online) : t(:not_online)
2
+ = object.online ? t(:online) : t(:not_online)
@@ -1,10 +1,4 @@
1
- %h2
2
- = t params["action"]
3
- -if @product.line?
4
- =t(:product_line)
5
- -else
6
- = t(:product)
7
- = @product.name.to_s
1
+ = render "head"
8
2
 
9
3
  .row
10
4
  = simple_form_for(@product, :html => { :multipart => true , :class => "form-horizontal" , :role=>"form"} ) do |f|
@@ -4,10 +4,13 @@
4
4
  .col-md-10
5
5
  %h2
6
6
  - if params[:basket]
7
+ %br
8
+ %br
9
+ %br
7
10
  = t(:choose_product_for_basket)
8
11
  -else
9
12
  = t(:products)
10
- = paginate @products
13
+ = paginate @products
11
14
  .col-md-2
12
15
  = link_to t(:new) + ' ' + t(:product) , new_product_path , :class => "btn btn-primary"
13
16
  .col-md-3
@@ -1,17 +1,8 @@
1
+ = render "head"
2
+
1
3
  -if @product.line?
2
4
  =render "line"
3
- -elsif @product.line_item?
4
- %h3
5
- = t(:product)
6
- = t(:product_line)
7
- = link_to @product.product.name , product_path( @product.product)
8
- = @product.name
9
- = render "online" , :object => @product
10
- -elsif
11
- %h3
12
- = t(:tuote)
13
- = @product.name
14
- = render "online" , :object => @product
5
+
15
6
  .row
16
7
  %br
17
8
  .col-md-6.tausta
@@ -79,14 +70,9 @@
79
70
  .row
80
71
  .col-md-2
81
72
  = link_to t(:edit), edit_product_path(@product), :class => "btn btn-success"
82
- .col-md-2
83
- = link_to t(:back), products_path, :class => "btn btn-warning"
84
73
  .col-md-2
85
74
  = link_to t(:delete) , delete_product_path(@product), :class => "btn btn-danger"
86
- -if @product.line_item?
87
- .col-md-2
88
- = link_to t(:to_product) , product_path( @product.product), :class => "btn btn-primary"
89
- -else
75
+ -unless @product.product_item?
90
76
  .col-md-2
91
77
  = link_to t(:new_item) , new_product_path( :parent_id => @product.id), :class => "btn btn-primary"
92
78
  -unless @product.line?
@@ -9,13 +9,13 @@
9
9
  -if @purchase.ordered_on
10
10
  = t(:ordered_on) + " : " + date(@purchase.ordered_on)
11
11
  -else
12
- = link_to t(:order) , order_purchase_path(@purchase) , :class => "btn btn-primary"
12
+ = link_to t(:order) , order_purchase_path(@purchase) , :class => "btn btn-primary order_link"
13
13
  %p
14
14
  %b
15
15
  -if @purchase.received_on
16
16
  = t(:received) + " : " + date(@purchase.received_on)
17
17
  -else
18
- = link_to t(:receive) , receive_purchase_path(@purchase) , :class => "btn btn-primary"
18
+ = link_to t(:receive) , receive_purchase_path(@purchase) , :class => "btn btn-primary receive_link"
19
19
 
20
20
  = render "baskets/small" , :basket => @purchase.basket
21
21
 
@@ -28,5 +28,5 @@
28
28
  -unless @purchase.received_on
29
29
  %h3{"style" => "color:red"}
30
30
  = t(:inventory)
31
- = link_to t(:inventory) , inventory_purchase_path(@purchase) , :class => "btn btn-primary"
31
+ = link_to t(:inventory) , inventory_purchase_path(@purchase) , :class => "btn btn-primary inventory_link", :data => { :confirm => t(:are_you_sure) }
32
32
 
@@ -1,5 +1,5 @@
1
1
  %h1= t(:sign_in)
2
- = form_tag sessions_path do
2
+ = form_tag create_session_path do
3
3
  %p
4
4
  = label_tag :email , t(:email)
5
5
  %br= text_field_tag :email, params[:email]
@@ -1,5 +1,5 @@
1
1
  %h1 Sign Up
2
- = form_for @clerk do |f|
2
+ = simple_form_for @clerk , :url => sign_up_path do |f|
3
3
  - if @clerk.errors.any?
4
4
  .error_messages
5
5
  %h2 Form is invalid
@@ -18,5 +18,5 @@
18
18
  = f.label :password_confirmation
19
19
  %br/
20
20
  = f.password_field :password_confirmation
21
- %p.button= f.submit
21
+ %p.button= f.submit :class => "btn btn-info submit"
22
22
 
@@ -25,7 +25,7 @@
25
25
  %tr
26
26
  %th tuote
27
27
  %th
28
- %th hinta a
28
+ %th hinta
29
29
  %th määrä
30
30
  %th yhteishinta
31
31
  %tbody
@@ -58,7 +58,7 @@
58
58
  %h4.highlight
59
59
  Valitse toimitustapa
60
60
  .row
61
- .col-md-9
61
+ .col-md-10
62
62
  %br
63
63
  - extra = OfficeClerk.config("defaults.free_shipping") - current_basket.total_price
64
64
  - if extra > 0
@@ -137,6 +137,6 @@
137
137
  = f.text_field :phone , :placeholder => t(:phone)
138
138
  = f.email_field :email, :placeholder => t(:email)
139
139
  %hr
140
- %button.btn.btn-primary.btn-lg{:type => "submit"} Tee tilaus
140
+ %button.btn.btn-primary.btn-lg#make_order{:type => "submit"} Tee tilaus
141
141
 
142
142
  .col-md-3
@@ -0,0 +1,59 @@
1
+ .row
2
+ %ol.breadcrumb
3
+ %li
4
+ %a{ :href => "/"}= t(:home)
5
+ %li
6
+ = t(:our_shop)
7
+
8
+ .row
9
+ .col-md-3
10
+ .group-wrapper.side.checkout
11
+ %img{:src => "/assets/shop/ikkuna.jpg"}/
12
+
13
+ .col-md-9
14
+ .row
15
+ %h3.highlight Auringosta itään, Kuusta länteen
16
+ %br/
17
+ %div{:style => "float:left; padding-bottom:60px"}
18
+ -# %img{:align => "left", :height => "275", :src => "/assets/store/kauppa/kauppa_net2-7f3764c7d512dea5783118497b5c9f7a.jpg", :width => "320"}/
19
+ %div
20
+ %b Auringosta itään, Kuusta länteen
21
+ on vuonna 1998 perustettu liike, joka tuo maahan omaa sisustus- ja vaatemallistoa Aasiasta ja Euroopasta.
22
+ %br/
23
+ %b Haluamme luoda ja tuoda asiakkaillemme kauneutta,
24
+ iloa ja hyvinvointia jota olemme maailmalla löytäneet. Kaikki liikkeemme tuotteet ovat omaa suunnittelua tai itse tuottajien luona valittuja. Näin tapaamme käyttämämme tuottajat, näemme että työ on laadukasta ja että työolot ovat hyvät.
25
+ %br/
26
+ %b Käymme reilua kauppaa.
27
+ Tunnemme henkilökohtaisesti tuottajat joilta ostamme, ja tuemme pieniä perheyrityksiä. Meille on tärkeää, että kaikille osapuolille – asiakkaalle, tuottajille ja myyjille – jää hyvä olo.
28
+ %br/
29
+ %b Näemme paljon vaivaa sen eteen,
30
+ että myymämme tuotteet olisivat kauniita ja ilahduttaisivat ihmisiä.
31
+ %br/
32
+ %br/
33
+ %b Yritysasiakkaille
34
+ meillä on myös tukku, löydät sen osoitteesta
35
+ = succeed "." do
36
+ %a{:href => "http://tukku.auringostaitaan.fi/"} tukku.auringostaitaan.fi
37
+ %br/
38
+
39
+ .row
40
+ %br/
41
+ .col-md-6
42
+ %b Liikkeemme sijaitsee Helsingin Viiskulmassa,
43
+ ja sinne pääsee helposti esimerkiksi raitiovaunuilla 3T ja 3B.
44
+ %br
45
+ %b Liike on avoinna arkisin klo 11—18 ja lauantaisin 11—15.
46
+ %br/
47
+ %h3.highlight
48
+ %i Tervetuloa!
49
+ %br/
50
+ %br/
51
+
52
+ %div.text-right
53
+ %a{:href => "http://maps.google.fi/maps?f=q&source=embed&hl=fi&geocode=&q=fredrikinkatu+19+helsinki&sll=62.593341,27.575684&sspn=18.659796,43.901367&ie=UTF8&hq=&hnear=Fredrikinkatu+19,+00120+Helsinki&ll=60.164871,24.942656&spn=0.01281,0.025749&z=14", :style => "color:#2E6AB1;text-align:left", :target => "_blank"} Näytä suurempi kartta
54
+
55
+ .col-md-6
56
+ %iframe{:align => "left", :frameborder => "0", :height => "300", :marginheight => "0", :marginwidth => "0", :scrolling => "no", :src => "http://maps.google.fi/maps?f=q&source=s_q&hl=fi&geocode=&q=fredrikinkatu+19+helsinki&sll=62.593341,27.575684&sspn=18.659796,43.901367&ie=UTF8&hq=&hnear=Fredrikinkatu+19,+00120+Helsinki&ll=60.164871,24.942656&spn=0.01281,0.025749&z=14&output=embed", :width => "300"}
57
+ %small
58
+
59
+
@@ -21,35 +21,40 @@
21
21
  00120 Helsinki
22
22
 
23
23
  %hr
24
- %b.highlight Kiitos tilauksestasi!
25
24
  .row
25
+
26
26
  .col-md-3.no-print
27
- .group-wrapper
27
+ .group-wrapper.side.checkout
28
28
  %img{:src => "/assets/shop/basket.jpg"}/
29
29
  %h5 Tilausvahvistus
30
30
 
31
31
  .col-md-9
32
32
  .row
33
33
  %br
34
- %h4.highlight Tilausvahvistus
35
- %b Tilaus
36
- =@order.number
37
- vastaanotettu
38
- =date(@order.ordered_on || Date.today)
39
- %hr
34
+ .row
35
+ .col-md-6
36
+ %i
37
+ %h4.highlight Kiitos tilauksestasi!
38
+ .col-md-6.text-right
39
+ %h4.highlight Tilausvahvistus
40
+ %b Tilaus
41
+ =@order.number
42
+ vastaanotettu
43
+ =date(@order.ordered_on || Date.today)
44
+ %br
40
45
  %div
41
46
  %table.table.table-condensed
42
47
  %thead
43
48
  %tr
44
- %th
45
- %th Tuote
49
+ %th tuote
50
+ %th
46
51
  %th hinta
47
52
  %th määrä
48
53
  %th yhteishinta
49
54
  %tbody
50
55
  -@order.basket.items.each do |item|
51
56
  %tr
52
- %td.picture= image_tag item.product.main_picture.url(:thumb) if item.product
57
+ %td.picture.text-center= image_tag item.product.main_picture.url(:thumb) if item.product
53
58
  %td.name
54
59
  = link_to shop_product_path(:link => item.product.link ) do
55
60
  = item.name
@@ -57,22 +62,22 @@
57
62
  %td= item.quantity
58
63
  %td= number_to_currency item.total
59
64
  %tr
65
+ %th
60
66
  %th Tuotteet yhteensä
61
67
  %th
62
68
  %th
63
- %th
64
69
  %th= number_to_currency @order.basket.total_price
65
70
  %tr
71
+ %td
66
72
  %td Toimituskulut
67
73
  %td
68
74
  %td
69
- %td
70
75
  %td= number_to_currency @order.shipment_price
71
76
  %tr
77
+ %th
72
78
  %th Tilaus yhteensä
73
79
  %th
74
80
  %th
75
- %th
76
81
  %th= number_to_currency @order.total_price
77
82
 
78
83
  %b
@@ -99,6 +104,6 @@
99
104
  .col-md-6
100
105
  %h4.highlight Tilaushistoria
101
106
  Aikaisemmat tilauksesi löydät täältä
102
- %a{:href => "/linkki_jonnekin"} clerk.auringostaitaan.fi/tilaushistoria
107
+ %a{:href => "/page/tilaushistoria"} clerk.auringostaitaan.fi/tilaushistoria
103
108
 
104
109