office_clerk 0.7 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +11 -0
  3. data/Gemfile.lock +8 -8
  4. data/Guardfile +1 -0
  5. data/README.md +2 -2
  6. data/app/controllers/baskets_controller.rb +1 -1
  7. data/app/controllers/office_controller.rb +3 -43
  8. data/app/controllers/orders_controller.rb +1 -5
  9. data/app/controllers/sessions_controller.rb +14 -7
  10. data/app/helpers/admin_helper.rb +0 -1
  11. data/app/helpers/categories_helper.rb +11 -0
  12. data/app/helpers/office_helper.rb +43 -0
  13. data/app/helpers/orders_helper.rb +4 -0
  14. data/app/mailers/order_mailer.rb +14 -4
  15. data/app/models/clerk.rb +9 -2
  16. data/app/models/order.rb +4 -0
  17. data/app/views/baskets/edit.html.haml +2 -2
  18. data/app/views/categories/show.html.haml +1 -1
  19. data/app/views/layouts/_header_extra.haml +6 -5
  20. data/app/views/layouts/office_clerk.haml +8 -8
  21. data/app/views/order_mailer/_order.text.erb +24 -0
  22. data/app/views/order_mailer/cancel.text.erb +4 -18
  23. data/app/views/order_mailer/confirm.text.erb +7 -20
  24. data/app/views/order_mailer/paid.text.erb +3 -16
  25. data/app/views/order_mailer/shipped.text.erb +7 -13
  26. data/app/views/orders/index.html.haml +3 -3
  27. data/app/views/products/_preview_box.haml +11 -0
  28. data/app/views/products/show.html.haml +1 -1
  29. data/app/views/sessions/sign_in.haml +9 -9
  30. data/app/views/sessions/sign_up.haml +4 -16
  31. data/bin/rspec +4 -0
  32. data/bin/spring +1 -1
  33. data/config/locales/en.yml +3 -0
  34. data/config/locales/fi.yml +3 -0
  35. data/config/routes.rb +1 -15
  36. data/lib/office_clerk/engine.rb +10 -4
  37. data/lib/office_clerk/shipping_method.rb +5 -0
  38. data/lib/office_clerk/version.rb +1 -1
  39. data/office_clerk.gemspec +6 -6
  40. data/spec/controllers/sessions_controller_spec.rb +1 -1
  41. data/spec/features/orders_spec.rb +5 -0
  42. data/spec/features/sessions_spec.rb +3 -4
  43. data/spec/mailers/order_mailer_spec.rb +57 -14
  44. data/spec/models/clerk/email_spec.rb +4 -3
  45. data/spec/models/clerk/misc_spec.rb +19 -0
  46. data/spec/support/product_helper.rb +8 -0
  47. data/test_app/config/environments/development.rb +1 -1
  48. data/test_app/config/environments/test.rb +1 -1
  49. data/test_app/config/locales/config.yml +2 -0
  50. data/test_app/config/routes.rb +4 -1
  51. metadata +33 -21
  52. data/app/controllers/shop_controller.rb +0 -91
  53. data/app/helpers/shop_helper.rb +0 -18
  54. data/app/views/layouts/_google.haml +0 -8
  55. data/app/views/layouts/sales_clerk.haml +0 -10
  56. data/app/views/shop/_product_box.haml +0 -13
@@ -4,15 +4,15 @@
4
4
  %meta{:charset => "utf-8"}/
5
5
  %title Office Clerk
6
6
  %meta{:content => "Office Clerk", :name => "description"}
7
- = stylesheet_link_tag "office_clerk"
8
- = include_gon(:init => true)
7
+ = stylesheet_link_tag "office_clerk" , :media => :all
9
8
  = javascript_include_tag "office_clerk"
9
+ = include_gon(:init => true)
10
10
  = render "layouts/header_extra"
11
11
  = csrf_meta_tags
12
12
  = yield :head
13
13
  %body{:style => ""}
14
14
  .container-fluid
15
- %nav.navbar.navbar-default.navbar-fixed-top.navbar-inverse{role: "navigation"}
15
+ %nav.navbar.navbar-default.navbar-fixed-top.navbar-inverse.hidden-print{role: "navigation"}
16
16
  .navbar-header
17
17
  %ul.nav.navbar-nav
18
18
  %li
@@ -23,7 +23,7 @@
23
23
  %li= link_to t(:sign_out), sign_out_path
24
24
 
25
25
  - if not flash[:notice].blank? then
