office_clerk 0.8 → 0.9

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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -2
  3. data/Gemfile.lock +159 -100
  4. data/Guardfile +3 -0
  5. data/README.md +7 -2
  6. data/Rakefile +9 -0
  7. data/app/assets/images/missing_list.png +0 -0
  8. data/app/assets/images/missing_product.png +0 -0
  9. data/app/assets/images/missing_thumb.png +0 -0
  10. data/app/assets/javascripts/office_clerk.js +7 -5
  11. data/app/assets/stylesheets/office_clerk.css.scss +89 -14
  12. data/app/controllers/baskets_controller.rb +37 -26
  13. data/app/controllers/orders_controller.rb +44 -29
  14. data/app/controllers/products_controller.rb +6 -6
  15. data/app/controllers/purchases_controller.rb +18 -8
  16. data/app/helpers/admin_helper.rb +16 -21
  17. data/app/helpers/baskets_helper.rb +31 -0
  18. data/app/helpers/categories_helper.rb +3 -0
  19. data/app/helpers/office_helper.rb +34 -7
  20. data/app/helpers/orders_helper.rb +2 -3
  21. data/app/models/basket.rb +46 -20
  22. data/app/models/clerk.rb +6 -1
  23. data/app/models/item.rb +7 -0
  24. data/app/models/order.rb +18 -6
  25. data/app/models/product.rb +23 -8
  26. data/app/views/addresses/show.html.haml +2 -2
  27. data/app/views/baskets/_small.html.haml +2 -2
  28. data/app/views/baskets/edit.html.haml +19 -16
  29. data/app/views/baskets/index.html.haml +13 -5
  30. data/app/views/baskets/show.html.haml +3 -3
  31. data/app/views/categories/_treeview.html.haml +1 -2
  32. data/app/views/categories/edit.html.haml +4 -5
  33. data/app/views/categories/index.html.haml +7 -7
  34. data/app/views/categories/show.html.haml +3 -4
  35. data/app/views/clerks/edit.html.haml +4 -3
  36. data/app/views/clerks/index.html.haml +6 -6
  37. data/app/views/clerks/show.html.haml +3 -3
  38. data/app/views/layouts/_admin_menu.html.haml +8 -8
  39. data/app/views/layouts/_messages.html.haml +2 -2
  40. data/app/views/layouts/office_clerk.haml +10 -27
  41. data/app/views/order_mailer/confirm.text.erb +1 -2
  42. data/app/views/order_mailer/shipped.text.erb +2 -1
  43. data/app/views/orders/index.csv.erb +6 -6
  44. data/app/views/orders/index.html.haml +25 -20
  45. data/app/views/orders/shipment.haml +57 -0
  46. data/app/views/orders/show.html.haml +106 -39
  47. data/app/views/products/_head.haml +1 -2
  48. data/app/views/products/_line.html.haml +1 -1
  49. data/app/views/products/_preview_box.haml +14 -10
  50. data/app/views/products/_triple.html.haml +1 -1
  51. data/app/views/products/edit.html.haml +4 -4
  52. data/app/views/products/index.html.haml +24 -13
  53. data/app/views/products/show.html.haml +15 -12
  54. data/app/views/purchases/index.html.haml +11 -7
  55. data/app/views/purchases/show.html.haml +42 -25
  56. data/app/views/sessions/sign_up.haml +10 -10
  57. data/app/views/suppliers/edit.html.haml +2 -2
  58. data/app/views/suppliers/index.html.haml +6 -7
  59. data/app/views/suppliers/show.html.haml +2 -3
  60. data/config/i18n-tasks.yml +97 -0
  61. data/config/initializers/migrate.rb +11 -1
  62. data/config/initializers/paperclip.rb +17 -0
  63. data/config/locales/config.yml +0 -1
  64. data/config/locales/en.yml +99 -116
  65. data/config/locales/fi.yml +101 -117
  66. data/config/routes.rb +18 -15
  67. data/db/migrate/20131226143612_categories.rb +2 -2
  68. data/db/migrate/20131226151332_products.rb +3 -3
  69. data/lib/office_clerk/engine.rb +5 -8
  70. data/lib/office_clerk/shipping_method.rb +12 -1
  71. data/lib/office_clerk/version.rb +1 -1
  72. data/office_clerk.gemspec +5 -5
  73. data/spec/controllers/baskets_controller_spec.rb +2 -2
  74. data/spec/controllers/orders_controller_spec.rb +0 -29
  75. data/spec/controllers/products_controller_spec.rb +4 -3
  76. data/spec/controllers/purchases_controller_spec.rb +3 -4
  77. data/spec/factories/orders.rb +6 -1
  78. data/spec/factories/products.rb +3 -0
  79. data/spec/features/baskets/edit_spec.rb +6 -1
  80. data/spec/features/baskets/index_spec.rb +1 -0
  81. data/spec/features/baskets/search_spec.rb +1 -1
  82. data/spec/features/orders/filter_spec.rb +19 -0
  83. data/spec/features/orders/inventory_spec.rb +19 -0
  84. data/spec/features/orders/ordering_spec.rb +84 -0
  85. data/spec/features/paginate_spec.rb +11 -0
  86. data/spec/features/sessions_spec.rb +2 -1
  87. data/spec/{models/locale_spec.rb → i18n_spec.rb} +19 -1
  88. data/spec/mailers/order_mailer_spec.rb +2 -1
  89. data/spec/models/baskets/inventory_spec.rb +9 -2
  90. data/spec/models/baskets/items_spec.rb +6 -1
  91. data/spec/models/order_spec.rb +20 -1
  92. data/spec/routing/baskets_routing_spec.rb +5 -1
  93. data/spec/routing/orders_routing_spec.rb +0 -12
  94. data/spec/spec_helper.rb +16 -3
  95. data/test_app/bin/setup +29 -0
  96. data/test_app/config/application.rb +3 -0
  97. data/test_app/config/boot.rb +1 -2
  98. data/test_app/config/environment.rb +1 -1
  99. data/test_app/config/environments/development.rb +1 -1
  100. data/test_app/config/environments/production.rb +20 -21
  101. data/test_app/config/environments/test.rb +7 -4
  102. data/test_app/config/initializers/assets.rb +11 -0
  103. data/test_app/config/initializers/cookies_serializer.rb +3 -0
  104. data/test_app/config/initializers/mime_types.rb +0 -1
  105. data/test_app/config/initializers/session_store.rb +1 -1
  106. data/test_app/config/routes.rb +1 -2
  107. data/test_app/config/secrets.yml +22 -0
  108. data/test_app/db/migrate/20141114205526_suppliers.office.rb +1 -1
  109. data/test_app/db/migrate/20141114205527_categories.office.rb +3 -3
  110. data/test_app/db/migrate/20141114205528_items.office.rb +1 -1
  111. data/test_app/db/migrate/20141114205529_orders.office.rb +1 -1
  112. data/test_app/db/migrate/20141114205530_baskets.office.rb +1 -1
  113. data/test_app/db/migrate/20141114205531_purchases.office.rb +1 -1
  114. data/test_app/db/migrate/20141114205532_products.office.rb +4 -4
  115. data/test_app/db/schema.rb +26 -26
  116. metadata +35 -28
  117. data/app/views/orders/edit.html.haml +0 -25
  118. data/app/views/orders/ship.haml +0 -91
  119. data/app/views/purchases/edit.html.haml +0 -9
  120. data/spec/features/orders_spec.rb +0 -37
