office_clerk 0.4 → 0.5

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +11 -36
  3. data/LICENSE +22 -0
  4. data/app/assets/javascripts/office_clerk.js +0 -7
  5. data/app/assets/stylesheets/{office_clerk.scss → office_clerk.css.scss} +0 -0
  6. data/app/controllers/orders_controller.rb +10 -1
  7. data/app/controllers/products_controller.rb +2 -32
  8. data/app/controllers/shop_controller.rb +1 -0
  9. data/app/helpers/orders_helper.rb +6 -5
  10. data/app/helpers/shop_helper.rb +8 -7
  11. data/app/mailers/order_mailer.rb +19 -0
  12. data/app/views/addresses/_form_fields.html.haml +4 -4
  13. data/app/views/baskets/edit.html.haml +1 -1
  14. data/app/views/categories/edit.html.haml +22 -18
  15. data/app/views/clerks/edit.html.haml +6 -9
  16. data/app/views/layouts/office_clerk.haml +1 -0
  17. data/app/views/layouts/sales_clerk.haml +10 -0
  18. data/app/views/order_mailer/cancel.html.haml +6 -0
  19. data/app/views/order_mailer/confirm.html.haml +7 -0
  20. data/app/views/order_mailer/paid.html.haml +6 -0
  21. data/app/views/order_mailer/shipped.html.haml +6 -0
  22. data/app/views/orders/edit.html.haml +1 -1
  23. data/app/views/orders/show.html.haml +48 -44
  24. data/app/views/products/_head.haml +4 -2
  25. data/app/views/products/edit.html.haml +35 -24
  26. data/app/views/products/show.html.haml +32 -41
  27. data/app/views/purchases/edit.html.haml +4 -4
  28. data/app/views/sessions/sign_up.haml +1 -1
  29. data/app/views/shop/_product_box.haml +13 -0
  30. data/app/views/suppliers/edit.html.haml +2 -2
  31. data/bin/rails +3 -15
  32. data/config/environments/production.rb +2 -77
  33. data/config/locales/config.yml +1 -1
  34. data/config/locales/en.yml +75 -45
  35. data/config/locales/fi.yml +60 -67
  36. data/config/routes.rb +1 -1
  37. data/db/migrate/20131226143612_categories.rb +2 -1
  38. data/db/migrate/20131226151332_products.rb +2 -1
  39. data/lib/office_clerk.rb +2 -7
  40. data/lib/office_clerk/version.rb +1 -1
  41. data/lib/templates/haml/scaffold/_form.html.haml +1 -1
  42. data/office_clerk.gemspec +6 -12
  43. data/spec/features/products/edit_spec.rb +0 -4
  44. data/spec/mailers/order_mailer_spec.rb +24 -0
  45. data/spec/models/baskets/items_spec.rb +3 -3
  46. data/spec/models/locale_spec.rb +4 -0
  47. data/test_app/db/migrate/20141114205527_categories.office.rb +2 -2
  48. data/test_app/db/migrate/20141114205532_products.office.rb +2 -2
  49. data/test_app/db/schema.rb +4 -2
  50. data/todo +0 -4
  51. metadata +68 -111
  52. data/config/initializers/migrate.rb +0 -6
  53. data/config/initializers/simple_form.rb +0 -149
  54. data/config/initializers/simple_form_bootstrap.rb +0 -48
  55. data/db/seeds.rb +0 -4
  56. data/test/fixtures/baskets.yml +0 -41993
  57. data/test/fixtures/categories.yml +0 -638
  58. data/test/fixtures/clerks.yml +0 -694
  59. data/test/fixtures/items.yml +0 -83651
  60. data/test/fixtures/orders.yml +0 -58918
  61. data/test/fixtures/products.yml +0 -110904
  62. data/test/fixtures/purchases.yml +0 -1755
  63. data/test/fixtures/suppliers.yml +0 -341