26
- .row.content
26
+ .row.content.hidden-print
27
27
  .col-md-12.alert
28
28
  .alert-notice.row
29
29
  .col-md-3
@@ -31,7 +31,7 @@
31
31
  .col-md-9
32
32
  .alert-message!= flash[:notice]
33
33
  - if not flash[:alert].blank? then
34
- .row.content
34
+ .row.content.hidden-print
35
35
  .col-md-12.alert
36
36
  .alert-error.row
37
37
  .col-md-3
@@ -44,6 +44,6 @@
44
44
 
45
45
  = yield
46
46
 
47
- .row
48
- .col-md-12
49
- %br
47
+ .row
48
+ .col-md-12
49
+ %br
@@ -0,0 +1,24 @@
1
+ ...............................................................................
2
+ Tilauksen tiedot
3
+ ...............................................................................
4
+
5
+ <% @order.basket.items.each do |item|%>
6
+ <%= item.quantity%> x <%=item.product.full_name%> á <%= euros(item.price) %> = <%= euros(item.total)%>
7
+ <%end%>
8
+
9
+ ...............................................................................
10
+
11
+ Välisumma: <%= euros(@order.basket.total_price) %>
12
+ Toimituskulut: <%= euros(@order.shipment_price)%>
13
+ <%@order.taxes.each do |tax , value| %>
14
+ <%=t(:vat) %><%=tax%>%: <%=euros(value)%>
15
+ <%end%>
16
+
17
+ Tilauksen loppusumma: <%= euros(@order.total_price)%>
18
+
19
+ ...............................................................................
20
+ Toimitusosoite:
21
+ <%=@order.name%>
22
+ <%=@order.street%>
23
+ <%=@order.city%>
24
+ ...............................................................................
@@ -1,24 +1,10 @@
1
1
  Hei,
2
2
 
3
- Tilauksesi R11111111 on peruttu NN.NN.2014.
3
+ Tilauksesi <%= @order.number %> on peruttu <%= date(@order.canceled_on) %>.
4
4
 
5
- ....................................................................
6
- Tilauksen tiedot
7
- ....................................................................
8
- Tasapainottava – Neem-Rhassoul shampoo 1 kpl á 13,20 € = 13,20 €
9
- Villiruusu Hiustenhoitoaine 1 kpl á 18,20 € = 18,20 €
10
- Päivittäin – Granaattiomenashampoo 2 kpl á 13,20 € = 26,40 €
11
- Intense Frangipani Deo Roll-on 1 kpl á 14,30 € = 14,30 €
12
- ....................................................................
13
- Välisumma: 72,10 €
14
- Toimituskulut: 7,30 €
15
- Tilauksen loppusumma: 79,40 €
16
- Alv 24% NN,NN €
17
- ....................................................................
18
- Toimitusosoite: Tiina Tilaaja, Kotikatu 3, 10470 Fiskars
19
- ....................................................................
5
+ <%=render :partial => "order_mailer/order"%>
20
6
 
7
+ Ystävällisin terveisin
21
8
 
22
- Kiitos tilauksestasi!
23
- Ystävällisin terveisin Auringosta Itään, Kuusta länteen
9
+ Auringosta Itään, Kuusta länteen
24
10
 
@@ -1,29 +1,16 @@
1
1
  Hei,
2
2
 
3
- Tilauksesi R11111111 on vastaanotettu NN.NN.2014.
3
+ Tilauksesi <%= @order.number %> on vastaanotettu <%= date(@order.ordered_on) %>.
4
4
  Tarkistathan että tiedot ovat oikein.
5
5
 
6
- ....................................................................
7
- Tilauksen tiedot
8
- ....................................................................
9
- <% @order.basket.items.each do |item|%>
10
- <%= item.product.full_name%>
11
- <%end%>
12
- Tasapainottava – Neem-Rhassoul shampoo 1 kpl á 13,20 € = 13,20 €
13
- Villiruusu Hiustenhoitoaine 1 kpl á 18,20 € = 18,20 €
14
- Päivittäin – Granaattiomenashampoo 2 kpl á 13,20 € = 26,40 €
15
- Intense Frangipani Deo Roll-on 1 kpl á 14,30 € = 14,30 €
16
- ....................................................................
17
- Välisumma: 72,10 €
18
- Toimituskulut: 7,30 €
19
- Tilauksen loppusumma: <%= @order.total_price%> €
20
- Alv 24% NN,NN €
21
- ....................................................................
22
- Toimitusosoite: Tiina Tilaaja, Kotikatu 3, 10470 Fiskars
23
- ....................................................................
6
+ <%=render :partial => "order_mailer/order"%>
7
+
24
8
  Maksutapa: Ennakkomaksu
