opensteam 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +78 -0
- data/LICENSE +345 -0
- data/{README.txt → README.rdoc} +20 -17
- data/Rakefile +40 -0
- data/generators/opensteam/opensteam_generator.rb +95 -194
- data/generators/opensteam/templates/{controllers/administration → app/controllers/admin}/inventories_controller.rb +4 -4
- data/generators/opensteam/templates/app/controllers/admin/invoices_controller.rb +106 -0
- data/generators/opensteam/templates/app/controllers/admin/orders_controller.rb +113 -0
- data/generators/opensteam/templates/app/controllers/admin/search_controller.rb +17 -0
- data/generators/opensteam/templates/app/controllers/admin/shipments_controller.rb +106 -0
- data/generators/opensteam/templates/app/controllers/admin/users_controller.rb +99 -0
- data/generators/opensteam/templates/app/controllers/admin_controller.rb +40 -0
- data/generators/opensteam/templates/app/controllers/cart_controller.rb +94 -0
- data/generators/opensteam/templates/app/controllers/checkout_controller.rb +139 -0
- data/generators/opensteam/templates/app/controllers/profile/infos_controller.rb +52 -0
- data/generators/opensteam/templates/app/controllers/profile/orders_controller.rb +105 -0
- data/generators/opensteam/templates/app/controllers/profile_controller.rb +37 -0
- data/generators/opensteam/templates/app/controllers/searches_controller.rb +23 -0
- data/generators/opensteam/templates/app/controllers/user_sessions_controller.rb +38 -0
- data/generators/opensteam/templates/app/controllers/users_controller.rb +40 -0
- data/generators/opensteam/templates/{controllers → app/controllers}/webshop_controller.rb +35 -13
- data/generators/opensteam/templates/app/helpers/admin_helper.rb +40 -0
- data/generators/opensteam/templates/app/helpers/users_helper.rb +53 -0
- data/generators/opensteam/templates/app/helpers/webshop_helper.rb +91 -0
- data/generators/opensteam/templates/app/models/search.rb +36 -0
- data/generators/opensteam/templates/{views/administration → app/views/admin}/_address.html.erb +0 -0
- data/generators/opensteam/templates/app/views/admin/_nav.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/catalog.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/index.html.erb +21 -0
- data/generators/opensteam/templates/{views/administration → app/views/admin}/inventories/edit.html.erb +10 -9
- data/generators/opensteam/templates/{views/administration → app/views/admin}/inventories/index.html.erb +3 -3
- data/generators/opensteam/templates/{views/administration → app/views/admin}/inventories/new.html.erb +3 -3
- data/generators/opensteam/templates/app/views/admin/inventories/show.html.erb +46 -0
- data/generators/opensteam/templates/app/views/admin/invoices/_invoice.html.erb +12 -0
- data/generators/opensteam/templates/app/views/admin/invoices/_invoices.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/invoices/index.html.erb +6 -0
- data/generators/opensteam/templates/app/views/admin/invoices/new.html.erb +54 -0
- data/generators/opensteam/templates/app/views/admin/invoices/show.html.erb +55 -0
- data/generators/opensteam/templates/app/views/admin/orders/_event.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/orders/_order.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/orders/_order_item.html.erb +10 -0
- data/generators/opensteam/templates/app/views/admin/orders/_orders.html.erb +19 -0
- data/generators/opensteam/templates/app/views/admin/orders/index.html.erb +14 -0
- data/generators/opensteam/templates/app/views/admin/orders/livesearch.rjs +6 -0
- data/generators/opensteam/templates/app/views/admin/orders/show.html.erb +58 -0
- data/generators/opensteam/templates/app/views/admin/products.html.erb +8 -0
- data/generators/opensteam/templates/app/views/admin/properties.html.erb +7 -0
- data/generators/opensteam/templates/app/views/admin/sales.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/shipments/_shipment.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/shipments/_shipments.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/shipments/index.html.erb +6 -0
- data/generators/opensteam/templates/app/views/admin/shipments/new.html.erb +51 -0
- data/generators/opensteam/templates/app/views/admin/shipments/show.html.erb +55 -0
- data/generators/opensteam/templates/app/views/admin/users/_admins.html.erb +26 -0
- data/generators/opensteam/templates/app/views/admin/users/_admins_header.html.erb +10 -0
- data/generators/opensteam/templates/app/views/admin/users/_customer.html.erb +32 -0
- data/generators/opensteam/templates/app/views/admin/users/_customers.html.erb +29 -0
- data/generators/opensteam/templates/app/views/admin/users/_customers_header.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/users/_user_fields.html.erb +9 -0
- data/generators/opensteam/templates/app/views/admin/users/_users.html.erb +29 -0
- data/generators/opensteam/templates/app/views/admin/users/_users_header.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/users/edit.html.erb +6 -0
- data/generators/opensteam/templates/app/views/admin/users/index.html.erb +7 -0
- data/generators/opensteam/templates/app/views/admin/users/new.html.erb +6 -0
- data/generators/opensteam/templates/app/views/admin/users/show.html.erb +34 -0
- data/generators/opensteam/templates/app/views/admin/users.html.erb +4 -0
- data/generators/opensteam/templates/{views → app/views}/administration_mailer/order_admin.erb +0 -0
- data/generators/opensteam/templates/{views → app/views}/administration_mailer/order_customer.erb +0 -0
- data/generators/opensteam/templates/app/views/cart/_cart.html.erb +8 -0
- data/generators/opensteam/templates/{views/webshop → app/views/cart}/_cart_content.html.erb +7 -10
- data/generators/opensteam/templates/app/views/cart/index.html.erb +5 -0
- data/generators/opensteam/templates/app/views/cart/update.rjs +1 -0
- data/generators/opensteam/templates/app/views/checkout/intro.html.erb +18 -0
- data/generators/opensteam/templates/{views → app/views}/checkout/outro.html.erb +0 -1
- data/generators/opensteam/templates/{views → app/views}/checkout/payment.html.erb +0 -0
- data/generators/opensteam/templates/app/views/checkout/shipping.html.erb +45 -0
- data/generators/opensteam/templates/app/views/checkout/show_cart.html.erb +13 -0
- data/generators/opensteam/templates/{views → app/views}/checkout/update_cart_content.rjs +0 -0
- data/generators/opensteam/templates/{views → app/views}/common/_cart.html.erb +2 -2
- data/generators/opensteam/templates/{views → app/views}/common/_cart_content.html.erb +1 -1
- data/generators/opensteam/templates/app/views/common/_footer.html.erb +1 -0
- data/generators/opensteam/templates/app/views/common/_header.html.erb +4 -0
- data/generators/opensteam/templates/app/views/common/_header_flash.html.erb +3 -0
- data/generators/opensteam/templates/app/views/common/_signup_fields.html.erb +16 -0
- data/generators/opensteam/templates/app/views/common/_top_links.html.erb +10 -0
- data/generators/opensteam/templates/app/views/layouts/admin.html.erb +45 -0
- data/generators/opensteam/templates/app/views/layouts/profile.html.erb +45 -0
- data/generators/opensteam/templates/app/views/layouts/webshop.html.erb +51 -0
- data/generators/opensteam/templates/app/views/profile/_customer_sidebar.html.erb +12 -0
- data/generators/opensteam/templates/app/views/profile/index.html.erb +11 -0
- data/generators/opensteam/templates/app/views/profile/infos/_customer.html.erb +5 -0
- data/generators/opensteam/templates/app/views/profile/infos/edit.html.erb +25 -0
- data/generators/opensteam/templates/app/views/profile/infos/edit_password.html.erb +26 -0
- data/generators/opensteam/templates/app/views/profile/orders/_order.html.erb +11 -0
- data/generators/opensteam/templates/app/views/profile/orders/_order_item.html.erb +10 -0
- data/generators/opensteam/templates/app/views/profile/orders/_orders.html.erb +19 -0
- data/generators/opensteam/templates/app/views/profile/orders/index.html.erb +14 -0
- data/generators/opensteam/templates/app/views/profile/orders/show.html.erb +48 -0
- data/generators/opensteam/templates/app/views/searches/_search_bar.html.erb +5 -0
- data/generators/opensteam/templates/app/views/searches/new.html.erb +23 -0
- data/generators/opensteam/templates/app/views/searches/show.html.erb +1 -0
- data/generators/opensteam/templates/app/views/user_sessions/new.html.erb +14 -0
- data/generators/opensteam/templates/app/views/users/_user_bar.html.erb +5 -0
- data/generators/opensteam/templates/app/views/users/index.html.erb +27 -0
- data/generators/opensteam/templates/app/views/users/new.html.erb +7 -0
- data/generators/opensteam/templates/app/views/users/show.html.erb +5 -0
- data/generators/opensteam/templates/{views → app/views}/webshop/_inventory_content.html.erb +0 -0
- data/generators/opensteam/templates/app/views/webshop/_nav.html.erb +6 -0
- data/generators/opensteam/templates/{views → app/views}/webshop/add_inventory_to_cart.rjs +0 -0
- data/generators/opensteam/templates/{views → app/views}/webshop/add_to_cart_with_parameters.rjs +0 -0
- data/generators/opensteam/templates/{views → app/views}/webshop/del_item.rjs +0 -0
- data/generators/opensteam/templates/app/views/webshop/index.html.erb +11 -0
- data/generators/opensteam/templates/{views → app/views}/webshop/inventory.rjs +0 -0
- data/generators/opensteam/templates/{views → app/views}/webshop/show.html.erb +15 -15
- data/generators/opensteam/templates/config/initializers/init_states.rb +68 -0
- data/generators/opensteam/templates/{init → config/initializers}/opensteam.rb +6 -0
- data/generators/opensteam/templates/config/initializers/opensteam_model_tables.rb +57 -0
- data/generators/opensteam/templates/db/migrate/20080609095714_create_profiles.rb +14 -0
- data/generators/opensteam/templates/{migrations/create_sessions.rb → db/migrate/20080609095720_create_sessions.rb} +0 -0
- data/generators/opensteam/templates/db/migrate/20080609095721_create_users.rb +29 -0
- data/generators/opensteam/templates/{migrations/create_addresses.rb → db/migrate/20080609095723_create_addresses.rb} +0 -0
- data/generators/opensteam/templates/{migrations/create_customers.rb → db/migrate/20080609095724_create_customers.rb} +0 -0
- data/generators/opensteam/templates/db/migrate/20080609095725_create_dummy_users.rb +21 -0
- data/generators/opensteam/templates/{migrations/create_inventories.rb → db/migrate/20080609095726_create_inventories.rb} +0 -0
- data/generators/opensteam/templates/{migrations/create_inventories_properties.rb → db/migrate/20080609095727_create_inventories_properties.rb} +0 -0
- data/generators/opensteam/templates/{migrations/create_order_items.rb → db/migrate/20080609095728_create_order_items.rb} +5 -0
- data/generators/opensteam/templates/db/migrate/20080609095729_create_orders.rb +32 -0
- data/generators/opensteam/templates/{migrations/create_payment_types.rb → db/migrate/20080609095730_create_payment_types.rb} +0 -0
- data/generators/opensteam/templates/{migrations/create_properties.rb → db/migrate/20080609095731_create_properties.rb} +0 -0
- data/generators/opensteam/templates/db/migrate/20080623075613_create_states.rb +13 -0
- data/generators/opensteam/templates/db/migrate/20080624132807_create_searches.rb +20 -0
- data/generators/opensteam/templates/db/migrate/20080630114155_create_state_histories.rb +14 -0
- data/generators/opensteam/templates/db/migrate/20080714131513_create_invoices.rb +20 -0
- data/generators/opensteam/templates/db/migrate/20080714131650_create_shipments.rb +19 -0
- data/generators/opensteam/templates/lib/authenticated_system.rb +201 -0
- data/generators/opensteam/templates/lib/authentication/by_cookie_token.rb +90 -0
- data/generators/opensteam/templates/lib/authentication/by_password.rb +68 -0
- data/generators/opensteam/templates/lib/authentication.rb +46 -0
- data/generators/opensteam/templates/lib/states/invoice/finished.rb +6 -0
- data/generators/opensteam/templates/lib/states/invoice/payment_received.rb +8 -0
- data/generators/opensteam/templates/lib/states/invoice/pending.rb +6 -0
- data/generators/opensteam/templates/lib/states/invoice/waiting_for_payment.rb +5 -0
- data/generators/opensteam/templates/lib/states/order/finished.rb +6 -0
- data/generators/opensteam/templates/lib/states/order/pending.rb +19 -0
- data/generators/opensteam/templates/lib/states/order/processing.rb +11 -0
- data/generators/opensteam/templates/lib/states/shipment/finished.rb +6 -0
- data/generators/opensteam/templates/lib/states/shipment/pending.rb +5 -0
- data/generators/opensteam/templates/lib/tasks/opensteam.rake +114 -0
- data/generators/opensteam/templates/public/images/athmo_background.jpg +0 -0
- data/generators/opensteam/templates/public/images/bg.jpg +0 -0
- data/generators/opensteam/templates/public/images/cart_big.gif +0 -0
- data/generators/opensteam/templates/public/images/cross.png +0 -0
- data/generators/opensteam/templates/public/images/enter.gif +0 -0
- data/generators/opensteam/templates/public/images/menu_background.jpg +0 -0
- data/generators/opensteam/templates/public/images/opensteam_background.jpg +0 -0
- data/generators/opensteam/templates/public/images/opensteam_logo1.jpg +0 -0
- data/generators/opensteam/templates/public/images/opensteam_petstore_logo1.jpg +0 -0
- data/generators/opensteam/templates/public/images/opensteam_store_logo.jpg +0 -0
- data/generators/opensteam/templates/public/images/os_logo.gif +0 -0
- data/generators/opensteam/templates/public/images/slogan.png +0 -0
- data/generators/opensteam/templates/public/images/tick.png +0 -0
- data/generators/opensteam/templates/public/images/zoom.png +0 -0
- data/generators/opensteam/templates/public/index.html +19 -36
- data/generators/opensteam/templates/public/javascripts/opensteam.js +30 -0
- data/generators/opensteam/templates/public/stylesheets/opensteam_newdesign.css +188 -0
- data/generators/opensteam/templates/public/stylesheets/opensteam_white.css +168 -0
- data/generators/opensteam/templates/public/stylesheets/webshop.css +0 -1
- data/generators/opensteam/templates/tasks/opensteam.rake +1 -1
- data/generators/opensteam/templates/{fixtures → test/fixtures}/inventories.yml +0 -0
- data/generators/opensteam/templates/{fixtures → test/fixtures}/inventories_properties.yml +0 -0
- data/generators/opensteam/templates/{fixtures → test/fixtures}/product_animals.yml +0 -0
- data/generators/opensteam/templates/{fixtures → test/fixtures}/product_dog_foods.yml +0 -0
- data/generators/opensteam/templates/{fixtures → test/fixtures}/properties.yml +0 -0
- data/generators/opensteam_product/opensteam_product_generator.rb +25 -9
- data/generators/opensteam_product/templates/controllers/product_controller.rb +5 -4
- data/generators/opensteam_product/templates/migration.rb +2 -1
- data/generators/opensteam_product/templates/models/product.rb +1 -0
- data/generators/opensteam_product/templates/views/{administration → admin}/_attributes.html.erb +1 -1
- data/generators/opensteam_product/templates/views/{administration → admin}/_get_products.html.erb +0 -0
- data/generators/opensteam_product/templates/views/{administration → admin}/_inventories.html.erb +2 -2
- data/generators/opensteam_product/templates/views/admin/edit.html.erb +13 -0
- data/generators/opensteam_product/templates/views/{administration → admin}/index.html.erb +5 -5
- data/generators/opensteam_product/templates/views/admin/new.html.erb +16 -0
- data/generators/opensteam_product/templates/views/{administration → admin}/show.html.erb +2 -2
- data/generators/opensteam_property/opensteam_property_generator.rb +8 -8
- data/generators/opensteam_property/templates/controllers/property_controller.rb +6 -4
- data/generators/opensteam_property/templates/migration.rb +2 -1
- data/generators/opensteam_property/templates/models/property.rb +1 -0
- data/generators/opensteam_property/templates/views/{administration → admin}/edit.html.erb +3 -3
- data/generators/opensteam_property/templates/views/admin/index.html.erb +24 -0
- data/generators/opensteam_property/templates/views/{administration → admin}/new.html.erb +2 -2
- data/generators/opensteam_property/templates/views/admin/show.html.erb +10 -0
- data/lib/opensteam/base.rb +16 -0
- data/lib/opensteam/cart_base.rb +227 -0
- data/lib/opensteam/checkout.rb +30 -3
- data/lib/opensteam/config.rb +37 -0
- data/lib/opensteam/extension_base.rb +76 -0
- data/lib/opensteam/finder.rb +36 -5
- data/lib/opensteam/helper/configurable_table.rb +228 -0
- data/lib/opensteam/history.rb +56 -0
- data/lib/opensteam/initializer.rb +127 -0
- data/lib/opensteam/inventory_base.rb +24 -1
- data/lib/opensteam/invoice_base.rb +61 -0
- data/lib/opensteam/order_base.rb +105 -14
- data/lib/opensteam/product_base.rb +31 -3
- data/lib/opensteam/property_base.rb +16 -0
- data/lib/opensteam/shipment_base.rb +60 -0
- data/lib/opensteam/shopping_cart.rb +32 -14
- data/lib/opensteam/state_logic.rb +218 -0
- data/lib/opensteam/state_machine.rb +216 -0
- data/lib/opensteam/user_base.rb +115 -131
- data/lib/opensteam/version.rb +17 -1
- data/lib/opensteam.rb +30 -35
- metadata +245 -146
- data/History.txt +0 -0
- data/License.txt +0 -4
- data/Manifest.txt +0 -131
- data/Manifest.txt.bak +0 -132
- data/generators/opensteam/templates/controllers/administration/customers_controller.rb +0 -23
- data/generators/opensteam/templates/controllers/administration/orders_controller.rb +0 -61
- data/generators/opensteam/templates/controllers/administration_controller.rb +0 -80
- data/generators/opensteam/templates/controllers/checkout_controller.rb +0 -142
- data/generators/opensteam/templates/helpers/webshop_helper.rb +0 -29
- data/generators/opensteam/templates/migrations/create_dummy_users.rb +0 -16
- data/generators/opensteam/templates/migrations/create_orders.rb +0 -18
- data/generators/opensteam/templates/migrations/create_users.rb +0 -19
- data/generators/opensteam/templates/models/administration_mailer.rb +0 -18
- data/generators/opensteam/templates/models/inventories_property.rb +0 -10
- data/generators/opensteam/templates/models/inventory.rb +0 -57
- data/generators/opensteam/templates/public/images/rails.png +0 -0
- data/generators/opensteam/templates/views/administration/_nav.html.erb +0 -11
- data/generators/opensteam/templates/views/administration/_update_tree.html.erb +0 -18
- data/generators/opensteam/templates/views/administration/admin_info.html.erb +0 -12
- data/generators/opensteam/templates/views/administration/customers/index.html.erb +0 -27
- data/generators/opensteam/templates/views/administration/customers/show.html.erb +0 -27
- data/generators/opensteam/templates/views/administration/customers.html.erb +0 -44
- data/generators/opensteam/templates/views/administration/index.html.erb +0 -9
- data/generators/opensteam/templates/views/administration/inventories/show.html.erb +0 -45
- data/generators/opensteam/templates/views/administration/login.html.erb +0 -16
- data/generators/opensteam/templates/views/administration/order.html.erb +0 -22
- data/generators/opensteam/templates/views/administration/orders/_order_item.html.erb +0 -22
- data/generators/opensteam/templates/views/administration/orders/index.html.erb +0 -32
- data/generators/opensteam/templates/views/administration/orders/show.html.erb +0 -25
- data/generators/opensteam/templates/views/administration/orders.html.erb +0 -32
- data/generators/opensteam/templates/views/administration/products.html.erb +0 -7
- data/generators/opensteam/templates/views/administration/properties.html.erb +0 -7
- data/generators/opensteam/templates/views/administration/show_order_item.html.erb +0 -5
- data/generators/opensteam/templates/views/administration/signup.html.erb +0 -65
- data/generators/opensteam/templates/views/administration/tree.html.erb +0 -15
- data/generators/opensteam/templates/views/administration/update_products.html.erb +0 -5
- data/generators/opensteam/templates/views/administration/update_properties.html.erb +0 -5
- data/generators/opensteam/templates/views/administration/update_tree.rjs +0 -3
- data/generators/opensteam/templates/views/checkout/intro.html.erb +0 -5
- data/generators/opensteam/templates/views/checkout/shipping.html.erb +0 -39
- data/generators/opensteam/templates/views/checkout/show_cart.html.erb +0 -13
- data/generators/opensteam/templates/views/common/_header.html.erb +0 -15
- data/generators/opensteam/templates/views/layouts/administration.html.erb +0 -29
- data/generators/opensteam/templates/views/layouts/webshop.html.erb +0 -36
- data/generators/opensteam/templates/views/webshop/_cart.html.erb +0 -11
- data/generators/opensteam/templates/views/webshop/_header.html.erb +0 -15
- data/generators/opensteam/templates/views/webshop/index.html.erb +0 -12
- data/generators/opensteam_product/templates/views/administration/edit.html.erb +0 -13
- data/generators/opensteam_product/templates/views/administration/new.html.erb +0 -16
- data/generators/opensteam_property/templates/views/administration/index.html.erb +0 -24
- data/generators/opensteam_property/templates/views/administration/show.html.erb +0 -10
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<%%= error_messages_for :<%= singular_name %> %>
|
4
4
|
|
5
|
-
<%% form_for([:
|
5
|
+
<%% form_for([:admin, @<%= singular_name %>]) do |f| %>
|
6
6
|
<% for attribute in attributes -%>
|
7
7
|
<p>
|
8
8
|
<b><%= attribute.column.human_name %></b><br />
|
@@ -15,5 +15,5 @@
|
|
15
15
|
</p>
|
16
16
|
<%% end %>
|
17
17
|
|
18
|
-
<%%= link_to 'Show', [:
|
19
|
-
<%%= link_to 'Back',
|
18
|
+
<%%= link_to 'Show', [:admin, @<%= singular_name %>] %> |
|
19
|
+
<%%= link_to 'Back', admin_<%= plural_name %>_path %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Listing <%= plural_name %></h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<% for attribute in attributes -%>
|
6
|
+
<th><%= attribute.column.human_name %></th>
|
7
|
+
<% end -%>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<%% for <%= singular_name %> in @<%= plural_name %> %>
|
11
|
+
<tr>
|
12
|
+
<% for attribute in attributes -%>
|
13
|
+
<td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
|
14
|
+
<% end -%>
|
15
|
+
<td><%%= link_to 'Show', [:admin, <%= singular_name %>] %></td>
|
16
|
+
<td><%%= link_to 'Edit', edit_admin_<%= singular_name %>_path(<%= singular_name %>) %></td>
|
17
|
+
<td><%%= link_to 'Destroy', [:admin, <%= singular_name %>], :confirm => 'Are you sure?', :method => :delete %></td>
|
18
|
+
</tr>
|
19
|
+
<%% end %>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<br />
|
23
|
+
|
24
|
+
<%%= link_to 'New <%= singular_name %>', new_admin_<%= singular_name %>_path %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<%%= error_messages_for :<%= singular_name %> %>
|
4
4
|
|
5
|
-
<%% form_for([:
|
5
|
+
<%% form_for([:admin, @<%= singular_name %>]) do |f| %>
|
6
6
|
<% for attribute in attributes -%>
|
7
7
|
<p>
|
8
8
|
<b><%= attribute.column.human_name %></b><br />
|
@@ -15,4 +15,4 @@
|
|
15
15
|
</p>
|
16
16
|
<%% end %>
|
17
17
|
|
18
|
-
<%%= link_to 'Back',
|
18
|
+
<%%= link_to 'Back', admin_<%= plural_name %>_path %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% for attribute in attributes -%>
|
2
|
+
<p>
|
3
|
+
<b><%= attribute.column.human_name %>:</b>
|
4
|
+
<%%=h @<%= singular_name %>.<%= attribute.name %> %>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%%= link_to 'Edit', edit_admin_<%= singular_name %>_path(@<%= singular_name %>) %> |
|
10
|
+
<%%= link_to 'Back', admin_<%= plural_name %>_path %>
|
data/lib/opensteam/base.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# openSteam - http://www.opensteam.net
|
2
|
+
# Copyright (C) 2008 DiamondDogs Webconsulting
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; version 2 of the License.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
|
1
17
|
module Opensteam
|
2
18
|
|
3
19
|
=begin rdoc
|
@@ -0,0 +1,227 @@
|
|
1
|
+
# openSteam - http://www.opensteam.net
|
2
|
+
# Copyright (C) 2008 DiamondDogs Webconsulting
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; version 2 of the License.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
require 'opensteam/finder'
|
21
|
+
|
22
|
+
|
23
|
+
module Opensteam
|
24
|
+
|
25
|
+
module CartBase
|
26
|
+
|
27
|
+
module Helper
|
28
|
+
def self.included(base)
|
29
|
+
base.extend ClassMethods
|
30
|
+
base.class_eval do
|
31
|
+
include InstanceMethods
|
32
|
+
before_filter :set_instance_vars
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
module ClassMethods
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
module InstanceMethods
|
44
|
+
|
45
|
+
|
46
|
+
private
|
47
|
+
def empty_cart
|
48
|
+
wipe_cart
|
49
|
+
end
|
50
|
+
|
51
|
+
def frmt(h)
|
52
|
+
returning(Hash.new) { |hash| h.each_pair { |k,v| k =~ /^products/ ? ( hash[:products] ||= [] ) << frmt(v) : hash[k] = v } }
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
def set_instance_vars
|
58
|
+
@cart = get_cart
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
def get_cart
|
63
|
+
session[:cart] ||= Cart.new
|
64
|
+
end
|
65
|
+
|
66
|
+
def wipe_cart
|
67
|
+
session[:cart] = nil
|
68
|
+
get_cart
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
def redirect_to_index
|
73
|
+
redirect_to :action => :index
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
class Cart
|
83
|
+
|
84
|
+
## cart_items
|
85
|
+
attr_accessor :items
|
86
|
+
|
87
|
+
|
88
|
+
# intialize items array
|
89
|
+
def initialize
|
90
|
+
@items = []
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
# get item from cart
|
96
|
+
# get( :cart_itemd_id => 1 ) # get item by internal array id
|
97
|
+
# get( :yamlid => 3 ) # get item by Inventory-id
|
98
|
+
#
|
99
|
+
def get( opts = {} )
|
100
|
+
|
101
|
+
if opts.has_key? :yamlid
|
102
|
+
@items.each do |v|
|
103
|
+
return v if v.yamlid == opts[:yamlid]
|
104
|
+
end
|
105
|
+
|
106
|
+
elsif opts.has_key? :cart_item_id
|
107
|
+
return @items[ opts[:cart_item_id].to_i ]
|
108
|
+
end
|
109
|
+
|
110
|
+
return nil
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
# add an item to cart or increment its quantity
|
117
|
+
def add( yamlid )
|
118
|
+
item = get( :yamlid => yamlid )
|
119
|
+
if item.nil?
|
120
|
+
@items << CartItem.new( yamlid )
|
121
|
+
return true
|
122
|
+
else
|
123
|
+
return item.incr
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
# set quantity for item (by internal array-id)
|
130
|
+
def set_quantity( id, q )
|
131
|
+
item = @items[ id.to_i ]
|
132
|
+
|
133
|
+
return nil if item.nil?
|
134
|
+
|
135
|
+
q = q.to_i
|
136
|
+
if q == 0
|
137
|
+
@items.delete_at( id.to_i )
|
138
|
+
elsif q > 0
|
139
|
+
item.quantity = ( item.inventory.storage < q ) ? item.inventory.storage : q
|
140
|
+
end
|
141
|
+
|
142
|
+
item
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
# delete item from cart (:cart_item_id or :yamlid )
|
147
|
+
def del( opts = {} )
|
148
|
+
if opts.has_key?( :yamlid )
|
149
|
+
@items.delete( get( :yamlid => opts[:yamlid] ) )
|
150
|
+
elsif opts.has_key?( :cart_item_id )
|
151
|
+
@items.delete_at( opts[:cart_item_id].to_i )
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
# calculate total price
|
158
|
+
def total_price
|
159
|
+
@items.collect { |x| x.price * x.quantity }.inject(&:+)
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
class CartItem
|
167
|
+
include Opensteam::Finder
|
168
|
+
|
169
|
+
@@_load_product_on_init = false
|
170
|
+
cattr_accessor :_load_product_on_init
|
171
|
+
|
172
|
+
attr_reader :yamlid
|
173
|
+
|
174
|
+
attr_reader :product
|
175
|
+
|
176
|
+
attr_accessor :quantity
|
177
|
+
|
178
|
+
|
179
|
+
#initialize cart-item
|
180
|
+
def initialize(id)
|
181
|
+
@yamlid = id
|
182
|
+
@quantity = 1
|
183
|
+
end
|
184
|
+
|
185
|
+
# increase quantity
|
186
|
+
def incr
|
187
|
+
if (@quantity + 1 ) > inventory.storage
|
188
|
+
return false
|
189
|
+
else
|
190
|
+
@quantity += 1
|
191
|
+
return true
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
# decrease quantity
|
196
|
+
def decr
|
197
|
+
@quantity -= 1
|
198
|
+
end
|
199
|
+
|
200
|
+
# return product
|
201
|
+
def product
|
202
|
+
return Opensteam::InventoryBase::Inventory.find( @yamlid ).product
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
# return Inventory Object
|
207
|
+
def inventory
|
208
|
+
return Opensteam::InventoryBase::Inventory.find( @yamlid )
|
209
|
+
end
|
210
|
+
|
211
|
+
# return price
|
212
|
+
def price
|
213
|
+
return Opensteam::InventoryBase::Inventory.find( @yamlid ).price
|
214
|
+
end
|
215
|
+
|
216
|
+
private
|
217
|
+
def load_product_object
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
data/lib/opensteam/checkout.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# openSteam - http://www.opensteam.net
|
2
|
+
# Copyright (C) 2008 DiamondDogs Webconsulting
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; version 2 of the License.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
|
1
17
|
require 'opensteam/shopping_cart'
|
2
18
|
|
3
19
|
module Opensteam
|
@@ -20,11 +36,22 @@ module Opensteam
|
|
20
36
|
|
21
37
|
module Checkout
|
22
38
|
|
39
|
+
|
40
|
+
def self.included(base)
|
41
|
+
base.extend(ClassMethods)
|
42
|
+
base.class_eval do
|
43
|
+
include InstanceMethods
|
44
|
+
before_filter :current_step
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
module ClassMethods
|
49
|
+
|
50
|
+
end
|
23
51
|
|
24
52
|
|
25
|
-
|
26
|
-
|
27
|
-
before_filter :current_step
|
53
|
+
module InstanceMethods
|
54
|
+
|
28
55
|
|
29
56
|
# save the current-action name in the sessions
|
30
57
|
def current_step
|
data/lib/opensteam/config.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# openSteam - http://www.opensteam.net
|
2
|
+
# Copyright (C) 2008 DiamondDogs Webconsulting
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; version 2 of the License.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
|
1
17
|
module Opensteam
|
2
18
|
|
3
19
|
|
@@ -10,6 +26,8 @@ module Opensteam
|
|
10
26
|
|
11
27
|
PRODUCT_BASE_TABLE_PREFIX = :product
|
12
28
|
|
29
|
+
ORDER_INITIAL_STATE = :pending
|
30
|
+
|
13
31
|
module Errors
|
14
32
|
# generic error class
|
15
33
|
class OpensteamError < StandardError
|
@@ -28,4 +46,23 @@ module Opensteam
|
|
28
46
|
end
|
29
47
|
|
30
48
|
end
|
49
|
+
|
50
|
+
|
51
|
+
module UUIDHelper
|
52
|
+
require 'rubygems'
|
53
|
+
require 'uuidtools'
|
54
|
+
|
55
|
+
def self.included(base)
|
56
|
+
base.class_eval do
|
57
|
+
before_create :set_uuid
|
58
|
+
private :set_uuid
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def set_uuid
|
63
|
+
self.id = UUID.random_create.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
31
68
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Opensteam
|
2
|
+
|
3
|
+
module ExtensionBase #:nodoc:
|
4
|
+
|
5
|
+
mattr_accessor :extension_path
|
6
|
+
@@extension_path = File.join( "#{RAILS_ROOT}", "vendor", "opensteam_extensions")
|
7
|
+
|
8
|
+
|
9
|
+
class << self ;
|
10
|
+
|
11
|
+
|
12
|
+
def init_extensions( which = :backend )
|
13
|
+
return false unless ActiveRecord::Base.connection.tables.include?( "extensions" )
|
14
|
+
|
15
|
+
|
16
|
+
path = File.join( extension_path, which.to_s, "**" )
|
17
|
+
|
18
|
+
Dir.glob( path ).each do |ext_path|
|
19
|
+
ext_name = File.basename( ext_path )
|
20
|
+
"Opensteam::ExtensionBase::#{which.to_s.classify}".constantize.find_or_create_by_name( :name => ext_name, :path => path )
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def verify_extensions( which = :backend )
|
26
|
+
return false unless ActiveRecord::Base.connection.tables.include?( "extensions" )
|
27
|
+
"Opensteam::ExtensionBase::#{which.to_s.classify}".constantize.find(:all).collect(&:verify_path)
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
# Extension-Model
|
37
|
+
#
|
38
|
+
class Extension < ActiveRecord::Base
|
39
|
+
named_scope :active, :conditions => { :active => 1 }
|
40
|
+
named_scope :inactive, :conditions => { :active => 0 }
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
def active? ; active == 0 ? false : true ; end
|
45
|
+
|
46
|
+
# activate the extension
|
47
|
+
def activate! ; self.update_attribute( :active, 1 ) ; end
|
48
|
+
|
49
|
+
# deactivate the extension
|
50
|
+
def deactivate! ; self.update_attribute( :active, 0 ) ; end
|
51
|
+
|
52
|
+
# verify the extension-path
|
53
|
+
# if path doesn't exist, set error and deactivate extension
|
54
|
+
# if path exist, delete previous error-message.
|
55
|
+
#
|
56
|
+
def verify_path
|
57
|
+
if File.exists?( self.path )
|
58
|
+
self.error = nil
|
59
|
+
self.save
|
60
|
+
else
|
61
|
+
self.error = "Extensions-Path '#{self.path}' not found!"
|
62
|
+
self.deactivate!
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
class Backend < Extension
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
data/lib/opensteam/finder.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# openSteam - http://www.opensteam.net
|
2
|
+
# Copyright (C) 2008 DiamondDogs Webconsulting
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; version 2 of the License.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
|
1
17
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
18
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
19
|
|
@@ -18,6 +34,12 @@ module Opensteam
|
|
18
34
|
|
19
35
|
module ClassMethods
|
20
36
|
|
37
|
+
|
38
|
+
|
39
|
+
def find_product_klasses
|
40
|
+
find_product_tables.collect(&:classify).collect(&:constantize)
|
41
|
+
end
|
42
|
+
|
21
43
|
|
22
44
|
# method is invoked before adding a product to the cart
|
23
45
|
#
|
@@ -61,7 +83,7 @@ module Opensteam
|
|
61
83
|
# find all properties
|
62
84
|
def find_properties
|
63
85
|
Properties.find(:all)
|
64
|
-
# find_property_tables.inject([]) { |r,v| r += v.classify.constantize.find(:all) }
|
86
|
+
# find_property_tables.inject([]) { |r,v| r += v.classify.constantize.find(:all) }
|
65
87
|
end
|
66
88
|
|
67
89
|
|
@@ -86,15 +108,19 @@ module Opensteam
|
|
86
108
|
return nil if id.empty?
|
87
109
|
contantize_pro(:property, klass).find(id)
|
88
110
|
end
|
111
|
+
|
112
|
+
|
89
113
|
|
90
114
|
# checks if the "inventories_properties" table exists
|
91
115
|
def inventories_properties_exist?
|
92
|
-
|
116
|
+
ActiveRecord::Base.connection.tables.include?( "inventories_properties" )
|
117
|
+
# not ActiveRecord::Base.connection.select_all("SHOW TABLES LIKE 'inventories_properties'").empty?
|
93
118
|
end
|
94
119
|
|
95
120
|
# checks if the properties table exists
|
96
121
|
def properties_table_exists?
|
97
|
-
|
122
|
+
ActiveRecord::Base.connection.tables.include?( "properties" )
|
123
|
+
# not ActiveRecord::Base.connection.select_all("SHOW TABLES LIKE 'properties'").empty?
|
98
124
|
end
|
99
125
|
|
100
126
|
|
@@ -115,6 +141,7 @@ module Opensteam
|
|
115
141
|
end
|
116
142
|
|
117
143
|
def find_tables(type) #:nodoc:
|
144
|
+
type = type.to_s
|
118
145
|
prefix =
|
119
146
|
case type
|
120
147
|
when "property"
|
@@ -122,8 +149,12 @@ module Opensteam
|
|
122
149
|
when "product"
|
123
150
|
Opensteam::Config::PRODUCT_BASE_TABLE_PREFIX.to_s
|
124
151
|
end
|
125
|
-
|
126
|
-
|
152
|
+
|
153
|
+
tables = ActiveRecord::Base.connection.tables.select { |s| s =~ /^#{prefix}\_.+$/ }.collect { |t|
|
154
|
+
t.gsub("#{prefix}_", "" ) }
|
155
|
+
|
156
|
+
# tables = ActiveRecord::Base.connection.select_all("SHOW TABLES LIKE '#{prefix}\\_%'").collect(&:values).flatten.collect {
|
157
|
+
# |t| t.gsub("#{prefix}_", "") }
|
127
158
|
end
|
128
159
|
|
129
160
|
|