spree_zone_pricing 0.1.52 → 0.1.53

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,53 @@
1
+ class Spree::Admin::CurrencyPricesController < Spree::Admin::BaseController
2
+
3
+ def index
4
+ @currency_prices = CurrencyPrice.page(params[:page]||1).per(20)
5
+ end
6
+
7
+ def new
8
+ @currency_price = CurrencyPrice.new
9
+ @form_target = admin_currency_prices_path
10
+ @form_method = :post
11
+ end
12
+
13
+ def create
14
+ @currency_price = CurrencyPrice.new(params[:currency_price])
15
+
16
+ if @currency_price.save
17
+ #cache_reset
18
+ redirect_to admin_currency_prices_path, notice: 'Item was successfully created.'
19
+ else
20
+ @form_target = admin_currency_prices_path
21
+ @form_method = :post
22
+ render action: "new"
23
+ end
24
+ end
25
+
26
+ def edit
27
+ @currency_price = CurrencyPrice.find(params[:id])
28
+ @form_target = admin_currency_price_path(@currency_price)
29
+ @form_method = :put
30
+ end
31
+
32
+ def update
33
+ @currency_price = CurrencyPrice.find(params[:id])
34
+
35
+ if @currency_price.update_attributes(params[:currency_price])
36
+ #cache_reset
37
+ redirect_to admin_currency_prices_path, notice: 'Item was successfully updated.'
38
+ else
39
+ @form_target = admin_currency_price_path(@currency_price)
40
+ @form_method = :put
41
+ render action: "edit"
42
+ end
43
+ end
44
+
45
+ def destroy
46
+ @currency_price = CurrencyPrice.find(params[:id])
47
+
48
+ @currency_price.destroy
49
+ #cache_reset
50
+ redirect_to admin_currency_prices_url
51
+ end
52
+
53
+ end
@@ -0,0 +1,53 @@
1
+ class Spree::Admin::ZoneCurrenciesController < Spree::Admin::BaseController
2
+
3
+ def index
4
+ @zone_currencies = ZoneCurrency.page(params[:page]||1).per(20)
5
+ end
6
+
7
+ def new
8
+ @zone_currency = ZoneCurrency.new
9
+ @form_target = admin_zone_currencies_path
10
+ @form_method = :post
11
+ end
12
+
13
+ def create
14
+ @zone_currency = ZoneCurrency.new(params[:zone_currency])
15
+
16
+ if @zone_currency.save
17
+ #cache_reset
18
+ redirect_to admin_zone_currencies_path, notice: 'Item was successfully created.'
19
+ else
20
+ @form_target = admin_zone_currencies_path
21
+ @form_method = :post
22
+ render action: "new"
23
+ end
24
+ end
25
+
26
+ def edit
27
+ @zone_currency = ZoneCurrency.find(params[:id])
28
+ @form_target = admin_zone_currency_path(@zone_currency)
29
+ @form_method = :put
30
+ end
31
+
32
+ def update
33
+ @zone_currency = ZoneCurrency.find(params[:id])
34
+
35
+ if @zone_currency.update_attributes(params[:zone_currency])
36
+ #cache_reset
37
+ redirect_to admin_zone_currencies_path, notice: 'Item was successfully updated.'
38
+ else
39
+ @form_target = admin_zone_currency_path(@zone_currency)
40
+ @form_method = :put
41
+ render action: "edit"
42
+ end
43
+ end
44
+
45
+ def destroy
46
+ @zone_currency = ZoneCurrency.find(params[:id])
47
+
48
+ @zone_currency.destroy
49
+ #cache_reset
50
+ redirect_to admin_zone_currencies_url
51
+ end
52
+
53
+ end
data/config/routes.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  Spree::Core::Engine.routes.prepend do
2
2
  namespace :admin do
3
3
 
4
- resources :zone_prices, :except => [ :show ]
4
+ resources :currency_prices, :except => [ :show ]
5
+ resources :zone_currencies, :except => [ :show ]
5
6
 
6
7
  end
7
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_zone_pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.52
4
+ version: 0.1.53
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,14 +19,15 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - app/controllers/spree/admin/currency_prices_controller.rb
22
23
  - app/controllers/spree/admin/variants_controller_decorator.rb
23
- - app/controllers/spree/admin/zone_prices_controller.rb
24
+ - app/controllers/spree/admin/zone_currencies_controller.rb
24
25
  - app/models/currency_price.rb
25
26
  - app/models/zone_currency.rb
26
- - app/views/spree/admin/zone_prices/_form.html.erb
27
- - app/views/spree/admin/zone_prices/edit.html.erb
28
- - app/views/spree/admin/zone_prices/index.html.erb
29
- - app/views/spree/admin/zone_prices/new.html.erb
27
+ - app/views/spree/admin/currency_prices/_form.html.erb
28
+ - app/views/spree/admin/currency_prices/edit.html.erb
29
+ - app/views/spree/admin/currency_prices/index.html.erb
30
+ - app/views/spree/admin/currency_prices/new.html.erb
30
31
  - app/overrides/spree/admin/variants/_form/spree_zone_pricing.html.erb.deface
31
32
  - app/overrides/spree/layouts/admin/spree_zone_pricing.html.erb.deface
32
33
  - config/routes.rb
@@ -1,53 +0,0 @@
1
- class Spree::Admin::ZonePricesController < Spree::Admin::BaseController
2
-
3
- def index
4
- @zone_prices = ZonePrice.page(params[:page]||1).per(20)
5
- end
6
-
7
- def new
8
- @zone_price = ZonePrice.new
9
- @form_target = admin_zone_prices_path
10
- @form_method = :post
11
- end
12
-
13
- def create
14
- @zone_price = ZonePrice.new(params[:zone_price])
15
-
16
- if @zone_price.save
17
- #cache_reset
18
- redirect_to admin_zone_prices_path, notice: 'Item was successfully created.'
19
- else
20
- @form_target = admin_zone_prices_path
21
- @form_method = :post
22
- render action: "new"
23
- end
24
- end
25
-
26
- def edit
27
- @zone_price = ZonePrice.find(params[:id])
28
- @form_target = admin_zone_price_path(@zone_price)
29
- @form_method = :put
30
- end
31
-
32
- def update
33
- @zone_price = ZonePrice.find(params[:id])
34
-
35
- if @zone_price.update_attributes(params[:zone_price])
36
- #cache_reset
37
- redirect_to admin_zone_prices_path, notice: 'Item was successfully updated.'
38
- else
39
- @form_target = admin_zone_price_path(@zone_price)
40
- @form_method = :put
41
- render action: "edit"
42
- end
43
- end
44
-
45
- def destroy
46
- @zone_price = ZonePrice.find(params[:id])
47
-
48
- @zone_price.destroy
49
- #cache_reset
50
- redirect_to admin_zone_prices_url
51
- end
52
-
53
- end