data/app/models/item.rb CHANGED
@@ -18,6 +18,13 @@ class Item < ActiveRecord::Base
18
18
  self.quantity * single_item_tax
19
19
  end
20
20
 
21
+ # profit is off course the sale price minus the cost
22
+ # but . .. while the sale price is copied to the item and thus remains correct
23
+ # when the cost changes over time, so does this "profit".
24
+ def profit
25
+ (self.price - self.product.cost) * self.quantity
26
+ end
27
+
21
28
  #relation of price to product price down from 100 %
22
29
  def discount
23
30
  return 0 unless product.price and product.price != 0
data/app/models/order.rb CHANGED
@@ -1,16 +1,17 @@
1
1
  class Order < ActiveRecord::Base
2
- has_one :basket , :as => :kori , :autosave => true
2
+ has_one :basket , :as => :kori , :autosave => true , :dependent => :destroy
3
3
 
4
4
  store :address, accessors: [ :name , :street , :city , :phone ] #, coder: JSON
5
5
 
6
6
  after_validation :generate_order_number, :on => :create
7
+ validates :ordered_on, :presence => true
7
8
 
8
9
  validates :name, :presence => true , :if => :needs_address?
9
10
  validates :street,:presence => true , :if => :needs_address?
10
11
  validates :city, :presence => true , :if => :needs_address?
