opensteam 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +53 -0
- data/README.rdoc +19 -10
- data/generators/opensteam/opensteam_generator.rb +27 -3
- data/generators/opensteam/templates/app/controllers/admin/configurations_controller.rb +85 -0
- data/generators/opensteam/templates/app/controllers/admin/inventories_controller.rb +1 -1
- data/generators/opensteam/templates/app/controllers/admin/invoices_controller.rb +35 -4
- data/generators/opensteam/templates/app/controllers/admin/orders_controller.rb +5 -4
- data/generators/opensteam/templates/app/controllers/admin/shipments_controller.rb +6 -3
- data/generators/opensteam/templates/app/controllers/admin/shipping_rate_groups_controller.rb +76 -0
- data/generators/opensteam/templates/app/controllers/admin/tax_groups_controller.rb +124 -0
- data/generators/opensteam/templates/app/controllers/admin/tax_rules_controller.rb +19 -0
- data/generators/opensteam/templates/app/controllers/admin/tax_zones_controller.rb +118 -0
- data/generators/opensteam/templates/app/controllers/admin/users_controller.rb +1 -1
- data/generators/opensteam/templates/app/controllers/admin_controller.rb +20 -0
- data/generators/opensteam/templates/app/controllers/carts_controller.rb +118 -0
- data/generators/opensteam/templates/app/controllers/checkout_controller.rb +119 -79
- data/generators/opensteam/templates/app/controllers/profile_controller.rb +2 -4
- data/generators/opensteam/templates/app/controllers/searches_controller.rb +1 -1
- data/generators/opensteam/templates/app/controllers/user_sessions_controller.rb +2 -1
- data/generators/opensteam/templates/app/controllers/users_controller.rb +10 -3
- data/generators/opensteam/templates/app/helpers/admin_helper.rb +15 -1
- data/generators/opensteam/templates/app/helpers/checkout_helper.rb +38 -0
- data/generators/opensteam/templates/app/helpers/webshop_helper.rb +6 -1
- data/generators/opensteam/templates/app/models/zone.rb +18 -0
- data/generators/opensteam/templates/app/views/admin/_menu.html.erb +18 -0
- data/generators/opensteam/templates/app/views/admin/catalog.html.erb +2 -3
- data/generators/opensteam/templates/app/views/admin/configurations/edit.html.erb +20 -0
- data/generators/opensteam/templates/app/views/admin/configurations/index.html.erb +22 -0
- data/generators/opensteam/templates/app/views/admin/configurations/new.html.erb +19 -0
- data/generators/opensteam/templates/app/views/admin/configurations/show.html.erb +13 -0
- data/generators/opensteam/templates/app/views/admin/filters/_filter.html.erb +1 -1
- data/generators/opensteam/templates/app/views/admin/index.html.erb +0 -19
- data/generators/opensteam/templates/app/views/admin/inventories/edit.html.erb +10 -6
- data/generators/opensteam/templates/app/views/admin/inventories/new.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/inventories/show.html.erb +10 -6
- data/generators/opensteam/templates/app/views/admin/invoices/_invoice.html.erb +1 -0
- data/generators/opensteam/templates/app/views/admin/invoices/_invoice_fields.html.erb +52 -0
- data/generators/opensteam/templates/app/views/admin/invoices/new.html.erb +9 -37
- data/generators/opensteam/templates/app/views/admin/invoices/show.html.erb +10 -36
- data/generators/opensteam/templates/app/views/admin/invoices/show.pdf.prawn +59 -0
- data/generators/opensteam/templates/app/views/admin/order_config.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/order_items/_item_entry.html.erb +9 -0
- data/generators/opensteam/templates/app/views/admin/order_items/_items_table.html.erb +16 -0
- data/generators/opensteam/templates/app/views/admin/orders/_order.html.erb +9 -9
- data/generators/opensteam/templates/app/views/admin/orders/_orders.html.erb +1 -1
- data/generators/opensteam/templates/app/views/admin/orders/show.html.erb +25 -9
- data/generators/opensteam/templates/app/views/admin/payment_types.html.erb +27 -0
- data/generators/opensteam/templates/app/views/admin/payments/_credit_card_payment.html.erb +26 -0
- data/generators/opensteam/templates/app/views/admin/payments/_credit_card_payment_info.html.erb +15 -0
- data/generators/opensteam/templates/app/views/admin/payments/_direct_debit_payment.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/shipments/new.html.erb +45 -30
- data/generators/opensteam/templates/app/views/admin/shipments/show.html.erb +3 -3
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/_payment_addition.html.erb +12 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/_rate.html.erb +16 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/edit.html.erb +63 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/index.html.erb +28 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/new.html.erb +60 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/show.html.erb +13 -0
- data/generators/opensteam/templates/app/views/admin/system.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/_attributes.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_groups.html.erb +17 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_groups_row.html.erb +12 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_rule.html.erb +14 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/edit.html.erb +26 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/index.html.erb +8 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/new.html.erb +27 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/show.html.erb +28 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/_attributes.html.erb +18 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/_tax_zone_row.html.erb +13 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/_tax_zones.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/edit.html.erb +16 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/index.html.erb +16 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/new.html.erb +14 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/show.html.erb +15 -0
- data/generators/opensteam/templates/app/views/admin/users.html.erb +0 -1
- data/generators/opensteam/templates/app/views/admin/users/show.html.erb +10 -0
- data/generators/opensteam/templates/app/views/administration_mailer/order_customer.erb +1 -1
- data/generators/opensteam/templates/app/views/carts/_cart.html.erb +7 -0
- data/generators/opensteam/templates/app/views/carts/_cart_content.html.erb +45 -0
- data/generators/opensteam/templates/app/views/carts/create.rjs +3 -0
- data/generators/opensteam/templates/app/views/{cart → carts}/index.html.erb +0 -0
- data/generators/opensteam/templates/app/views/carts/update.rjs +11 -0
- data/generators/opensteam/templates/app/views/checkout/_address.html.erb +42 -0
- data/generators/opensteam/templates/app/views/checkout/_customer.html.erb +31 -0
- data/generators/opensteam/templates/app/views/checkout/_edit_checkout.html.erb +42 -0
- data/generators/opensteam/templates/app/views/checkout/_new_checkout.html.erb +44 -0
- data/generators/opensteam/templates/app/views/checkout/_shipping_buttons.html.erb +8 -0
- data/generators/opensteam/templates/app/views/checkout/edit.html.erb +7 -0
- data/generators/opensteam/templates/app/views/checkout/new.html.erb +11 -0
- data/generators/opensteam/templates/app/views/checkout/outro.html.erb +1 -4
- data/generators/opensteam/templates/app/views/checkout/show.html.erb +63 -0
- data/generators/opensteam/templates/app/views/common/_header_admin.html.erb +5 -0
- data/generators/opensteam/templates/app/views/layouts/admin.html.erb +28 -12
- data/generators/opensteam/templates/app/views/layouts/profile.html.erb +2 -2
- data/generators/opensteam/templates/app/views/layouts/webshop.html.erb +5 -4
- data/generators/opensteam/templates/app/views/payment/_advance_payment_payment.html.erb +1 -0
- data/generators/opensteam/templates/app/views/payment/_credit_card_payment.html.erb +37 -0
- data/generators/opensteam/templates/app/views/payment/_credit_card_payment_confirmation.html.erb +20 -0
- data/generators/opensteam/templates/app/views/payment/_direct_debit_payment.html.erb +5 -0
- data/generators/opensteam/templates/app/views/payment/_direct_debit_payment_confirmation.html.erb +5 -0
- data/generators/opensteam/templates/app/views/profile/index.html.erb +1 -1
- data/generators/opensteam/templates/app/views/profile/infos/edit.html.erb +20 -12
- data/generators/opensteam/templates/app/views/profile/infos/edit_password.html.erb +16 -12
- data/generators/opensteam/templates/app/views/profile/orders/_order.html.erb +1 -1
- data/generators/opensteam/templates/app/views/profile/orders/show.html.erb +10 -7
- data/generators/opensteam/templates/app/views/webshop/_inventory_content.html.erb +1 -0
- data/generators/opensteam/templates/app/views/webshop/show.html.erb +3 -1
- data/generators/opensteam/templates/config/initializers/init_states.rb +13 -24
- data/generators/opensteam/templates/config/initializers/opensteam.rb +41 -0
- data/generators/opensteam/templates/config/initializers/opensteam_model_tables.rb +49 -10
- data/generators/opensteam/templates/config/initializers/opensteam_security.rb +8 -0
- data/generators/opensteam/templates/config/initializers/payment_process.rb +37 -0
- data/generators/opensteam/templates/db/migrate/20080609095723_create_addresses.rb +8 -2
- data/generators/opensteam/templates/db/migrate/20080609095726_create_inventories.rb +6 -3
- data/generators/opensteam/templates/db/migrate/20080609095728_create_order_items.rb +12 -1
- data/generators/opensteam/templates/db/migrate/20080609095729_create_orders.rb +8 -12
- data/generators/opensteam/templates/db/migrate/20080609095730_create_payment_types.rb +2 -0
- data/generators/opensteam/templates/db/migrate/20080714131513_create_invoices.rb +2 -1
- data/generators/opensteam/templates/db/migrate/20080714131650_create_shipments.rb +3 -1
- data/generators/opensteam/templates/db/migrate/20080808075247_create_containers.rb +30 -0
- data/generators/opensteam/templates/db/migrate/20080808083011_create_container_items.rb +25 -0
- data/generators/opensteam/templates/db/migrate/20080812102727_create_tax_zones.rb +16 -0
- data/generators/opensteam/templates/db/migrate/20080812102858_create_tax_rules.rb +15 -0
- data/generators/opensteam/templates/db/migrate/20080812102956_create_tax_groups.rb +14 -0
- data/generators/opensteam/templates/db/migrate/20080831181436_create_configurations.rb +15 -0
- data/generators/opensteam/templates/db/migrate/20080903131506_create_payments.rb +22 -0
- data/generators/opensteam/templates/db/migrate/20080904133625_create_payment_transactions.rb +24 -0
- data/generators/opensteam/templates/db/migrate/20080916102341_create_zones.rb +19 -0
- data/generators/opensteam/templates/db/migrate/20080916134340_create_region_shipping_rates.rb +18 -0
- data/generators/opensteam/templates/db/migrate/20080916134523_create_shipping_rate_groups.rb +18 -0
- data/generators/opensteam/templates/db/migrate/20080916135226_create_shipping_payment_additions.rb +20 -0
- data/generators/opensteam/templates/db/migrate/20080916135228_init_opensteam_config.rb +60 -0
- data/generators/opensteam/templates/public/images/opensteam_black.jpg +0 -0
- data/generators/opensteam/templates/public/images/pdf.png +0 -0
- data/generators/opensteam/templates/public/images/shader.png +0 -0
- data/generators/opensteam/templates/public/index.html +1 -0
- data/generators/opensteam/templates/public/javascripts/opensteam.js +21 -21
- data/generators/opensteam/templates/public/stylesheets/opensteam_admin.css +291 -0
- data/generators/opensteam/templates/public/stylesheets/opensteam_white.css +47 -11
- data/generators/opensteam/templates/tasks/opensteam.rake +2 -12
- data/generators/opensteam/templates/test/fixtures/addresses.yml +26 -0
- data/generators/opensteam/templates/test/fixtures/configurations.yml +29 -0
- data/generators/opensteam/templates/test/fixtures/inventories.yml +32 -15
- data/generators/opensteam/templates/test/fixtures/profiles.yml +21 -0
- data/generators/opensteam/templates/test/fixtures/region_shipping_rates.yml +33 -0
- data/generators/opensteam/templates/test/fixtures/shipping_payment_additions.yml +91 -0
- data/generators/opensteam/templates/test/fixtures/shipping_rate_groups.yml +25 -0
- data/generators/opensteam/templates/test/fixtures/tax_groups.yml +13 -0
- data/generators/opensteam/templates/test/fixtures/tax_rules.yml +29 -0
- data/generators/opensteam/templates/test/fixtures/tax_zones.yml +33 -0
- data/generators/opensteam/templates/test/fixtures/users.yml +26 -0
- data/generators/opensteam/templates/test/fixtures/zones.yml +2707 -0
- data/generators/opensteam/templates/test/functional/carts_controller_test.rb +103 -0
- data/generators/opensteam/templates/test/test_helper.rb +38 -0
- data/generators/opensteam/templates/test/unit/container_test.rb +71 -0
- data/generators/opensteam/templates/test/unit/order_test.rb +93 -0
- data/generators/opensteam/templates/test/unit/payment_test.rb +220 -0
- data/generators/opensteam/templates/test/unit/product_test.rb +158 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/.gitignore +3 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/MIT-LICENSE +20 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/README +12 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/Rakefile +22 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/init.rb +6 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto.rb +13 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/action_controller.rb +47 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/template_handler/base.rb +75 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/template_handler/raw.rb +54 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/tasks/prawnto_tasks.rake +4 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/test/action_controller_test.rb +36 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/test/base_template_handler_test.rb +58 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/test/raw_template_handler_test.rb +163 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/test/template_handler_test_mocks.rb +83 -0
- data/generators/opensteam_product/templates/views/admin/_attributes.html.erb +8 -3
- data/generators/opensteam_product/templates/views/admin/_inventories.html.erb +2 -0
- data/lib/opensteam.rb +0 -1
- data/lib/opensteam/base.rb +2 -1
- data/lib/opensteam/checkout.rb +3 -12
- data/lib/opensteam/config.rb +50 -2
- data/lib/opensteam/container.rb +196 -0
- data/lib/opensteam/extension_base.rb +19 -1
- data/lib/opensteam/finder.rb +1 -1
- data/lib/opensteam/helpers/config_table_helper.rb +18 -6
- data/lib/opensteam/initializer.rb +24 -4
- data/lib/opensteam/inventory_base.rb +6 -1
- data/lib/opensteam/invoice_base.rb +12 -13
- data/lib/opensteam/money.rb +230 -0
- data/lib/opensteam/order_base.rb +122 -48
- data/lib/opensteam/payment.rb +225 -0
- data/lib/opensteam/payment/advance_payment.rb +34 -0
- data/lib/opensteam/payment/credit_card_payment.rb +217 -0
- data/lib/opensteam/payment/direct_debit_payment.rb +53 -0
- data/lib/opensteam/product_base.rb +48 -12
- data/lib/opensteam/security.rb +54 -0
- data/lib/opensteam/shipment_base.rb +214 -6
- data/lib/opensteam/shopping_cart.rb +20 -300
- data/lib/opensteam/state_logic.rb +5 -3
- data/lib/opensteam/state_machine.rb +8 -3
- data/lib/opensteam/user_base.rb +48 -6
- data/lib/opensteam/version.rb +1 -1
- metadata +122 -16
- data/generators/opensteam/templates/app/controllers/cart_controller.rb +0 -94
- data/generators/opensteam/templates/app/views/admin/orders/_event.html.erb +0 -5
- data/generators/opensteam/templates/app/views/admin/orders/_order_item.html.erb +0 -10
- data/generators/opensteam/templates/app/views/cart/_cart.html.erb +0 -8
- data/generators/opensteam/templates/app/views/cart/_cart_content.html.erb +0 -20
- data/generators/opensteam/templates/app/views/cart/update.rjs +0 -1
- data/generators/opensteam/templates/app/views/checkout/payment.html.erb +0 -8
- data/generators/opensteam/templates/app/views/checkout/shipping.html.erb +0 -45
- data/generators/opensteam/templates/app/views/checkout/show_cart.html.erb +0 -13
- data/generators/opensteam/templates/app/views/checkout/update_cart_content.rjs +0 -2
- data/generators/opensteam/templates/app/views/profile/orders/_order_item.html.erb +0 -10
- data/generators/opensteam/templates/db/migrate/20080609095725_create_dummy_users.rb +0 -21
- data/lib/opensteam/cart_base.rb +0 -227
data/CHANGELOG
CHANGED
@@ -1,3 +1,56 @@
|
|
1
|
+
*EDGE*
|
2
|
+
|
3
|
+
* added a ContainerModel to hold the basic ShoppingCart Logic (add/update/delete items, increment/decrement), STI
|
4
|
+
|
5
|
+
* moved Cart from session to database (into Container)
|
6
|
+
|
7
|
+
* moved OrderBase into Container (same logic as ShoppingCart)
|
8
|
+
|
9
|
+
* added a Tax-System (TaxZones, TaxGroups, Calculation, etc), MVC
|
10
|
+
|
11
|
+
* implemented ActiveMerchant Integration. (CreditCard Payment)
|
12
|
+
|
13
|
+
* added PaymentTypes and a Payment Base Class to simplify future integration of payment-methods
|
14
|
+
|
15
|
+
* added ShippingRate calculation (ShippingRates, Zones, ShippingRateGroups), MVC
|
16
|
+
|
17
|
+
* added shipping-rates, taxes, netto_price calculation, payment_type to OrderBase (Container)
|
18
|
+
|
19
|
+
* refactored Checkout-Process and OrderBase-Model in order to work with payment_type, shipping-rate and taxes
|
20
|
+
|
21
|
+
* added PDF-Export for Invoices (using the prawn-gem and prawnto-plugin http://www.cracklabs.com/prawnto )
|
22
|
+
|
23
|
+
* removed state-logic from InvoiceBase (not needed)
|
24
|
+
|
25
|
+
* added payment_process initializers (CreditCardPayment)
|
26
|
+
|
27
|
+
* added Configuration Model (Backend), to hold simple key-value pairs
|
28
|
+
|
29
|
+
* added units tests for Container::Base (Order, Cart), Payment, ProductBase and Order
|
30
|
+
|
31
|
+
* refactored the "set_properties=" method in ProductBase. Now "building" the inventory-objects instead of creating.
|
32
|
+
|
33
|
+
* refactored the _attributes partial for products in order to work with the new "set_properties=" method.
|
34
|
+
|
35
|
+
* InventoryBase: added a named_scope called :by_properties (replaces the exists_by_properties extension-method fpr the inventories-association in ProductBase):
|
36
|
+
Now: Single SQL-Query instead of fetching every single property.
|
37
|
+
|
38
|
+
* fixed bug in StateMachine caused by inheritance: declared 'observers' and 'inialstate' as class_inheritable_accessor
|
39
|
+
|
40
|
+
* StateLogic: changed state-name from .downcase to .underscore
|
41
|
+
|
42
|
+
* deleted unnecessary partials (TODO: more to delete!)
|
43
|
+
|
44
|
+
* renamed cart_controller to carts_controller (ActiveRecord Model, recources!)
|
45
|
+
|
46
|
+
* added a "init_opensteam_config" migration file, to create admin-uses and load fixtures (zones, tax_zones, shipping_rates, configuration)
|
47
|
+
|
48
|
+
* added verification_value to credit_card_payment partials
|
49
|
+
|
50
|
+
* deleted lib/cart_base.rb (not needed anymore, now Opensteam::Cart < Opensteam::Container::Base)
|
51
|
+
|
52
|
+
|
53
|
+
|
1
54
|
*0.9.2*
|
2
55
|
|
3
56
|
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= opensteam v0.9.
|
1
|
+
= opensteam v0.9.3
|
2
2
|
|
3
3
|
* http://www.opensteam.net
|
4
4
|
* http://rubyforge.org/projects/opensteam
|
@@ -26,13 +26,14 @@ see CHANGELOG File
|
|
26
26
|
|
27
27
|
* Product Listing
|
28
28
|
* Details-Page for Products
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
*
|
29
|
+
* ShoppingCart (add/update/delete items, increment/decrement quantity, checkout)
|
30
|
+
* CheckoutProcess
|
31
|
+
* AdminBackend
|
32
|
+
* ActiveMerchant Integration
|
33
|
+
* ShippingRates
|
34
|
+
* Taxes
|
35
|
+
* ProfilePage for Customers
|
36
|
+
* Overview and process Orders, Shipments and Invoices
|
36
37
|
|
37
38
|
|
38
39
|
=== Generators
|
@@ -80,10 +81,14 @@ Goto /admin and configure your products
|
|
80
81
|
== REQUIREMENTS:
|
81
82
|
|
82
83
|
* rails (of course)
|
83
|
-
* uuidtools gem (gem install uuidtools)
|
84
84
|
|
85
|
+
* prawnto-plugin (used for pdf-export)
|
86
|
+
http://www.cracklabs.com/prawnto
|
85
87
|
|
88
|
+
* ActiveMerchant gem (used for credit_card payment)
|
89
|
+
http://www.activemerchant.org/
|
86
90
|
|
91
|
+
|
87
92
|
== INSTALL:
|
88
93
|
|
89
94
|
sudo gem install opensteam
|
@@ -92,4 +97,8 @@ Goto /admin and configure your products
|
|
92
97
|
== LICENSE:
|
93
98
|
Copyright (C) DiamondDogs Webconsulting
|
94
99
|
openSteam is licensed under the GNU General Public License (GPL) version 2
|
95
|
-
see the LICENSE file for more information.
|
100
|
+
see the LICENSE file for more information.
|
101
|
+
|
102
|
+
All plugins in "vendor/plugins" belong to their respective owner. See their License files for more information.
|
103
|
+
|
104
|
+
|
@@ -50,7 +50,7 @@ class OpensteamGenerator < Rails::Generator::NamedBase
|
|
50
50
|
Find.find("./templates/" ) do |f|
|
51
51
|
ret = ffind_in_file(f, "<%%", "## TEMPLATE ##" )
|
52
52
|
f = f.gsub(/^\.\/templates\//,'')
|
53
|
-
ret == :directory ? m.send( ret, f =~ /webshop/ ? f.gsub(/webshop/,"#{file_name}") : f ) : m.send(ret,f , f =~ /webshop/ ? f.gsub(/webshop/,"#{file_name}") : f )
|
53
|
+
ret == :directory ? m.send( ret, f =~ /webshop/ ? f.gsub(/webshop/,"#{file_name}") : f ) : m.send(ret,f , f =~ /webshop/ ? f.gsub(/webshop/,"#{file_name}") : f, :collision => :force )
|
54
54
|
end
|
55
55
|
|
56
56
|
|
@@ -69,7 +69,9 @@ class OpensteamGenerator < Rails::Generator::NamedBase
|
|
69
69
|
map.resources :orders, :belongs_to => [ :users ]
|
70
70
|
map.resource :user_session
|
71
71
|
|
72
|
-
map.
|
72
|
+
map.resource :cart
|
73
|
+
map.cart "/cart/*quantity", :controller => 'cart', :action => 'update', :conditions => { :method => :post }
|
74
|
+
|
73
75
|
map.order_state '/orders/state/*state', :controller => 'orders', :action => 'index'
|
74
76
|
map.connect "/admin", :controller => 'admin', :action => 'index'
|
75
77
|
map.show_cart_item '/#{file_name}/show_cart_item/:id', :controller => '#{file_name}', :action => 'show_cart_item'
|
@@ -88,17 +90,27 @@ class OpensteamGenerator < Rails::Generator::NamedBase
|
|
88
90
|
admin.orders_sort "orders/sort/:sort", :controller => 'orders', :action => 'sort'
|
89
91
|
admin.users_admins "users/type/admin", :controller => 'users', :action => 'index', :type => 'admin'
|
90
92
|
admin.users_customers "users/type/customer", :controller => 'users', :action => 'index', :type => 'customer'
|
93
|
+
admin.payment_types "payment_types", :controller => "admin", :action => "payment_types"
|
91
94
|
|
92
|
-
admin.connect "users", :controller => 'users', :action => 'index'
|
93
95
|
admin.connect "orders", :controller => 'orders', :action => 'index'
|
94
96
|
admin.connect "invoices", :controller => 'invoices', :action => 'index'
|
95
97
|
admin.connect "shipments", :controller => 'shipments', :action => 'index'
|
96
98
|
|
99
|
+
admin.connect "tax_zones/filter", :controller => 'tax_zones', :action => 'filter', :conditions => { :method => :post }
|
100
|
+
admin.connect "users/filter", :controller => 'users', :action => 'filter', :conditions => { :method => :post }
|
101
|
+
admin.connect "tax_groups/filter", :controller => 'tax_groups', :action => 'filter', :conditions => { :method => :post }
|
102
|
+
|
103
|
+
admin.resources :configurations
|
104
|
+
|
97
105
|
admin.resources :inventories
|
98
106
|
admin.resources :users, :has_many => [ :orders ]
|
99
107
|
admin.resources :orders, :has_many => [ :shipments, :invoices ]
|
100
108
|
admin.resources :shipments
|
101
109
|
admin.resources :invoices
|
110
|
+
admin.resources :tax_zones
|
111
|
+
admin.resources :tax_groups
|
112
|
+
admin.resources :shipping_rate_groups
|
113
|
+
admin.connect "tax_rules/:action", :controller => "tax_rules"
|
102
114
|
|
103
115
|
Opensteam::Find.find_product_tables.collect(&:to_sym).each do |m|
|
104
116
|
if m.to_s.classify.constantize.column_names.include? m.to_s.classify.constantize.inheritance_column
|
@@ -127,6 +139,9 @@ class OpensteamGenerator < Rails::Generator::NamedBase
|
|
127
139
|
map.admin "/admin", :controller=>"admin", :action=>"index"
|
128
140
|
map.administration "/admin", :controller=>"admin", :action=>"index"
|
129
141
|
|
142
|
+
map.admin_products "/admin/products", :controller => "admin", :action => "products"
|
143
|
+
map.admin_properties "/admin/properties", :controller => "admin", :action => "properties"
|
144
|
+
map.toggle_admin_payment_type "/admin/toggle_payment_type/:id", :controller => "admin", :action => "toggle_payment_type"
|
130
145
|
END_OPENSTEAM_ROUTES
|
131
146
|
|
132
147
|
map_namespaceroutes( administration_routes )
|
@@ -148,6 +163,15 @@ END_OPENSTEAM_ROUTES
|
|
148
163
|
"#{incl}\n\n#{match}\n"
|
149
164
|
end
|
150
165
|
|
166
|
+
|
167
|
+
incl = "
|
168
|
+
config.after_initialize do
|
169
|
+
ActiveMerchant::Billing::Base.mode = :test
|
170
|
+
end"
|
171
|
+
gsub_file 'config/environment.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
|
172
|
+
"#{match}\n\n#{incl}\n"
|
173
|
+
end
|
174
|
+
|
151
175
|
|
152
176
|
end
|
153
177
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class Admin::ConfigurationsController < AdminController
|
2
|
+
# GET /configurations
|
3
|
+
# GET /configurations.xml
|
4
|
+
def index
|
5
|
+
@configurations = Configuration.find(:all)
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @configurations }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /configurations/1
|
14
|
+
# GET /configurations/1.xml
|
15
|
+
def show
|
16
|
+
@configuration = Configuration.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @configuration }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /configurations/new
|
25
|
+
# GET /configurations/new.xml
|
26
|
+
def new
|
27
|
+
@configuration = Configuration.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @configuration }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /configurations/1/edit
|
36
|
+
def edit
|
37
|
+
@configuration = Configuration.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /configurations
|
41
|
+
# POST /configurations.xml
|
42
|
+
def create
|
43
|
+
@configuration = Configuration.new(params[:configuration])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @configuration.save
|
47
|
+
flash[:notice] = 'Configuration was successfully created.'
|
48
|
+
format.html { redirect_to( admin_configuration_path( @configuration) ) }
|
49
|
+
format.xml { render :xml => @configuration, :status => :created, :location => @configuration }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @configuration.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /configurations/1
|
58
|
+
# PUT /configurations/1.xml
|
59
|
+
def update
|
60
|
+
@configuration = Configuration.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @configuration.update_attributes(params[:configuration])
|
64
|
+
flash[:notice] = 'Configuration was successfully updated.'
|
65
|
+
format.html { redirect_to(admin_configuration_path( @configuration)) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @configuration.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /configurations/1
|
75
|
+
# DELETE /configurations/1.xml
|
76
|
+
def destroy
|
77
|
+
@configuration = Configuration.find(params[:id])
|
78
|
+
@configuration.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(admin_configurations_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -61,7 +61,7 @@ class Admin::InventoriesController < AdminController
|
|
61
61
|
# PUT /inventories/1.xml
|
62
62
|
def update
|
63
63
|
@inventory = Inventory.find(params[:id])
|
64
|
-
|
64
|
+
|
65
65
|
respond_to do |format|
|
66
66
|
if @inventory.update_attributes(params[:inventory])
|
67
67
|
flash[:notice] = 'Inventory was successfully updated.'
|
@@ -37,6 +37,10 @@ class Admin::InvoicesController < AdminController
|
|
37
37
|
respond_to do |format|
|
38
38
|
format.html # show.html.erb
|
39
39
|
format.xml { render :xml => @invoice.to_xml( :root => 'invoice' ) }
|
40
|
+
format.pdf {
|
41
|
+
render :layout => false
|
42
|
+
prawnto( :filename => "order_#{@order.id}_invoice_#{@invoice.id}", :prawn => { :page_size => 'A4' } )
|
43
|
+
}
|
40
44
|
end
|
41
45
|
end
|
42
46
|
|
@@ -45,7 +49,7 @@ class Admin::InvoicesController < AdminController
|
|
45
49
|
@order = Opensteam::OrderBase::Order.find( params[:order_id] )
|
46
50
|
@invoice = @order.invoices.new
|
47
51
|
|
48
|
-
if @order.
|
52
|
+
if @order.items.all_invoiced?
|
49
53
|
flash[:error] = "Cannot create invoice : All order-items have an invoice!"
|
50
54
|
redirect_to admin_order_path( @order )
|
51
55
|
end
|
@@ -55,13 +59,18 @@ class Admin::InvoicesController < AdminController
|
|
55
59
|
|
56
60
|
|
57
61
|
def create
|
62
|
+
unless params[:order_items]
|
63
|
+
flash[:error] = "You have to select order-items to create an invoice!"
|
64
|
+
redirect_to :action => :new
|
65
|
+
return
|
66
|
+
end
|
67
|
+
|
68
|
+
|
58
69
|
@order = Opensteam::OrderBase::Order.find( params[:order_id] )
|
59
70
|
@invoice = @order.invoices.new( params[:invoice] )
|
60
71
|
@address = @invoice.address
|
61
72
|
|
62
|
-
@order_items = @order.
|
63
|
-
params[:order_items].keys.include?( o.id.to_s ) && params[:order_items][ o.id.to_s ] == "1"
|
64
|
-
}
|
73
|
+
@order_items = @order.items.find( params[:order_items] )
|
65
74
|
|
66
75
|
@invoice.order_items << @order_items
|
67
76
|
|
@@ -96,8 +105,30 @@ class Admin::InvoicesController < AdminController
|
|
96
105
|
end
|
97
106
|
end
|
98
107
|
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
def update_price
|
112
|
+
|
113
|
+
@order = Opensteam::OrderBase::Order.find( params[:invoice][:order_id] )
|
114
|
+
|
115
|
+
price = BigDecimal.new(
|
116
|
+
params[:order_items] ?
|
117
|
+
@order.items.find( params[:order_items] ).collect(&:total_price).sum.to_s :
|
118
|
+
"0.0"
|
119
|
+
) - BigDecimal.new( params[:invoice][:discount] )
|
120
|
+
|
121
|
+
price += BigDecimal.new( params[:shipping_rate] ? @order.shipping_rate.to_s : "0.0" )
|
122
|
+
|
123
|
+
render :update do |page|
|
124
|
+
page["invoice_price"].value = price
|
125
|
+
end
|
126
|
+
|
99
127
|
|
100
128
|
end
|
129
|
+
|
130
|
+
|
131
|
+
|
101
132
|
|
102
133
|
private
|
103
134
|
def set_sort_column
|
@@ -4,16 +4,16 @@ class Admin::OrdersController < AdminController
|
|
4
4
|
before_filter :set_sort_column
|
5
5
|
|
6
6
|
def index
|
7
|
-
save_filter("Order") if request.post?
|
7
|
+
save_filter( "Order" ) if request.post?
|
8
8
|
@orders = apply_filter( "Order" )
|
9
|
-
|
9
|
+
|
10
10
|
if params[:user_id]
|
11
11
|
@customer = Opensteam::UserBase::User.find( params[:user_id] )
|
12
|
-
@orders = ( @orders || Opensteam::OrderBase
|
12
|
+
@orders = ( @orders || Opensteam::OrderBase::Order ).by_user( params[:user_id ] )
|
13
13
|
end
|
14
14
|
|
15
15
|
@orders = ( @orders || Opensteam::OrderBase::Order ).order_by( @sort_column.order )
|
16
|
-
|
16
|
+
|
17
17
|
if params[:sort]
|
18
18
|
@orders.reverse! if session[:orders]
|
19
19
|
session[:orders] = session[:orders] ? false : true
|
@@ -36,6 +36,7 @@ class Admin::OrdersController < AdminController
|
|
36
36
|
format.xml { render :xml => @order }
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
39
40
|
|
40
41
|
|
41
42
|
|
@@ -42,9 +42,12 @@ class Admin::ShipmentsController < AdminController
|
|
42
42
|
|
43
43
|
def new
|
44
44
|
@order = Opensteam::OrderBase::Order.find( params[:order_id] )
|
45
|
-
@shipment = @order.shipments.
|
45
|
+
@shipment = @order.shipments.build do |s|
|
46
|
+
s.address = @order.shipping_address
|
47
|
+
s.shipping_rate = @order.shipping_rate
|
48
|
+
end
|
46
49
|
|
47
|
-
if @order.
|
50
|
+
if @order.items.all_shipped?
|
48
51
|
flash[:error] = "Cannot create shipment : All order items have been shipped!!"
|
49
52
|
redirect_to admin_order_path( @order )
|
50
53
|
end
|
@@ -58,7 +61,7 @@ class Admin::ShipmentsController < AdminController
|
|
58
61
|
@shipment = @order.shipments.new( params[:shipment] )
|
59
62
|
@address = @shipment.address
|
60
63
|
|
61
|
-
@order_items = @order.
|
64
|
+
@order_items = @order.items.select { |o|
|
62
65
|
params[:order_items].keys.include?( o.id.to_s ) && params[:order_items][ o.id.to_s ] == "1"
|
63
66
|
}
|
64
67
|
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class Admin::ShippingRateGroupsController < AdminController
|
2
|
+
|
3
|
+
|
4
|
+
ShippingRateGroup = Opensteam::ShipmentBase::ShippingRateGroup
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
def index
|
9
|
+
@groups = ShippingRateGroup.find( :all, :include => [ :shipping_rates, :payment_additions ] )
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def new
|
14
|
+
@group = ShippingRateGroup.new
|
15
|
+
|
16
|
+
respond_to do |format|
|
17
|
+
format.html {}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def edit
|
22
|
+
@group = ShippingRateGroup.find( params[:id] )
|
23
|
+
|
24
|
+
respond_to do |format|
|
25
|
+
format.html {}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def create
|
31
|
+
@group = ShippingRateGroup.new( params[:group] )
|
32
|
+
|
33
|
+
respond_to do |format|
|
34
|
+
ret = @group.save
|
35
|
+
if ret && @group.errors.empty?
|
36
|
+
format.html { redirect_to :action => :index }
|
37
|
+
else
|
38
|
+
flash[:error] = "Could not save Group of ShippingRates"
|
39
|
+
format.html { render :action => :new }
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def update
|
47
|
+
@group = ShippingRateGroup.find( params[:id] )
|
48
|
+
|
49
|
+
params[:group][:existing_rates] ||= {}
|
50
|
+
|
51
|
+
respond_to do |format|
|
52
|
+
if @group.update_attributes( params[:group] )
|
53
|
+
flash[:notice] = "Successfully updated ShippingRateGroup ##{@group.id}"
|
54
|
+
format.html { redirect_to :action => :index }
|
55
|
+
else
|
56
|
+
flash[:error] = "Error: Could not update ShippingRateGroup ##{@group.id}"
|
57
|
+
format.html { redirect_to :action => :edit }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def destroy
|
64
|
+
@group = ShippingRateGroup.find( params[:id] )
|
65
|
+
|
66
|
+
respond_to do |format|
|
67
|
+
@group.destroy
|
68
|
+
format.html { redirect_to :action => :index }
|
69
|
+
format.xml { head :ok }
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
end
|