9
+
25
10
  Tilauksesi lähetetään, kun olet maksanut sen ja maksusi on kirjautunut tilillemme.
26
- Tilinumero FI1017 4530 0013 2474, mainitse viestikentässä tilausnumerosi R111222333.
11
+ Tilinumero FI1017 4530 0013 2474, mainitse viestikentässä tilausnumerosi <%= @order.number %>
12
+ tai käytä <%=viite%>
13
+
27
14
  Kun maksusi on kirjautunut tilille, lähetämme tilaamasi tuotteet 1-3 arkipäivän kuluessa.
28
15
 
29
16
  Kiitos tilauksestasi!
@@ -1,23 +1,10 @@
1
1
  Hei,
2
2
 
3
- Tilauksesi R11111111 on kirjattu maksetuksi NN.NN.2014.
3
+ Tilauksesi <%= @order.number %> on kirjattu maksetuksi <%= date(@order.paid_on) %>.
4
+
4
5
  Tilaus postitetaan 1-3 arkipäivän kuluessa.
5
6
 
6
- ....................................................................
7
- Tilauksen tiedot
8
- ....................................................................
9
- Tasapainottava – Neem-Rhassoul shampoo 1 kpl
10
- Villiruusu Hiustenhoitoaine 1 kpl
11
- Päivittäin – Granaattiomenashampoo 2
12
- Intense Frangipani Deo Roll-on 1 kpl
13
- ....................................................................
14
- Välisumma: 72,10 €
15
- Toimituskulut: 7,30 €
16
- Tilauksen loppusumma: 79,40 €
17
- Alv 24% NN,NN €
18
- ....................................................................
19
- Toimitusosoite: Tiina Tilaaja, Kotikatu 3, 10470 Fiskars
20
- ....................................................................
7
+ <%=render :partial => "order_mailer/order"%>
21
8
 
22
9
  Kiitos tilauksestasi!
23
10
 
@@ -1,21 +1,15 @@
1
1
  Hyvä asiakkaamme,
2
2
 
3
- Tilauksesi R11111111 on postitettu NN.NN.2014.
4
- Postin seurantatunnus on JJFI000111222333444
5
-
6
- ....................................................................
7
- Tilauksen tiedot
8
- ....................................................................
9
- Tasapainottava – Neem-Rhassoul shampoo 1 kpl
10
- Villiruusu Hiustenhoitoaine 1 kpl
11
- Päivittäin – Granaattiomenashampoo 2
12
- Intense Frangipani Deo Roll-on 1 kpl
13
- ....................................................................
14
- Toimitusosoite: Tiina Tilaaja, Kotikatu 3, 10470 Fiskars
15
- ....................................................................
3
+ Tilauksesi <%= @order.number %> on postitettu <%= date(@order.shipped_on) %>.
16
4
 
5
+ <% unless @order.shipment_info.blank? %>
6
+ Postin seurantatunnus on <%=@order.shipment_info%>
7
+ <%end%>
8
+
9
+ <%=render :partial => "order_mailer/order"%>
17
10
 
18
11
  Kiitos tilauksestasi!
12
+
19
13
  Ystävällisin terveisin Auringosta Itään, Kuusta länteen
20
14
 
21
15
 
@@ -20,14 +20,14 @@
20
20
  %tbody
21
21
  - @orders.each do |order|
22
22
  %tr{:class => "line-#{cycle("1","2")}"}
23
- %td
23
+ %td.number
24
24
  = link_to order.number.to_s , order_path(order), :title => t(:show)
25
25
  -unless order.note.blank?
26
26
  %span.glyphicon.glyphicon-flag
27
27
  %td= date(order.ordered_on)
28
28
  %td= order.basket.items.length
29
29
  %td= link_to euros(order.total_price), basket_path(order.basket)
30
- %td= order.email
30
+ %td.email= order.email
31
31
  %td= date(order.paid_on)
32
32
  %td= date(order.shipped_on)
33
33
  .btn-toolbar
@@ -44,7 +44,7 @@
44
44
  %span.input-group-addon
45
45
  = f.radio_button :note_present , true
46
46
  .form-group
47
- = f.text_field(:email , :class => "form-control" , :placeholder => t(:email))
47
+ = f.text_field(:email_cont , :class => "form-control" , :placeholder => t(:email))
48
48
  .form-group