11
12
  validates :phone, :presence => true , :if => :needs_address?
12
13
  validates :email, :presence => true , :email => {:ban_disposable_email => true, :mx_with_fallback => true }
13
-
14
+
14
15
  default_scope { order('created_at DESC')}
15
16
 
16
17
  # many a european goverment requires buisnesses to have running order/transaction numbers.
@@ -35,7 +36,7 @@ class Order < ActiveRecord::Base
35
36
  basket.total_tax + shipment_tax_value
36
37
  end
37
38
 
38
- # return a hash of rate => amount , because products may have different taxes,
39
+ # return a hash of rate => amount , because products may have different taxes,
39
40
  # the items in an order may have a collection of tax rates.
40
41
  def taxes
41
42
  cart = basket.taxes
@@ -43,11 +44,21 @@ class Order < ActiveRecord::Base
43
44
  cart[self.shipment_tax] += shipment_tax_value if self.shipment_tax and self.shipment_tax != 0
44
45
  cart
45
46
  end
46
-
47
- def pay_now!
47
+
48
+ def pay_now
48
49
  self.paid_on = Date.today
49
- self.save!
50
50
  end
51
+ def ship_now
52
+ self.shipped_on = Date.today
53
+ end
54
+
55
+ # go back to edit mode, but return inventiry and zero shipped
56
+ def cancel!
57
+ self.shipped_on = nil
58
+ self.basket.cancel_order!
59
+ self.save
60
+ end
61
+
51
62
  #quick checkout, ie ship (hand over) and pay (externally)
52
63
  def pos_checkout email
53
64
  self.ordered_on = Date.today unless self.ordered_on
@@ -64,6 +75,7 @@ class Order < ActiveRecord::Base
64
75
  calc = OfficeClerk::ShippingMethod.all[typ.to_sym]
65
76
  cost = calc.price_for(self.basket)
66
77
  self.shipment_price = cost
78
+ self.shipment_tax = OfficeClerk.config("defaults.tax").to_f rescue 0
67
79
  end
68
80
 
69
81
  private
@@ -15,6 +15,7 @@
15
15
 
16
16
  class Product < ActiveRecord::Base
17
17
  has_many :products
18
+ has_many :items
18
19
  store :properties, accessors: [ :color, :size , :model_number ] #, coder: JSON
19
20
  belongs_to :product
20
21
  belongs_to :category
@@ -29,15 +30,17 @@ class Product < ActiveRecord::Base
29
30
  scope :online, -> { where(:online => true) }
30
31
  scope :no_items, -> { where(:product_id => nil) }
31
32
  scope :with_inventory, -> { where("inventory > 0") }
32
- scope :shop_products , -> { online.no_items.with_inventory }
33
+ # some shops may wish to add .with_inventory to the scope, but that means users can't see the page
34
+ # and for products you carry regularly that is not desirable. The Product page checks, and the controller
35
+ scope :shop_products , -> { online.no_items }
33
36
 
34
37
  validates :price, :numericality => true
35
38
  validates :cost, :numericality => true
36
39
  validates :name, :presence => true
37
- validates :deleted_on , :absence => true , :if => "inventory > 0"
40
+ validates :deleted_on , :absence => true , :if => :has_inventory?
38
41
 
39
42
  before_save :check_attributes
40
- before_save :adjust_cost
43
+ before_save :fix_cost
41
44
  after_save :update_line_inventory , :if => :product_id
