shoppe 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/shoppe/table-tear-off.png +0 -0
- data/app/assets/javascripts/shoppe/application.coffee +2 -2
- data/app/assets/stylesheets/shoppe/application.scss +80 -37
- data/app/assets/stylesheets/shoppe/elements.scss +1 -2
- data/app/controllers/shoppe/attachments_controller.rb +3 -3
- data/app/controllers/shoppe/countries_controller.rb +13 -13
- data/app/controllers/shoppe/delivery_service_prices_controller.rb +11 -11
- data/app/controllers/shoppe/delivery_services_controller.rb +13 -13
- data/app/controllers/shoppe/orders_controller.rb +20 -20
- data/app/controllers/shoppe/payments_controller.rb +8 -8
- data/app/controllers/shoppe/product_categories_controller.rb +13 -13
- data/app/controllers/shoppe/products_controller.rb +24 -13
- data/app/controllers/shoppe/sessions_controller.rb +7 -7
- data/app/controllers/shoppe/settings_controller.rb +6 -6
- data/app/controllers/shoppe/stock_level_adjustments_controller.rb +5 -5
- data/app/controllers/shoppe/tax_rates_controller.rb +13 -13
- data/app/controllers/shoppe/users_controller.rb +15 -15
- data/app/controllers/shoppe/variants_controller.rb +13 -13
- data/app/helpers/shoppe/application_helper.rb +12 -12
- data/app/models/shoppe/order/actions.rb +17 -3
- data/app/models/shoppe/order/billing.rb +18 -18
- data/app/models/shoppe/order/delivery.rb +30 -31
- data/app/models/shoppe/order_item.rb +33 -34
- data/app/models/shoppe/payment.rb +15 -15
- data/app/models/shoppe/product.rb +82 -21
- data/app/models/shoppe/product/variants.rb +10 -10
- data/app/models/shoppe/product_category.rb +7 -7
- data/app/models/shoppe/stock_level_adjustment.rb +6 -6
- data/app/validators/permalink_validator.rb +7 -0
- data/app/views/layouts/shoppe/application.html.haml +10 -20
- data/app/views/shoppe/countries/_form.html.haml +15 -11
- data/app/views/shoppe/countries/edit.html.haml +5 -4
- data/app/views/shoppe/countries/index.html.haml +9 -9
- data/app/views/shoppe/countries/new.html.haml +6 -4
- data/app/views/shoppe/delivery_service_prices/_form.html.haml +16 -16
- data/app/views/shoppe/delivery_service_prices/edit.html.haml +5 -4
- data/app/views/shoppe/delivery_service_prices/index.html.haml +8 -9
- data/app/views/shoppe/delivery_service_prices/new.html.haml +5 -4
- data/app/views/shoppe/delivery_services/_form.html.haml +15 -14
- data/app/views/shoppe/delivery_services/edit.html.haml +7 -5
- data/app/views/shoppe/delivery_services/index.html.haml +11 -12
- data/app/views/shoppe/delivery_services/new.html.haml +5 -4
- data/app/views/shoppe/orders/_form.html.haml +19 -19
- data/app/views/shoppe/orders/_order_details.html.haml +20 -15
- data/app/views/shoppe/orders/_order_items.html.haml +6 -6
- data/app/views/shoppe/orders/_order_items_form.html.haml +11 -11
- data/app/views/shoppe/orders/_payments_form.html.haml +4 -4
- data/app/views/shoppe/orders/_payments_table.html.haml +12 -12
- data/app/views/shoppe/orders/_search_form.html.haml +10 -10
- data/app/views/shoppe/orders/_status_bar.html.haml +17 -13
- data/app/views/shoppe/orders/despatch_note.html.haml +15 -15
- data/app/views/shoppe/orders/edit.html.haml +8 -8
- data/app/views/shoppe/orders/index.html.haml +12 -12
- data/app/views/shoppe/orders/new.html.haml +7 -7
- data/app/views/shoppe/orders/show.html.haml +9 -12
- data/app/views/shoppe/payments/refund.html.haml +6 -7
- data/app/views/shoppe/product_categories/_form.html.haml +9 -9
- data/app/views/shoppe/product_categories/edit.html.haml +4 -4
- data/app/views/shoppe/product_categories/index.html.haml +5 -5
- data/app/views/shoppe/product_categories/new.html.haml +4 -3
- data/app/views/shoppe/products/_form.html.haml +49 -50
- data/app/views/shoppe/products/_table.html.haml +10 -10
- data/app/views/shoppe/products/edit.html.haml +6 -6
- data/app/views/shoppe/products/import.html.haml +63 -0
- data/app/views/shoppe/products/index.html.haml +6 -4
- data/app/views/shoppe/products/new.html.haml +6 -4
- data/app/views/shoppe/sessions/new.html.haml +5 -5
- data/app/views/shoppe/sessions/reset.html.haml +6 -5
- data/app/views/shoppe/settings/edit.html.haml +5 -5
- data/app/views/shoppe/shared/error.html.haml +3 -3
- data/app/views/shoppe/stock_level_adjustments/index.html.haml +13 -12
- data/app/views/shoppe/tax_rates/form.html.haml +13 -13
- data/app/views/shoppe/tax_rates/index.html.haml +5 -5
- data/app/views/shoppe/users/_form.html.haml +10 -11
- data/app/views/shoppe/users/edit.html.haml +4 -4
- data/app/views/shoppe/users/index.html.haml +5 -5
- data/app/views/shoppe/users/new.html.haml +6 -4
- data/app/views/shoppe/variants/form.html.haml +27 -29
- data/app/views/shoppe/variants/index.html.haml +11 -11
- data/config/locales/en.yml +619 -14
- data/config/locales/es.yml +650 -0
- data/config/locales/pl.yml +650 -0
- data/config/locales/pt-BR.yml +643 -0
- data/config/routes.rb +16 -8
- data/db/migrate/20141026175622_add_indexes_to_shoppe_order_items.rb +6 -0
- data/db/migrate/20141026175943_add_indexes_to_shoppe_orders.rb +7 -0
- data/db/migrate/20141026180333_add_indexes_to_shoppe_payments.rb +6 -0
- data/db/migrate/20141026180835_add_indexes_to_shoppe_product_attributes.rb +7 -0
- data/db/migrate/20141026180952_add_indexes_to_shoppe_product_categories.rb +5 -0
- data/db/migrate/20141026181040_add_indexes_to_shoppe_products.rb +8 -0
- data/db/migrate/20141026181312_add_indexes_to_shoppe_settings.rb +5 -0
- data/db/migrate/20141026181354_add_indexes_to_shoppe_stock_level_adjustments.rb +6 -0
- data/db/migrate/20141026181559_add_indexes_to_shoppe_users.rb +5 -0
- data/db/migrate/20141026181716_add_indexes_to_shoppe_delivery_services.rb +9 -0
- data/db/schema.rb +36 -1
- data/lib/shoppe/engine.rb +6 -0
- data/lib/shoppe/navigation_manager.rb +1 -1
- data/lib/shoppe/version.rb +1 -1
- metadata +67 -5
@@ -1,47 +1,47 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class DeliveryServicesController < Shoppe::ApplicationController
|
3
|
-
|
3
|
+
|
4
4
|
before_filter { @active_nav = :delivery_services }
|
5
5
|
before_filter { params[:id] && @delivery_service = Shoppe::DeliveryService.find(params[:id]) }
|
6
|
-
|
6
|
+
|
7
7
|
def index
|
8
8
|
@delivery_services = Shoppe::DeliveryService.all
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def new
|
12
12
|
@delivery_service = Shoppe::DeliveryService.new
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def create
|
16
16
|
@delivery_service = Shoppe::DeliveryService.new(safe_params)
|
17
17
|
if @delivery_service.save
|
18
|
-
redirect_to :delivery_services, :flash => {:notice =>
|
18
|
+
redirect_to :delivery_services, :flash => {:notice => t('shoppe.delivery_services.create_notice')}
|
19
19
|
else
|
20
20
|
render :action => "new"
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def edit
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def update
|
28
28
|
if @delivery_service.update(safe_params)
|
29
|
-
redirect_to [:edit, @delivery_service], :flash => {:notice =>
|
29
|
+
redirect_to [:edit, @delivery_service], :flash => {:notice => t('shoppe.delivery_services.update_notice')}
|
30
30
|
else
|
31
31
|
render :action => "edit"
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def destroy
|
36
36
|
@delivery_service.destroy
|
37
|
-
redirect_to :delivery_services, :flash => {:notice =>
|
37
|
+
redirect_to :delivery_services, :flash => {:notice =>t('shoppe.delivery_services.destroy_notice')}
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
private
|
41
|
-
|
41
|
+
|
42
42
|
def safe_params
|
43
43
|
params[:delivery_service].permit(:name, :code, :active, :default, :courier, :tracking_url)
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
end
|
47
47
|
end
|
@@ -1,79 +1,79 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class OrdersController < Shoppe::ApplicationController
|
3
|
-
|
4
|
-
before_filter { @active_nav = :orders }
|
3
|
+
|
4
|
+
before_filter { @active_nav = :orders }
|
5
5
|
before_filter { params[:id] && @order = Shoppe::Order.find(params[:id])}
|
6
|
-
|
6
|
+
|
7
7
|
def index
|
8
8
|
@query = Shoppe::Order.ordered.received.includes(:order_items => :ordered_item).page(params[:page]).search(params[:q])
|
9
9
|
@orders = @query.result
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def new
|
13
13
|
@order = Shoppe::Order.new
|
14
14
|
@order.order_items.build(:ordered_item_type => 'Shoppe::Product')
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def create
|
18
18
|
Shoppe::Order.transaction do
|
19
19
|
@order = Shoppe::Order.new(safe_params)
|
20
20
|
@order.status = 'confirming'
|
21
21
|
if !request.xhr? && @order.save
|
22
22
|
@order.confirm!
|
23
|
-
redirect_to @order, :notice =>
|
23
|
+
redirect_to @order, :notice => t('shoppe.orders.create_notice')
|
24
24
|
else
|
25
25
|
@order.order_items.build(:ordered_item_type => 'Shoppe::Product')
|
26
26
|
render :action => "new"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
rescue Shoppe::Errors::InsufficientStockToFulfil => e
|
30
|
-
flash.now[:alert] =
|
30
|
+
flash.now[:alert] = t('shoppe.orders.insufficient_stock_order', out_of_stock_items: e.out_of_stock_items.map { |t| t.ordered_item.full_name }.to_sentence)
|
31
31
|
render :action => 'new'
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def show
|
35
35
|
@payments = @order.payments.to_a
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def update
|
39
39
|
@order.attributes = safe_params
|
40
40
|
if !request.xhr? && @order.update_attributes(safe_params)
|
41
|
-
redirect_to @order, :notice =>
|
41
|
+
redirect_to @order, :notice => t('shoppe.orders.update_notice')
|
42
42
|
else
|
43
43
|
render :action => "edit"
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def search
|
48
48
|
index
|
49
49
|
render :action => "index"
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def accept
|
53
53
|
@order.accept!(current_user)
|
54
|
-
redirect_to @order, :notice =>
|
54
|
+
redirect_to @order, :notice => t('shoppe.orders.accept_notice')
|
55
55
|
rescue Shoppe::Errors::PaymentDeclined => e
|
56
56
|
redirect_to @order, :alert => e.message
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
def reject
|
60
60
|
@order.reject!(current_user)
|
61
|
-
redirect_to @order, :notice =>
|
61
|
+
redirect_to @order, :notice => t('shoppe.orders.reject_notice')
|
62
62
|
rescue Shoppe::Errors::PaymentDeclined => e
|
63
63
|
redirect_to @order, :alert => e.message
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
def ship
|
67
67
|
@order.ship!(params[:consignment_number], current_user)
|
68
|
-
redirect_to @order, :notice =>
|
68
|
+
redirect_to @order, :notice => t('shoppe.orders.ship_notice')
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
def despatch_note
|
72
72
|
render :layout => 'shoppe/printable'
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
private
|
76
|
-
|
76
|
+
|
77
77
|
def safe_params
|
78
78
|
params[:order].permit(
|
79
79
|
:first_name, :last_name, :company,
|
@@ -1,33 +1,33 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class PaymentsController < ApplicationController
|
3
|
-
|
3
|
+
|
4
4
|
before_filter { @order = Shoppe::Order.find(params[:order_id]) }
|
5
5
|
before_filter { params[:id] && @payment = @order.payments.find(params[:id]) }
|
6
|
-
|
6
|
+
|
7
7
|
def create
|
8
8
|
payment = @order.payments.build(params[:payment].permit(:amount, :method, :reference))
|
9
9
|
if payment.save
|
10
|
-
redirect_to @order, :notice =>
|
10
|
+
redirect_to @order, :notice => t('shoppe.payments.create_notice')
|
11
11
|
else
|
12
12
|
redirect_to @order, :alert => payment.errors.full_messages.to_sentence
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def destroy
|
17
17
|
@payment.destroy
|
18
|
-
redirect_to @order, :notice =>
|
18
|
+
redirect_to @order, :notice => t('shoppe.payments.destroy_notice')
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def refund
|
22
22
|
if request.post?
|
23
23
|
@payment.refund!(params[:amount])
|
24
|
-
redirect_to @order, :notice =>
|
24
|
+
redirect_to @order, :notice => t('shoppe.payments.refund_notice')
|
25
25
|
else
|
26
26
|
render :layout => false
|
27
27
|
end
|
28
28
|
rescue Shoppe::Errors::RefundFailed => e
|
29
29
|
redirect_to @order, :alert => e.message
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
end
|
33
33
|
end
|
@@ -1,47 +1,47 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class ProductCategoriesController < Shoppe::ApplicationController
|
3
3
|
|
4
|
-
before_filter { @active_nav = :product_categories }
|
4
|
+
before_filter { @active_nav = :product_categories }
|
5
5
|
before_filter { params[:id] && @product_category = Shoppe::ProductCategory.find(params[:id]) }
|
6
|
-
|
6
|
+
|
7
7
|
def index
|
8
8
|
@product_categories = Shoppe::ProductCategory.ordered.all
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def new
|
12
12
|
@product_category = Shoppe::ProductCategory.new
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def create
|
16
16
|
@product_category = Shoppe::ProductCategory.new(safe_params)
|
17
17
|
if @product_category.save
|
18
|
-
redirect_to :product_categories, :flash => {:notice =>
|
18
|
+
redirect_to :product_categories, :flash => { :notice => t('shoppe.product_category.create_notice') }
|
19
19
|
else
|
20
20
|
render :action => "new"
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def edit
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def update
|
28
28
|
if @product_category.update(safe_params)
|
29
|
-
redirect_to [:edit, @product_category], :flash => {:notice =>
|
29
|
+
redirect_to [:edit, @product_category], :flash => { :notice => t('shoppe.product_category.update_notice') }
|
30
30
|
else
|
31
31
|
render :action => "edit"
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def destroy
|
36
36
|
@product_category.destroy
|
37
|
-
redirect_to :product_categories, :flash => {:notice =>
|
37
|
+
redirect_to :product_categories, :flash => { :notice => t('shoppe.product_category.destroy_notice') }
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
private
|
41
|
-
|
41
|
+
|
42
42
|
def safe_params
|
43
43
|
params[:product_category].permit(:name, :permalink, :description, :image_file)
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
end
|
47
47
|
end
|
@@ -1,47 +1,58 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class ProductsController < Shoppe::ApplicationController
|
3
|
-
|
3
|
+
|
4
4
|
before_filter { @active_nav = :products }
|
5
5
|
before_filter { params[:id] && @product = Shoppe::Product.root.find(params[:id]) }
|
6
|
-
|
6
|
+
|
7
7
|
def index
|
8
8
|
@products = Shoppe::Product.root.includes(:stock_level_adjustments, :default_image, :product_category, :variants).order(:name).group_by(&:product_category).sort_by { |cat,pro| cat.name }
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def new
|
12
12
|
@product = Shoppe::Product.new
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def create
|
16
16
|
@product = Shoppe::Product.new(safe_params)
|
17
17
|
if @product.save
|
18
|
-
redirect_to :products, :flash => {:notice =>
|
18
|
+
redirect_to :products, :flash => {:notice => t('shoppe.products.create_notice') }
|
19
19
|
else
|
20
20
|
render :action => "new"
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def edit
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def update
|
28
28
|
if @product.update(safe_params)
|
29
|
-
redirect_to [:edit, @product], :flash => {:notice =>
|
29
|
+
redirect_to [:edit, @product], :flash => {:notice => t('shoppe.products.update_notice') }
|
30
30
|
else
|
31
31
|
render :action => "edit"
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def destroy
|
36
36
|
@product.destroy
|
37
|
-
redirect_to :products, :flash => {:notice =>
|
37
|
+
redirect_to :products, :flash => {:notice => t('shoppe.products.destroy_notice')}
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
|
+
def import
|
41
|
+
if request.post?
|
42
|
+
if params[:import].nil?
|
43
|
+
redirect_to import_products_path, :flash => {:alert => I18n.t('shoppe.imports.errors.no_file')}
|
44
|
+
else
|
45
|
+
Shoppe::Product.import(params[:import][:import_file])
|
46
|
+
redirect_to products_path, :flash => {:notice => I18n.t("shoppe.products.imports.success")}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
40
51
|
private
|
41
|
-
|
52
|
+
|
42
53
|
def safe_params
|
43
54
|
params[:product].permit(:product_category_id, :name, :sku, :permalink, :description, :short_description, :weight, :price, :cost_price, :tax_rate_id, :stock_control, :default_image_file, :data_sheet_file, :active, :featured, :in_the_box, :product_attributes_array => [:key, :value, :searchable, :public])
|
44
55
|
end
|
45
|
-
|
56
|
+
|
46
57
|
end
|
47
58
|
end
|
@@ -3,30 +3,30 @@ module Shoppe
|
|
3
3
|
|
4
4
|
layout 'shoppe/sub'
|
5
5
|
skip_before_filter :login_required, :only => [:new, :create, :reset]
|
6
|
-
|
6
|
+
|
7
7
|
def create
|
8
8
|
if user = Shoppe::User.authenticate(params[:email_address], params[:password])
|
9
9
|
session[:shoppe_user_id] = user.id
|
10
10
|
redirect_to :orders
|
11
11
|
else
|
12
|
-
flash.now[:alert] =
|
12
|
+
flash.now[:alert] = t('shoppe.sessions.create_alert')
|
13
13
|
render :action => "new"
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def destroy
|
18
18
|
session[:shoppe_user_id] = nil
|
19
19
|
redirect_to :login
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def reset
|
23
|
-
|
23
|
+
|
24
24
|
if request.post?
|
25
25
|
if user = Shoppe::User.find_by_email_address(params[:email_address])
|
26
26
|
user.reset_password!
|
27
|
-
redirect_to login_path(:email_address => params[:email_address]), :notice =>
|
27
|
+
redirect_to login_path(:email_address => params[:email_address]), :notice => t('shoppe.sessions.reset_notice', email_address: user.email_address)
|
28
28
|
else
|
29
|
-
flash.now[:alert] =
|
29
|
+
flash.now[:alert] = t('shoppe.sessions.reset_alert')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class SettingsController < ApplicationController
|
3
|
-
|
3
|
+
|
4
4
|
before_filter { @active_nav = :settings }
|
5
|
-
|
5
|
+
|
6
6
|
def update
|
7
7
|
if Shoppe.settings.demo_mode?
|
8
|
-
raise Shoppe::Error,
|
8
|
+
raise Shoppe::Error, t('shoppe.settings.demo_mode_error')
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
Shoppe::Setting.update_from_hash(params[:settings].permit!)
|
12
|
-
redirect_to :settings, :notice =>
|
12
|
+
redirect_to :settings, :notice => t('shoppe.settings.update_notice')
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
end
|
16
16
|
end
|
@@ -3,11 +3,11 @@ module Shoppe
|
|
3
3
|
|
4
4
|
SUITABLE_OBJECTS = ['Shoppe::Product']
|
5
5
|
before_filter do
|
6
|
-
raise Shoppe::Error,
|
6
|
+
raise Shoppe::Error, t('shoppe.stock_level_adjustments.invalid_item_type', suitable_objects: SUITABLE_OBJECTS.to_sentence) unless SUITABLE_OBJECTS.include?(params[:item_type])
|
7
7
|
@item = params[:item_type].constantize.find(params[:item_id].to_i)
|
8
8
|
end
|
9
9
|
before_filter { params[:id] && @sla = @item.stock_level_adjustments.find(params[:id].to_i) }
|
10
|
-
|
10
|
+
|
11
11
|
def index
|
12
12
|
@stock_level_adjustments = @item.stock_level_adjustments.ordered.page(params[:page]).per(10)
|
13
13
|
@new_sla = @item.stock_level_adjustments.build if @new_sla.nil?
|
@@ -15,7 +15,7 @@ module Shoppe
|
|
15
15
|
render :action => 'index', :layout => false
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def create
|
20
20
|
@new_sla = @item.stock_level_adjustments.build(params[:stock_level_adjustment].permit(:description, :adjustment))
|
21
21
|
if @new_sla.save
|
@@ -23,7 +23,7 @@ module Shoppe
|
|
23
23
|
@new_sla = @item.stock_level_adjustments.build
|
24
24
|
index
|
25
25
|
else
|
26
|
-
redirect_to stock_level_adjustments_path(:item_id => params[:item_id], :item_type => params[:item_type]), :notice =>
|
26
|
+
redirect_to stock_level_adjustments_path(:item_id => params[:item_id], :item_type => params[:item_type]), :notice => t('shoppe.stock_level_adjustments.create_notice')
|
27
27
|
end
|
28
28
|
else
|
29
29
|
if request.xhr?
|
@@ -35,6 +35,6 @@ module Shoppe
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
end
|
40
40
|
end
|
@@ -1,49 +1,49 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class TaxRatesController < Shoppe::ApplicationController
|
3
|
-
|
3
|
+
|
4
4
|
before_filter { @active_nav = :tax_rates }
|
5
5
|
before_filter { params[:id] && @tax_rate = Shoppe::TaxRate.find(params[:id]) }
|
6
|
-
|
6
|
+
|
7
7
|
def index
|
8
8
|
@tax_rates = Shoppe::TaxRate.ordered.all
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def new
|
12
12
|
@tax_rate = Shoppe::TaxRate.new
|
13
13
|
render :action => "form"
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def create
|
17
17
|
@tax_rate = Shoppe::TaxRate.new(safe_params)
|
18
18
|
if @tax_rate.save
|
19
|
-
redirect_to :tax_rates, :flash => {:notice =>
|
19
|
+
redirect_to :tax_rates, :flash => {:notice => t('shoppe.tax_rates.create_notice') }
|
20
20
|
else
|
21
21
|
render :action => "form"
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def edit
|
26
26
|
render :action => "form"
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def update
|
30
30
|
if @tax_rate.update(safe_params)
|
31
|
-
redirect_to [:edit, @tax_rate], :flash => {:notice =>
|
31
|
+
redirect_to [:edit, @tax_rate], :flash => {:notice => t('shoppe.tax_rates.update_notice')}
|
32
32
|
else
|
33
33
|
render :action => "form"
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def destroy
|
38
38
|
@tax_rate.destroy
|
39
|
-
redirect_to :tax_rates, :flash => {:notice =>
|
39
|
+
redirect_to :tax_rates, :flash => {:notice => t('shoppe.tax_rates.destroy_notice')}
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
private
|
43
|
-
|
43
|
+
|
44
44
|
def safe_params
|
45
45
|
params[:tax_rate].permit(:name, :rate, :address_type, :country_ids => [])
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
end
|
49
49
|
end
|