49
49
  .col-md-4
50
50
  = f.label(:total)
@@ -0,0 +1,11 @@
1
+ %h4.product-name
2
+ =product.name
3
+ .row
4
+ .col-md-4
5
+ .square-image
6
+ =image_tag product.main_picture.url
7
+ .col-md-8.bottom
8
+ .product-fact
9
+ %p= markdown product.summary
10
+ .price.selling
11
+ = euros product.price
@@ -58,7 +58,7 @@
58
58
  %b= t(:description) + " : "
59
59
  = in_place @product , :description , :as => :textarea
60
60
  .col-md-4
61
- =render :partial => "shop/product_box" , :locals => {:product => @product}
61
+ =render :partial => "products/preview_box" , :locals => {:product => @product}
62
62
  = markdown @product.description
63
63
  %br
64
64
  .row.product_show_row_buttons
@@ -1,10 +1,10 @@
1
- %h1= t(:sign_in)
2
- = form_tag office.create_session_path do
3
- %p
4
- = label_tag :email , t(:email)
5
- %br= text_field_tag :email, params[:email]
6
- %p
7
- = label_tag :password , t(:password)
8
- %br= password_field_tag :password
9
- %p.btn= submit_tag t(:sign_in)
1
+ .col-md-4
2
+ %h1= t(:sign_in)
3
+ = bootstrap_form_tag :url => office.create_session_path do |f|
4
+ .form_group
5
+ = f.text_field :email, value: params[:email] , :label => t(:email)
6
+ .form_group
7
+ = f.password_field :password , value: params[:password] , :label => t(:password)
8
+ .form_group
9
+ = f.submit t(:sign_in) , :class => "btn btn-info submit"
10
10
 
@@ -1,22 +1,10 @@
1
- %h1 Sign Up
1
+ %h1= t(:sign_up)
2
2
  = bootstrap_form_for @clerk , :url => sign_up_path do |f|
3
- - if @clerk.errors.any?
4
- .error_messages
5
- %h2 Form is invalid
6
- %ul
7
- - for message in @clerk.errors.full_messages
8
- %li= message
9
- %p
10
- = f.label :email
11
- %br/
3
+ .form_group
12
4
  = f.text_field :email
13
- %p
14
- = f.label :password
15
- %br/
5
+ .form_group
16
6
  = f.password_field :password
17
- %p
18
- = f.label :password_confirmation
19
- %br/
7
+ .form_group
20
8
  = f.password_field :password_confirmation
21
9
  %p.button= f.submit :class => "btn btn-info submit"
22
10
 
data/bin/rspec CHANGED
@@ -1,3 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path("../spring", __FILE__)
4
+ rescue LoadError
5
+ end
2
6
  require 'bundler/setup'
3
7
  load Gem.bin_path('rspec-core', 'rspec')
data/bin/spring CHANGED
@@ -7,7 +7,7 @@ unless defined?(Spring)
7
7
  require "rubygems"
8
8
  require "bundler"
9
9
 
10
- if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
10
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11
11
  ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
12
  ENV["GEM_HOME"] = ""
13
13
  Gem.paths = ENV
@@ -131,6 +131,7 @@ en:
131
131
  sign_out: Log out
132
132
  sign_up: Sign up
133
133
  signed_in: Logged in
134
+ signed_up: Signed up
134
135
  signed_out: Logged out
135
136
  state: State
136
137
  street: Street
@@ -189,6 +190,8 @@ en:
189
190
  note: Note
190
191
  email: Email
191
192
  ordered_on: Ordered on
193
+ password: Passord
194
+ password_confirmation: Password confirmation
192
195
  purchase:
193
196
  name: Name
194
197
  ordered_on: Ordered on
@@ -131,6 +131,7 @@ fi:
131
131
  sign_out: Kirjaudu ulos
132
132
  sign_up: Luo tili
133
133
  signed_in: Sisäänkirjautunut
134
+ signed_up: Tili luottu
134
135
  signed_out: Uloskirjautunut
135
136
  state: Tila
136
137
  street: Osoite
@@ -188,6 +189,8 @@ fi:
188
189
  canceled_on: Peruttu
189
190
  note: Muisti
190
191
  email: S-posti
192
+ password: Salasana
193
+ password_confirmation: Vahvista salasana
191
194
  ordered_on: Tilattu
192
195
  product:
193
196
  description: Kuvaus
data/config/routes.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  OfficeClerk::Engine.routes.draw do
2
2
 