42
45
  after_save :check_parent_ean , :if => :product_id
43
46
 
@@ -71,16 +74,17 @@ class Product < ActiveRecord::Base
71
74
  end
72
75
  end
73
76
 
74
- def adjust_cost
75
- if self.cost == 0.0
76
- self.cost = self.price / 2
77
- end
77
+ def has_inventory?
78
+ self.inventory > 0
78
79
  end
79
-
80
+ # has the product been deleted (marked as deleted)
80
81
  def deleted?
81
82
  not deleted_on.blank?
82
83
  end
83
84
 
85
+ # deleting sets the deleted_on flag to today
86
+ # Products can not be deleted because of the risk of invalidating old orders
87
+ # to actually remove a product from the db, use the console
84
88
  def delete
85
89
  self.deleted_on = Date.today
86
90
  self.link = ""
@@ -102,15 +106,19 @@ class Product < ActiveRecord::Base
102
106
  def line?
103
107
  !product_item? and !products.empty?
104
108
  end
109
+
105
110
  # this product is an item of a product line (so is sellable)
106
111
  def product_item?
107
112
  self.product_id != nil
108
113
  end
114
+
109
115
  # only products and product items are sellable. in other words if it's not a line
110
116
  def sellable?
111
117
  !line?
112
118
  end
113
119
 
120
+ # full name, or display name, is the name for a product,
121
+ # and the concatination of the parents name and the name, for product items
114
122
  def full_name
115
123
  if product_item?
116
124
  product.name + " : " + self.name
@@ -123,4 +131,11 @@ class Product < ActiveRecord::Base
123
131
  Product.new :tax => self.tax , :weight => self.weight , :cost => self.cost , :product_id => self.id ,
124
132
  :supplier_id => self.supplier_id , :category_id => self.category_id , :price => self.price
125
133
  end
134
+
135
+ private
136
+ def fix_cost
137
+ if self.cost == 0.0
138
+ self.cost = self.price / 2
139
+ end
140
+ end
126
141
  end
@@ -19,5 +19,5 @@
19
19
  %p
20
20
  %b
21
21
  = t(:country) + " : " + @address.country
22
- = link_to t(:edit), edit_address_path(@address), :class => "btn btn-success"
23
- = link_to t(:back), addresses_path, :class => "btn btn-warning"
22
+ = link_to t(:edit), office.edit_address_path(@address), :class => "btn btn-success"
23
+ = link_to t(:back), office.addresses_path, :class => "btn btn-warning"
@@ -10,7 +10,7 @@
10
10
  - basket.items.each do |item|
11
11
  %tr{:class => "line-#{cycle("1","2")}"}
12
12
  %td= image_tag item.product.main_picture.url(:thumb) if item.product
13
- %td=link_to_if item.product, item.name , product_path(item.product)
13
+ %td.name= link_to_if item.product, item.name , office.product_path(item.product)
14
14
  %td= item.quantity
15
15
  %td= euros item.price
16
16
  %tr
@@ -23,4 +23,4 @@
23
23
  %td
24
24
  = t(:total)
25
25
  = euros basket.total_price
26
- = yield :basket
26
+ = yield :basket
@@ -6,16 +6,16 @@
6
6
  .row
7
7
  .col-md-8.ean_form
8
8
  = label_tag :ean
9
- = form_tag ean_basket_path(@basket) do |f|
9
+ = form_tag office.ean_basket_path(@basket) do |f|
10
10
  = text_field_tag :ean , "" , :autofocus => true , :class => "ean_field" , :size => 45
11
11
  = submit_tag t(:search) , :class => "btn btn-xs ean_submit"
12
12
  .col-md-3
13
13
  = t(:discount )
14
- = form_tag edit_basket_path(@basket) , :method => :get do
15
- = select_tag("discount" , options_for_select( ["",0,5,10,15,20,25,30,35,40,50,60,70] ), :onchange => "window.location.href='#{discount_basket_path(@basket)}?discount=' + this.value")
14
+ = form_tag office.edit_basket_path(@basket) , :method => :get do
15
+ = select_tag("discount" , options_for_select( ["",0,5,10,15,20,25,30,35,40,50,60,70] ), :onchange => "window.location.href='#{office.discount_basket_path(@basket)}?discount=' + this.value")
16
16
  .row