@@ -0,0 +1,10 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{charset: "utf-8"}/
5
+ = csrf_meta_tags
6
+ %body
7
+ .container-fluid
8
+ .row
9
+ .col-md-12
10
+ = yield
@@ -0,0 +1,6 @@
1
+ Hi
2
+
3
+ we cancelled your order of
4
+ =@order.total_price
5
+
6
+
@@ -0,0 +1,7 @@
1
+ Hi
2
+
3
+ please pay the sum of
4
+ =@order.total_price
5
+
6
+ NOW
7
+
@@ -0,0 +1,6 @@
1
+ Hi
2
+
3
+ we received payment for
4
+ =@order.total_price
5
+
6
+
@@ -0,0 +1,6 @@
1
+ Hi
2
+
3
+ we shipped your order
4
+ =@order.total_price
5
+
6
+
@@ -1,7 +1,7 @@
1
1
  %h2
2
2
  = t params["action"]
3
3
  = t(:order)
4
- = simple_form_for(@order, :html => { :class => "form-horizontal" }) do |f|
4
+ = bootstrap_form_for(@order) do |f|
5
5
  .col-md-6
6
6
  = f.date_field :ordered_on
7
7
  .col-md-6
@@ -1,45 +1,49 @@
1
- %h2
2
- = t(:order) + " : " + @order.number.to_s
3
- .col-md-4
4
- %p
5
- %b
6
- = t(:ordered_on) + " : " + date(@order.ordered_on)
7
- %p
8
- %b
9
- = t(:total_price) + " : " + euros(@order.basket.total_price)
10
- %p
11
- %b
12
- = t(:total_tax) + " : " + euros(@order.basket.total_tax)
13
- %p
14
- %b
15
- = t(:shipment_price) + " : " + euros(@order.shipment_price)
16
- %p
17
- %b
18
- = t(:email) + " : " + @order.email.to_s
19
- .col-md-4
20
- %p
21
- %b
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
-
27
- %p
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"
33
- %p
34
- %b
35
- = t(:canceled_on) + " : " + date(@order.canceled_on)
36
- %p
37
- %b
38
- = t(:shipment_type) + " : " + @order.shipment_type.to_s
39
-
40
- = render "baskets/small" , :basket => @order.basket
1
+ .row
2
+ %h2
3
+ = t(:order) + " : " + @order.number.to_s
4
+ .row
5
+ .col-md-4
6
+ %p
7
+ %b
8
+ = t(:ordered_on) + " : " + date(@order.ordered_on)
9
+ %p
10
+ %b
11
+ = t(:total_price) + " : " + euros(@order.basket.total_price)
12
+ %p
13
+ %b
14
+ = t(:total_tax) + " : " + euros(@order.basket.total_tax)
15
+ %p
16
+ %b
17
+ = t(:shipment_price) + " : " + euros(@order.shipment_price)
18
+ %p
19
+ %b
20
+ = t(:email) + " : " + @order.email.to_s
21
+ .col-md-4
22
+ %p
23
+ %b
24
+ -if @order.paid_on
25
+ %b= t(:paid_on) + " : " + date(@order.paid_on)
26
+ -else
27
+ = link_to t(:paid), pay_order_path(@order), :class => "btn btn-info pay_now"
41
28
 
42
- .col-md-12
43
- = link_to t(:back), orders_path, :class => "btn btn-warning"
44
- - print_styles.each do |style|
45
- = link_to t("print_" + style) , print_path(style), :class => "btn btn-primary" , :target => "_blank"
29
+ %p
30
+ -if @order.shipped_on
31
+ %b
32
+ = t(:shipped_on) + " : " + date(@order.shipped_on)
33
+ -else
34
+ = link_to t(:ship), ship_order_path(@order), :class => "btn btn-info ship_now"
35
+ %p
36
+ %b
37
+ = t(:canceled_on) + " : " + date(@order.canceled_on)
38
+ %p
39
+ %b
40
+ = t(:shipment_type) + " : " + @order.shipment_type.to_s
41
+ .row
42
+ = render "baskets/small" , :basket => @order.basket
43
+ .row
44
+ .col-md-2
45
+ = link_to t(:back), orders_path, :class => "btn btn-warning"
46
+ .col-md-10
47
+ - mail_actions.each do |action|
48
+ = link_to t("#{action}_order_button") , mail_order_path( @order , :act => action) , :class => "btn btn-info"
49
+ .col-md-12.order_show_back
@@ -2,11 +2,13 @@
2
2
  .col-md-2