3
- root :to => 'shop#group'
4
-
5
3
  get "sign_out" => "sessions#sign_out"
6
4
  get "sign_in" => "sessions#sign_in"
7
5
  post "create_session" => "sessions#create"
@@ -91,17 +89,5 @@ OfficeClerk::Engine.routes.draw do
91
89
  end
92
90
 
93
91
  match "manage/all" => "manage#all", :via => [:get, :post]
94
-
95
- #shop
96
- get 'group/:link' => 'shop#group', :as => :shop_group
97
- get 'prod/:link' => 'shop#product', :as => :shop_product
98
- get 'page/:id' => 'shop#page', :as => :shop_page
99
- match 'cart/add/:id' => 'shop#add', :as => :cart_add , :via => [:get,:post]
100
- get 'cart/remove/:id' => 'shop#remove', :as => :cart_remove
101
- get 'welcome' => 'shop#welcome', :as => :shop_welcome
102
- get 'cart/order/:id' => 'shop#order', :as => :shop_order
103
- match 'cart/checkout' => 'shop#checkout', :as => :shop_checkout , :via => [:get,:post]
104
-
105
- get "/404", :to => "application#error"
106
-
92
+
107
93
  end
@@ -1,3 +1,5 @@
1
+ require "best_in_place"
2
+
1
3
  module OfficeClerk
2
4
  class Engine < ::Rails::Engine
3
5
  engine_name "office"
@@ -11,12 +13,16 @@ module OfficeClerk
11
13
 
12
14
  I18n.enforce_available_locales = false
13
15
  I18n.default_locale = :fi
14
- config.after_initialize do
15
- end
16
16
  # for testing this makes engine factories available
17
17
  initializer "model_core.factories", :after => "factory_girl.set_factory_paths" do
18
- FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
19
- end
18
+ FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
19
+ end
20
+
21
+ # have to init the BestInPlace first to be able to include helpers
22
+ config.railties_order = [BestInPlace::Railtie , OfficeClerk::Engine , :all ]
23
+ config.after_initialize do
24
+ BestInPlace::ViewHelpers.extend OfficeHelper
25
+ end
20
26
 
21
27
  config.paperclip_defaults = { :styles => {:thumb => '48x48>', :list => '150x150>', :product => '600x600>' },
22
28
  :default_style => :list,
@@ -27,6 +27,11 @@ module OfficeClerk
27
27
  end
28
28
  @@methods
29
29
  end
30
+ def self.method(name)
31
+ return self.all.values.first if name.nil?
32
+ m = self.all[name.to_sym]
33
+ m.blank? ? self.all.values.first : m
34
+ end
30
35
  end
31
36
  class Pickup < ShippingMethod
32
37
  def initialize data
@@ -1,3 +1,3 @@
1
1
  module OfficeClerk
2
- VERSION = "0.7"
2
+ VERSION = "0.8"
3
3
  end
data/office_clerk.gemspec CHANGED
@@ -23,17 +23,17 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.has_rdoc = false
25
25
 
26
- s.add_runtime_dependency 'rails', '~> 4.1', '<= 4.2'
27
- s.add_runtime_dependency "ransack" , '>= 1.5.1'
28
- s.add_runtime_dependency "valid_email"
26
+ s.add_runtime_dependency 'rails', '~> 4.1', '< 4.2'
27
+ s.add_runtime_dependency 'ransack', '~> 1.5', '>= 1.5.1'
28
+ s.add_runtime_dependency "valid_email" , '~> 0.0', '>= 0.0.10'
29
29
  s.add_runtime_dependency 'sass-rails' , '~> 4.0'
30
30
  s.add_runtime_dependency "haml" , '~> 4.0'
31
31
  s.add_runtime_dependency "jquery-rails" , '~> 3.1'
32
- s.add_runtime_dependency 'coffee-rails'
33
- s.add_runtime_dependency 'gon'
32
+ s.add_runtime_dependency 'coffee-rails' , '~> 4.0'
33
+ s.add_runtime_dependency 'gon' , '~> 5.2'
34
34
  s.add_runtime_dependency 'jquery-ui-rails' , '~> 5.0'
35
35
  s.add_runtime_dependency "kramdown" , '~> 1.5'
36
- s.add_runtime_dependency "best_in_place"
36
+ s.add_runtime_dependency "best_in_place" , '~> 0'
37
37
 
38
38
  s.add_runtime_dependency 'will_paginate-bootstrap' , '~> 1.0'
39
39
  s.add_runtime_dependency 'bootstrap-sass', '~> 3.1'