17
- = form_for(@basket) do |f|
18
- %table.table.table-striped.table-bordered.table-condensed
17
+ = form_for(@basket , :url => office.basket_path(@basket) ) do |f|
18
+ %table.table.table-hover.table-condensed
19
19
  %thead
20
20
  %tr
21
21
  %th= t(:picture)
@@ -33,10 +33,10 @@
33
33
  %td= iform.text_field :quantity , :label => false
34
34
  %td= iform.text_field :price , :label => false
35
35
  %td
36
- = select_tag("discount" , options_for_select( [item.discount,0,5,10,15,20,25,30,35,40,50,60,70] ), :onchange => "window.location.href='#{discount_basket_path(@basket)}?item=#{item.id}&discount=' + this.value" )
36
+ = select_tag("discount" , options_for_select( [item.discount,0,5,10,15,20,25,30,35,40,50,60,70] ), :onchange => "window.location.href='#{office.discount_basket_path(@basket)}?item=#{item.id}&discount=' + this.value" )
37
37
  %td
38
- = link_to t(:delete) , edit_basket_path(:delete => item.product.id)
39
- = link_to t(:add) , edit_basket_path(:add => item.product.id)
38
+ = link_to t(:delete) , office.edit_basket_path(:delete => item.product.id)
39
+ = link_to t(:add) , office.edit_basket_path(:add => item.product.id)
40
40
 
41
41
  %tr
42
42
  %td{:colspan => 4}
@@ -53,20 +53,23 @@
53
53
  = f.submit :class => "btn btn-success commit"
54
54
  - if @basket.kori_type.blank? and not @basket.empty?
55
55
  .col-md-1
56
- = link_to t(:make_order), order_basket_path(@basket), :class => "btn btn-primary make_order"
56
+ = link_to t(:make_order), office.order_basket_path(@basket), :class => "btn btn-primary make_order"
57
57
  .col-md-2
58
- = link_to t(:make_purchase), purchase_basket_path(@basket), :class => "btn btn-primary make_purchase"
58
+ = link_to t(:make_purchase), office.purchase_basket_path(@basket), :class => "btn btn-primary make_purchase"
59
59
  .col-md-2
60
- = link_to t(:checkout), checkout_basket_path(@basket) , :class => "btn btn-primary print_order"
60
+ = link_to t(:checkout), office.checkout_basket_path(@basket) , :class => "btn btn-primary print_order"
61
61
  - elsif @basket.isa(:order)
62
62
  .col-md-2
63
- = link_to t(:to_order), order_path(@basket.kori), :class => "btn btn-primary to_order"
63
+ = link_to t(:to_order), office.order_path(@basket.kori), :class => "btn btn-primary to_order"
64
64
  .col-md-2
65
- = link_to t(:print_order), invoice_order_path(@basket.kori), :class => "btn btn-primary print_order"
65
+ - if has_receipt?
66
+ = link_to t("receipt.header"), office.receipt_order_path(@basket.kori), :class => "btn btn-primary print_order"
66
67
  - elsif @basket.isa(:purchase)
67
68
  .col-md-2
68
- = link_to t(:to_purchase), purchase_path(@basket.kori), :class => "btn btn-primary to_purchase"
69
+ = link_to t(:to_purchase), office.purchase_path(@basket.kori), :class => "btn btn-primary to_purchase"
69
70
  .col-md-2
70
- = link_to t(:destroy) , basket_path(@basket), :data => { :confirm => t(:are_you_sure )}, :method => :delete, :title => t(:destroy) , :class => "btn btn-danger" unless @basket.kori
71
+ = link_to t(:destroy) , office.basket_path(@basket), :confirm => t(:are_you_sure ), :method => :delete, :title => t(:destroy) , :class => "btn btn-danger" unless @basket.locked? or @basket.kori
72
+ .col-md-2
73
+ = link_to t(:nolla) , office.zero_basket_path(@basket), :class => "btn btn-danger" unless @basket.locked?
71
74
  .col-md-1