3
3
  = t params["action"]
4
4
  %h3= t @product.type
5
- .col-md-10
5
+ .col-md-6
6
6
  %h3
7
7
  - if @product.product_item?
8
8
  = link_to @product.product.name , product_url(@product.product)
9
9
  = @product.name
10
10
  %small
11
11
  = @product.online ? t(:online) : t(:not_online)
12
-
12
+ .col-md-4
13
+ %h2= t(:preview)
14
+
@@ -1,14 +1,18 @@
1
1
  = render "head"
2
2
 
3
- .row
4
- = simple_form_for(@product, :html => { :multipart => true , :class => "form-horizontal" , :role=>"form"} ) do |f|
5
- = f.hidden_field( :product_id) if @product.product_id
3
+ = bootstrap_form_for(@product, :html => { :multipart => true , :role=>"form"} ) do |f|
4
+ = f.hidden_field( :product_id) if @product.product_id
5
+ .row
6
6
  .col-md-8
7
7
  .row
8
- = f.input :name
9
- - unless @product.product_id
10
- = f.input :link
11
- = f.input :description, :as => :text , :input_html => {:rows => 10}
8
+ .col-md-6
9
+ = f.text_field :name
10
+ .col-md-6
11
+ - unless @product.product_id
12
+ = f.text_field :link
13
+ .row
14
+ .col-md-12
15
+ = f.text_area :description, :rows => 10
12
16
  .row
13
17
  .col-md-6
14
18
  = image_tag @product.main_picture.url(:list)
@@ -17,20 +21,27 @@
17
21
  = image_tag @product.extra_picture.url(:list)
18
22
  = f.file_field :extra_picture , :label => t(:extra_picture)
19
23
  .col-md-4
20
- = f.input :online
21
- = f.input :price
22
- = f.input :cost
23
- = f.input :weight
24
- = f.input :ean
25
- = f.input :tax
26
- = f.input :scode
27
- = f.input :supplier do
28
- = f.select :supplier_id, Supplier.all.order(:supplier_name).map { |c| [c.supplier_name, c.id ] }, :prompt => t(:select)
29
- = f.input :category do
30
- = f.select :category_id, Category.all.order(:name).map { |c| [c.name, c.id ] }, :prompt => t(:select)
31
- .form-actions
32
- = f.submit :class => "btn btn-success"
33
- -if @product.product_id
34
- = link_to t(:cancel), product_path(@product.product), :class => "btn btn-warning"
35
- -else
36
- = link_to t(:cancel), products_path, :class => "btn btn-warning"
24
+ .row
25
+ .col-md-12
26
+ = f.text_area :summary, :rows => 4
27
+ .col-md-6
28
+ = f.text_field :price
29
+ = f.text_field :cost
30
+ = f.text_field :scode
31
+ .col-md-6
32
+ = f.text_field :weight
33
+ = f.text_field :ean
34
+ = f.text_field :tax
35
+ .row
36
+ .col-md-6
37
+ = f.select :supplier_id, Supplier.all.order(:supplier_name).map { |c| [c.supplier_name, c.id ] }, :prompt => t(:select)
38
+ .col-md-6
39
+ = f.select :category_id , Category.all.order(:name).map { |c| [c.name, c.id ] }, :prompt => t(:select)
40
+ .col-md-4
41
+ = f.check_box :online
42
+ .col-md-8
43
+ = f.submit :class => "btn btn-success"
44
+ -if @product.product_id
45
+ = link_to t(:cancel), product_path(@product.product), :class => "btn btn-warning"
46
+ -else
47
+ = link_to t(:cancel), products_path, :class => "btn btn-warning"
@@ -5,69 +5,62 @@
5
5
 