72
- = link_to t(:new) + ' ' + t(:basket) , new_basket_path , :class => "btn btn-primary"
75
+ = link_to t(:new) + ' ' + t(:basket) , office.new_basket_path , :class => "btn btn-primary"
@@ -14,8 +14,8 @@
14
14
  %table.table.table-striped.table-bordered.table-condensed
15
15
  %thead
16
16
  %tr
17
- %th= sort_link @q, :created_at
18
- %th= sort_link @q, :total_price
17
+ %th= sort_link [:office,@q], :created_at
18
+ %th= sort_link [:office,@q], :total_price
19
19
  %th= t(:items)
20
20
  %th
21
21
  %label.checkbox
@@ -36,14 +36,14 @@
36
36
  %td= basket_edit_link(basket)
37
37
  = paginate @baskets
38
38
  .col-md-3
39
- = search_form_for @q, :url => search_baskets_path, :html => { :class => "form-horizontal" }, :method => :post do |f|
39
+ = search_form_for @q, :url => office.search_baskets_path, :html => { :class => "form-horizontal" }, :method => :get do |f|
40
40
  .form-group.row
41
41
  .col-md-3
42
42
  = f.label(:type)
43
43
  .col-md-9
44
44
  = f.select :kori_type_eq, [["",""] , [t(:order) , "Order"] , [t(:purchase),"Purchase"]] , {}, :class => "form-control"
45
45
  .form-group
46
- = f.text_field :items_product_name_cont , :class => "form-control" , :placeholder => t(:name_contains)
46
+ = f.text_field :items_product_name_or_items_product_product_name_cont , :class => "form-control" , :placeholder => t(:product) + " " +t(:name_contains)
47
47
  .form-group.row
48
48
  .col-md-4
49
49
  = f.label(:total_price)
@@ -51,5 +51,13 @@
51
51
  = f.text_field :total_price_gt , :class => "form-control"
52
52
  .col-md-4
53
53
  = f.text_field :total_price_lt , :class => "form-control"
54
+ .form-group
55
+ .col-md-3
56
+ = f.label(:created_at)
57
+ .col-sm-1.radio
58
+ .form-group.col-md-6
59
+ = f.search_field :created_at_gteq , :class => "form-control datepicker" , :value => sort_date(:created_at_gteq)
60
+ .form-group.col-md-4
61
+ = f.search_field :created_at_lteq , :class => "form-control datepicker" , :value => sort_date(:created_at_lteq)
54
62
  = f.submit t(:filter), :class => "btn btn-success"
55
- = link_to t(:cancel), baskets_path, :class => "btn btn-warning"
63
+ = link_to t(:cancel), office.baskets_path, :class => "btn btn-warning"
@@ -1,5 +1,5 @@
1
1
  %h2
2
- = t(:basket) + " : "
2
+ = t(:basket) + " : "
3
3
  = t(:order) + " " + @basket.kori.number.to_s if @basket.isa(:order)
4
4
  .col-md-4
5
5
  %p
@@ -13,5 +13,5 @@
13
13
  = render "small" , :basket => @basket
14
14
 
15
15
  .col-md-12.basket_show_end
16
- = link_to t(:back), orders_path, :class => "btn btn-warning"
17
- = link_to t(:destroy) , basket_path(@basket), :data => { :confirm => t(:are_you_sure) }, :method => :delete, :title => t(:destroy) , :class => "btn btn-danger" unless @basket.kori_type
16
+ = link_to t(:back), office.orders_path, :class => "btn btn-warning"
17
+ = link_to t(:destroy) , office.basket_path(@basket), :data => { :confirm => t(:are_you_sure) }, :method => :delete, :title => t(:destroy) , :class => "btn btn-danger" if @basket.locked.blank?
@@ -1,8 +1,7 @@
1
1
  %li
2
- = link_to "#{group.name} (#{group.products.length})" , category_path(group), :title => t(:edit) , :class => group.online && "online"
2
+ = link_to "#{group.name} (#{group.products.length})" , office.category_path(group), :title => t(:edit) , :class => group.online && "online"
3
3
  - ar = group.categories
4
4
  -if ar.length > 0
5
5
  %ul.subcat
6
6
  - ar.each do |g|
7
7
  = render "treeview" , :group => g
8
-
@@ -5,11 +5,11 @@
5
5
  - parents(@category).each do | group|
6
6
  %li
7
7
  - if group.id
8
- = link_to group.name , category_path(group)
8
+ = link_to group.name , office.category_path(group)
9
9
  - else
10
10
  = t(:new)
11
-
12
- = bootstrap_form_for(@category, :html => { :multipart => true }) do |f|
11
+ - url = @category.persisted? ? office.category_path(@category) : office.categories_path
12
+ = bootstrap_form_for(@category, :html => { :multipart => true } , :url => url) do |f|
13
13
  .row.form-group
14
14
  .col-md-5
15
15
  = f.text_field :name
@@ -32,10 +32,9 @@
32
32
  = f.submit :class => "btn btn-success"
33
33
  %br
34
34
  %br
35
- = link_to t(:back), categories_path, :class => "btn btn-warning"
35
+ = link_to t(:back), office.categories_path, :class => "btn btn-warning"
36
36
  .row
37
37
  .col-md-4
38
38
  = f.file_field :main_picture
39
39
  .col-md-4
40
40
  = f.file_field :extra_picture
41
-
@@ -5,7 +5,7 @@
5
5
  %h2= t(:categories)
6
6
  = paginate @categories
7
7
  .col-md-2
8
- = link_to t(:new) + ' ' + t(:category) , new_category_path , :class => "btn btn-primary"
8
+ = link_to t(:new) + ' ' + t(:category) , office.new_category_path , :class => "btn btn-primary"
9
9
  .col-md-3
10
10
  = image_tag "office_clerk/categories.jpg" , :class => "img-responsive"
11
11
  .row
@@ -15,7 +15,7 @@
15
15
  %thead
16
16
  %tr
17
17
  %th=t( "picture")
18
- %th= sort_link @q, :name
18
+ %th= sort_link [:office,@q], :name
19
19
  %th= t(:count)
20
20
  %th= t(:online)
21
21
  %th=t( "activerecord.attributes.category.category")
@@ -26,14 +26,14 @@
26
26
  - @categories.each do |category|
27
27
  %tr{:class => "line-#{cycle("1","2")}"}
28
28
  %td.image= image_tag category.main_picture.url(:thumb)
29
- %td=link_to category.name, category_path(category), :title => t(:show) , :class => category.online && "online"
29
+ %td=link_to category.name, office.category_path(category), :title => t(:show) , :class => category.online && "online"
30
30
  %td=category.products.length.to_s
31
31
  %td=category.online ? t(:online) : t(:not_online)
32
- %td=link_to category.category.name, category_path(category.category) , :class => category.category.online && "online" if category.category
33
- %td= link_to t(:edit), edit_category_path(category), :title => t(:edit)
32
+ %td=link_to category.category.name, office.category_path(category.category) , :class => category.category.online && "online" if category.category
33
+ %td= link_to t(:edit), office.edit_category_path(category), :title => t(:edit)
34
34
  = paginate @categories
35
35
  .col-md-3
36
- = search_form_for @q, :url => search_categories_path, :html => { :class => "form-horizontal" }, :method => :post do |f|
36
+ = search_form_for @q, :url => office.search_categories_path, :html => { :class => "form-horizontal" }, :method => :get do |f|
37
37
  .form-group
38
38
  .input-group
39
39
  = f.text_field :name_cont , :class => "form-control" , :placeholder => t(:name)
@@ -53,7 +53,7 @@
53
53
  =t(:blanks)
54
54
  = f.radio_button :description_blank , true
55
55
  = f.submit t(:filter), :id => :filter , :class => "btn btn-success"
56
- = link_to t(:cancel), categories_path, :class => "btn btn-warning"
56
+ = link_to t(:cancel), office.categories_path, :class => "btn btn-warning"
57
57
  %hr