6
6
  .row
7
7
  %br
8
- .col-md-6.tausta
9
- .row
8
+ .col-md-4
9
+ .row.tausta
10
10
  .col-md-6
11
11
  %p
12
- %b
13
- = t(:main_picture) + " : "
12
+ %b= t(:main_picture) + " : "
14
13
  %br
15
14
  = image_tag @product.main_picture.url
16
15
  .col-md-6
17
16
  %p
18
- %b
19
- = t(:extra_picture) + " : "
17
+ %b= t(:extra_picture) + " : "
20
18
  %br
21
19
  = image_tag @product.extra_picture.url
22
20
  .row
23
21
  .col-md-6
24
22
  %p
25
- %b
26
- = t(:price) + " : "
23
+ %b= t(:price) + " : "
27
24
  = euros(@product.price)
28
25
  %p
29
- %b
30
- = t(:cost) + " : "
26
+ %b= t(:cost) + " : "
31
27
  = euros(@product.cost)
32
28
  %p
33
- %b
34
- = t(:category) + " : "
29
+ %b= t(:category) + " : "
35
30
  = link_to @product.category.name ,category_path(@product.category) if @product.category
31
+ %p
32
+ %b= t(:link) + " : "
33
+ = @product.link
34
+ %p
35
+ %b= t(:ean) + " : "
36
+ = @product.ean
36
37
  .col-md-6
37
38
  %p
38
- %b
39
- = t(:weight) + " : "
39
+ %b= t(:weight) + " : "
40
40
  = @product.weight
41
41
  %p
42
- %b
43
- = t(:inventory) + " : "
42
+ %b= t(:inventory) + " : "
44
43
  = @product.inventory
45
44
  %p
46
- %b
47
- = t(:supplier) + " : "
45
+ %b= t(:supplier) + " : "
48
46
  = link_to @product.supplier.supplier_name ,supplier_path(@product.supplier) if @product.supplier
49
- .col-md-6
50
- %p
51
- %b
52
- = t(:description) + " : "
53
- = markdown @product.description
54
- %p
55
- %b
56
- = t(:link) + " : "
57
- = @product.link
58
- %p
59
- %b
60
- = t(:ean) + " : "
61
- = @product.ean
47
+ %p
48
+ %b= t(:scode) + " : "
49
+ = @product.scode
50
+ %p
51
+ %b= t(:tax_percent) + " : "
52
+ = @product.tax
53
+ .col-md-4
62
54
  %p
63
- %b
64
- = t(:scode) + " : "
65
- = @product.scode
55
+ %b= t(:summary) + " : "
56
+ = markdown @product.summary
66
57
  %p
67
- %b
68
- = t(:tax_percent) + " : "
69
- = @product.tax
70
- .row
58
+ %b= t(:description) + " : "
59
+ = markdown @product.description
60
+ .col-md-4
61
+ =render :partial => "shop/product_box" , :locals => {:product => @product}
62
+ %br
63
+ .row.product_show_row_buttons
71
64
  .col-md-2
72
65
  = link_to t(:edit), edit_product_path(@product), :class => "btn btn-success"
73
66
  .col-md-2
@@ -75,6 +68,4 @@
75
68
  -unless @product.product_item?
76
69
  .col-md-2
77
70
  = link_to t(:new_item) , new_product_path( :parent_id => @product.id), :class => "btn btn-primary"
78
- -unless @product.line?
79
- .col-md-2
80
- = link_to t(:barcode) , barcode_product_path( @product), :class => "btn btn-primary"
71
+ .col-md-6.product_show_row_end
@@ -1,9 +1,9 @@
1
1
  %h2
2
2
  = t params["action"]
3
3
  = t(:purchase)
4
- = simple_form_for(@purchase, :html => { :class => "form-horizontal" }) do |f|
5
- = f.input :name
6
- = f.input :ordered_on
7
- = f.input :received_on
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
8
  = f.submit :class => "btn btn-success"
9
9
  = link_to t(:back), purchases_path, :class => "btn btn-warning"