58
58
  - @roots.each do |group|
59
59
  %ul.cat
@@ -25,11 +25,10 @@
25
25
  %p
26
26
  = image_tag @category.extra_picture.url
27
27
 
28
- = link_to t(:edit), edit_category_path(@category), :class => "btn btn-primary"
29
- = link_to t(:back), categories_path, :class => "btn btn-primary"
28
+ = link_to t(:edit), office.edit_category_path(@category), :class => "btn btn-primary"
29
+ = link_to t(:back), office.categories_path, :class => "btn btn-primary"
30
30
  %b= t(:shop_link) + " : "
31
- = link_to @category.link , main_app.shop_group_path(@category.link)
31
+ = link_to @category.link , office.categories_path(@category.link)
32
32
 
33
33
  =render "triple" , :groups => @category.categories
34
34
  =render "products/triple" , :products => @category.products.no_items
35
-
@@ -2,8 +2,9 @@
2
2
  = t params["action"]
3
3
  = t(:clerk)
4
4
  -if @clerk.admin
5
- =t(:admin)
6
- = bootstrap_form_for(@clerk) do |f|
5
+ =t(:admin)
6
+ - url = @clerk.persisted? ? office.clerk_path(@clerk) : office.clerks_path
7
+ = bootstrap_form_for(@clerk, :url => url) do |f|
7
8
  .row
8
9
  = f.check_box :admin
9
10
  = f.email_field :email
@@ -14,4 +15,4 @@
14
15
  = f.password_field :password_confirmation
15
16
  .form-actions
16
17
  = f.submit :class => "btn btn-success" , :id => "submit"
17
- = link_to t(:back), clerks_path, :class => "btn btn-warning"
18
+ = link_to t(:back), office.clerks_path, :class => "btn btn-warning"
@@ -5,7 +5,7 @@
5
5
  %h2= t(:clerks)
6
6
  = paginate @clerks
7
7
  .col-md-2
8
- = link_to t(:new) + ' ' + t(:clerk) , new_clerk_path , :class => "btn btn-primary"
8
+ = link_to t(:new) + ' ' + t(:clerk) , office.new_clerk_path , :class => "btn btn-primary"
9
9
  .col-md-3
10
10
  = image_tag "office_clerk/clerks.jpg" , :class => "img-responsive"
11
11
  .row
@@ -14,7 +14,7 @@
14
14
  %table.table.table-striped.table-bordered.table-condensed
15
15
  %thead
16
16
  %tr
17
- %th=sort_link @q, :email
17
+ %th=sort_link [:office,@q], :email
18
18
  %th=t(:address)
19
19
  %th{:colspan => "2"}
20
20
  %label.checkbox
@@ -24,14 +24,14 @@
24
24
  %tr{:class => "line-#{cycle("1","2")}"}
25
25
  %td=clerk.email
26
26
  %td=clerk.whole_address
27
- %td= link_to t(:show) , clerk_path(clerk), :title => t(:show)
28
- %td= link_to t(:edit), edit_clerk_path(clerk), :title => t(:edit)
27
+ %td= link_to t(:show) , office.clerk_path(clerk), :title => t(:show)
28
+ %td= link_to t(:edit), office.edit_clerk_path(clerk), :title => t(:edit)
29
29
  = paginate @clerks
30
30
  .col-md-3
31
- = search_form_for @q, :url => search_clerks_path, :html => { :class => "form-horizontal" }, :method => :post do |f|
31
+ = search_form_for @q, :url => office.search_clerks_path, :html => { :class => "form-horizontal" }, :method => :get do |f|
32
32
  .form-group
33
33
  = f.text_field :email_cont , :class => "form-control" , :placeholder => t(:email)
34
34
  .form-group
35
35
  = f.text_field :address_cont ,:class => "form-control" , :placeholder => t(:address)
36
36
  = f.submit t(:filter), :id => :filter , :class => "btn btn-success"
37
- = link_to t(:cancel), clerks_path, :class => "btn btn-warning"
37
+ = link_to t(:cancel), office.clerks_path, :class => "btn btn-warning"