@@ -1,5 +1,5 @@
1
1
  %h1 Sign Up
2
- = simple_form_for @clerk , :url => sign_up_path do |f|
2
+ = bootstrap_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
@@ -0,0 +1,13 @@
1
+ =link_to shop_product_path(:link => product.link ) do
2
+ %h4.product-name
3
+ = product.name
4
+ .row
5
+ .col-md-4
6
+ .square-image
7
+ =image_tag product.main_picture.url
8
+ .col-md-8.bottom
9
+ .product-fact
10
+ = link_to shop_product_path( :link => product.link ) , :class => :info do
11
+ %p= markdown product.summary
12
+ .price.selling
13
+ = euros product.price
@@ -1,9 +1,9 @@
1
1
  %h2
2
2
  = t params["action"]
3
3
  = t(:supplier)
4
- = simple_form_for(@supplier) do |f|
4
+ = bootstrap_form_for(@supplier) do |f|
5
5
  .row
6
- = f.input :supplier_name
6
+ = f.text_field :supplier_name
7
7
  = render "addresses/form_fields" ,:f => f
8
8
  .form-actions
9
9
  = f.submit :class => "btn btn-success"
data/bin/rails CHANGED
@@ -1,16 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
-
4
- begin
5
- load File.expand_path("../spring", __FILE__)
6
- rescue LoadError
7
-
8
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
9
- ENGINE_PATH = File.expand_path('../../lib/office_clerk/engine', __FILE__)
10
-
11
- # Set up gems listed in the Gemfile.
12
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
13
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
14
-
15
- require 'rails/all'
16
- require 'rails/engine/commands'
2
+ APP_PATH = File.expand_path('../test_app/config/application', __FILE__)
3
+ require_relative '../test_app/config/boot'
4
+ require 'rails/commands'
@@ -1,80 +1,5 @@
1
- OfficeClerk::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
1
+ Rails.application.config do
3
2
 
4
- # Code is not reloaded between requests.
5
- config.cache_classes = true
3
+ config.assets.precompile += %w( office_clerk.js office_clerk.css)
6
4
 
7
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
9
- # and those relying on copy on write to perform better.
10
- # Rake tasks automatically ignore this option for performance.
11
- config.eager_load = true
12
-
13
- # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
24
-
25
- # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
27
- config.assets.css_compressor = :sass
28
-
29
- # Do not fallback to assets pipeline if a precompiled asset is missed.
30
- # config.assets.compile = true
31
-
32
- # Generate digests for assets URLs.
33
- config.assets.digest = true
34
-
35
- # Version of your assets, change this if you want to expire all your assets.
36
- config.assets.version = '1.0'
37
-
38
- # Specifies the header that your server uses for sending files.
39
- config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
-
42
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
- # config.force_ssl = true
44
-
45
- # Set to :debug to see everything in the log.
46
- config.log_level = :info
47
-
48
- # Prepend all log lines with the following tags.
49
- # config.log_tags = [ :subdomain, :uuid ]
50
-
51
- # Use a different logger for distributed setups.
52
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
-
54
- # Use a different cache store in production.
55
- # config.cache_store = :mem_cache_store
56
-
57
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
- # config.action_controller.asset_host = "http://assets.example.com"
59
-
60
- # Precompile additional assets.
61
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
- config.assets.precompile += %w( admin.js admin.css shop.js shop.css)
63
-
64
- # Ignore bad email addresses and do not raise email delivery errors.
65
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
- # config.action_mailer.raise_delivery_errors = false
67
-
68
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
- # the I18n.default_locale when a translation can not be found).
70
- #config.i18n.fallbacks = true
71
-
72
- # Send deprecation notices to registered listeners.
73
- config.active_support.deprecation = :notify
74
-
75
- # Disable automatic flushing of the log to improve performance.
76
- # config.autoflush_log = false
77
-
78
- # Use default logging formatter so that PID and timestamp are not suppressed.
79
- config.log_formatter = ::Logger::Formatter.new
80
5
  end