radiant-shop-extension 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +26 -0
  3. data/Gemfile.lock +75 -0
  4. data/HISTORY.md +77 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +26 -0
  7. data/Rakefile +141 -0
  8. data/VERSION +1 -0
  9. data/app/.DS_Store +0 -0
  10. data/app/controllers/admin/shop/categories_controller.rb +206 -0
  11. data/app/controllers/admin/shop/customers_controller.rb +137 -0
  12. data/app/controllers/admin/shop/orders_controller.rb +171 -0
  13. data/app/controllers/admin/shop/products/images_controller.rb +144 -0
  14. data/app/controllers/admin/shop/products_controller.rb +217 -0
  15. data/app/controllers/admin/shops_controller.rb +9 -0
  16. data/app/controllers/shop/categories_controller.rb +49 -0
  17. data/app/controllers/shop/line_items_controller.rb +165 -0
  18. data/app/controllers/shop/orders_controller.rb +16 -0
  19. data/app/controllers/shop/products_controller.rb +48 -0
  20. data/app/models/form_checkout.rb +245 -0
  21. data/app/models/shop_address.rb +13 -0
  22. data/app/models/shop_addressable.rb +11 -0
  23. data/app/models/shop_category.rb +85 -0
  24. data/app/models/shop_category_page.rb +7 -0
  25. data/app/models/shop_customer.rb +27 -0
  26. data/app/models/shop_line_item.rb +32 -0
  27. data/app/models/shop_order.rb +108 -0
  28. data/app/models/shop_payment.rb +6 -0
  29. data/app/models/shop_payment_method.rb +5 -0
  30. data/app/models/shop_product.rb +87 -0
  31. data/app/models/shop_product_attachment.rb +30 -0
  32. data/app/models/shop_product_page.rb +7 -0
  33. data/app/views/.DS_Store +0 -0
  34. data/app/views/admin/.DS_Store +0 -0
  35. data/app/views/admin/pages/_shop_category.html.haml +4 -0
  36. data/app/views/admin/pages/_shop_product.html.haml +4 -0
  37. data/app/views/admin/shop/categories/edit.html.haml +12 -0
  38. data/app/views/admin/shop/categories/edit/_fields.html.haml +28 -0
  39. data/app/views/admin/shop/categories/edit/_head.html.haml +2 -0
  40. data/app/views/admin/shop/categories/edit/_meta.html.haml +7 -0
  41. data/app/views/admin/shop/categories/edit/_part.html.haml +3 -0
  42. data/app/views/admin/shop/categories/edit/_popup.html.haml +3 -0
  43. data/app/views/admin/shop/categories/edit/meta/_handle.html.haml +5 -0
  44. data/app/views/admin/shop/categories/edit/meta/_layouts.html.haml +10 -0
  45. data/app/views/admin/shop/categories/edit/parts/_description.html.haml +1 -0
  46. data/app/views/admin/shop/categories/index/_category.html.haml +16 -0
  47. data/app/views/admin/shop/categories/new.html.haml +10 -0
  48. data/app/views/admin/shop/categories/remove.html.haml +12 -0
  49. data/app/views/admin/shop/customers/index.html.haml +36 -0
  50. data/app/views/admin/shop/orders/index.html.haml +33 -0
  51. data/app/views/admin/shop/products/edit.html.haml +14 -0
  52. data/app/views/admin/shop/products/edit/_fields.html.haml +38 -0
  53. data/app/views/admin/shop/products/edit/_head.html.haml +2 -0
  54. data/app/views/admin/shop/products/edit/_image.html.haml +12 -0
  55. data/app/views/admin/shop/products/edit/_meta.html.haml +8 -0
  56. data/app/views/admin/shop/products/edit/_part.html.haml +3 -0
  57. data/app/views/admin/shop/products/edit/_popup.html.haml +3 -0
  58. data/app/views/admin/shop/products/edit/buttons/_browse_images.html.haml +1 -0
  59. data/app/views/admin/shop/products/edit/buttons/_new_image.html.haml +1 -0
  60. data/app/views/admin/shop/products/edit/meta/_category.html.haml +5 -0
  61. data/app/views/admin/shop/products/edit/meta/_sku.html.haml +5 -0
  62. data/app/views/admin/shop/products/edit/parts/_description.html.haml +1 -0
  63. data/app/views/admin/shop/products/edit/parts/_images.html.haml +5 -0
  64. data/app/views/admin/shop/products/edit/popups/_browse_images.html.haml +6 -0
  65. data/app/views/admin/shop/products/edit/popups/_new_image.html.haml +18 -0
  66. data/app/views/admin/shop/products/index.html.haml +10 -0
  67. data/app/views/admin/shop/products/index/_bottom.html.haml +5 -0
  68. data/app/views/admin/shop/products/index/_product.html.haml +13 -0
  69. data/app/views/admin/shop/products/new.html.haml +10 -0
  70. data/app/views/admin/shop/products/remove.html.haml +12 -0
  71. data/app/views/shop/categories/show.html.haml +1 -0
  72. data/app/views/shop/orders/show.html.haml +1 -0
  73. data/app/views/shop/products/index.html.haml +1 -0
  74. data/app/views/shop/products/show.html.haml +1 -0
  75. data/config/locales/en.yml +50 -0
  76. data/config/routes.rb +38 -0
  77. data/config/shop_cart.yml +16 -0
  78. data/cucumber.yml +1 -0
  79. data/db/migrate/20100311053701_initial.rb +153 -0
  80. data/db/migrate/20100520033059_create_layouts.rb +119 -0
  81. data/db/migrate/20100903122123_create_forms.rb +44 -0
  82. data/db/migrate/20100908063639_create_snippets.rb +22 -0
  83. data/features/support/env.rb +16 -0
  84. data/features/support/paths.rb +14 -0
  85. data/lib/shop/controllers/application_controller.rb +39 -0
  86. data/lib/shop/controllers/site_controller.rb +12 -0
  87. data/lib/shop/interface/products.rb +49 -0
  88. data/lib/shop/models/image.rb +14 -0
  89. data/lib/shop/models/page.rb +14 -0
  90. data/lib/shop/tags/address.rb +40 -0
  91. data/lib/shop/tags/cart.rb +49 -0
  92. data/lib/shop/tags/category.rb +83 -0
  93. data/lib/shop/tags/core.rb +12 -0
  94. data/lib/shop/tags/helpers.rb +142 -0
  95. data/lib/shop/tags/item.rb +109 -0
  96. data/lib/shop/tags/product.rb +109 -0
  97. data/lib/shop/tags/responses.rb +34 -0
  98. data/lib/tasks/shop_extension_tasks.rake +54 -0
  99. data/mockups/balsamiq/products-retro_fun_tshirt-more.bmml +0 -0
  100. data/mockups/balsamiq/products-retro_fun_tshirt.bmml +0 -0
  101. data/public/images/admin/extensions/shop/products/sort.png +0 -0
  102. data/public/javascripts/admin/extensions/shop/products/edit.js +115 -0
  103. data/public/javascripts/admin/extensions/shop/products/index.js +65 -0
  104. data/public/stylesheets/sass/admin/extensions/shop/edit.sass +86 -0
  105. data/public/stylesheets/sass/admin/extensions/shop/products/edit.sass +158 -0
  106. data/public/stylesheets/sass/admin/extensions/shop/products/index.sass +129 -0
  107. data/radiant-shop-extension.gemspec +245 -0
  108. data/shop_extension.rb +62 -0
  109. data/spec/controllers/admin/shop/categories_controller_spec.rb +443 -0
  110. data/spec/controllers/admin/shop/products/images_controller_spec.rb +477 -0
  111. data/spec/controllers/admin/shop/products_controller_spec.rb +394 -0
  112. data/spec/controllers/admin/shops_controller_spec.rb +19 -0
  113. data/spec/controllers/shop/categories_controller_spec.rb +42 -0
  114. data/spec/controllers/shop/line_items_controller_spec.rb +256 -0
  115. data/spec/controllers/shop/orders_controller_specs.rb +37 -0
  116. data/spec/controllers/shop/products_controller_spec.rb +51 -0
  117. data/spec/datasets/forms.rb +153 -0
  118. data/spec/datasets/images.rb +13 -0
  119. data/spec/datasets/shop_addresses.rb +27 -0
  120. data/spec/datasets/shop_categories.rb +13 -0
  121. data/spec/datasets/shop_line_items.rb +9 -0
  122. data/spec/datasets/shop_orders.rb +21 -0
  123. data/spec/datasets/shop_products.rb +34 -0
  124. data/spec/helpers/nested_tag_helper.rb +33 -0
  125. data/spec/lib/shop/models/image_spec.rb +28 -0
  126. data/spec/lib/shop/models/page_spec.rb +38 -0
  127. data/spec/lib/shop/tags/address_spec.rb +196 -0
  128. data/spec/lib/shop/tags/cart_spec.rb +169 -0
  129. data/spec/lib/shop/tags/category_spec.rb +201 -0
  130. data/spec/lib/shop/tags/core_spec.rb +16 -0
  131. data/spec/lib/shop/tags/helpers_spec.rb +381 -0
  132. data/spec/lib/shop/tags/item_spec.rb +313 -0
  133. data/spec/lib/shop/tags/product_spec.rb +334 -0
  134. data/spec/matchers/comparison.rb +72 -0
  135. data/spec/matchers/render_matcher.rb +33 -0
  136. data/spec/models/form_checkout_spec.rb +376 -0
  137. data/spec/models/shop_category_page_spec.rb +10 -0
  138. data/spec/models/shop_category_spec.rb +58 -0
  139. data/spec/models/shop_line_item_spec.rb +42 -0
  140. data/spec/models/shop_order_spec.rb +228 -0
  141. data/spec/models/shop_product_attachment_spec.rb +72 -0
  142. data/spec/models/shop_product_page_spec.rb +10 -0
  143. data/spec/models/shop_product_spec.rb +135 -0
  144. data/spec/spec.opts +6 -0
  145. data/spec/spec_helper.rb +22 -0
  146. data/vendor/plugins/acts_as_list/README +23 -0
  147. data/vendor/plugins/acts_as_list/init.rb +3 -0
  148. data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
  149. data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
  150. data/vendor/plugins/json_fields/.gitignore +3 -0
  151. data/vendor/plugins/json_fields/MIT-LICENSE +20 -0
  152. data/vendor/plugins/json_fields/README.rdoc +65 -0
  153. data/vendor/plugins/json_fields/Rakefile +55 -0
  154. data/vendor/plugins/json_fields/init.rb +2 -0
  155. data/vendor/plugins/json_fields/lib/json_fields.rb +99 -0
  156. data/vendor/plugins/json_fields/spec/lib/json_fields_spec.rb +124 -0
  157. data/vendor/plugins/json_fields/spec/spec.opts +6 -0
  158. data/vendor/plugins/json_fields/spec/spec_helper.rb +29 -0
  159. data/vendor/plugins/json_fields/spec/test_models.rb +12 -0
  160. metadata +324 -0
@@ -0,0 +1,14 @@
1
+ - @page_title = @shop_product.name + ' - ' + default_page_title
2
+
3
+ - render_region :main do |main|
4
+ - main.edit_header do
5
+ %h1
6
+ = @shop_product.name
7
+ = render 'admin/shop/products/edit/head'
8
+ - main.edit_form do
9
+ - form_for :shop_product, @shop_product, :url => admin_shop_product_path(@shop_product), :html => {:method => :put, :multipart => true, :id => 'edit_shop_product', 'data-onsubmit_status'=>"Saving Changes…"} do |f|
10
+ = f.hidden_field :id
11
+ = render :partial => 'admin/shop/products/edit/fields', :object => f
12
+ - main.edit_popups do
13
+ #popups
14
+ = render 'admin/shop/products/edit/popup'
@@ -0,0 +1,38 @@
1
+ = render_region :form_top
2
+
3
+ - render_region :form do |form|
4
+ - form.edit_name do
5
+ %p.title
6
+ %label{:for => 'shop_product_name'}= t('name')
7
+ = fields.text_field :name, :class => 'textbox', :maxlenth => 255
8
+
9
+ - form.edit_price do
10
+ %p.title
11
+ %label{:for => 'shop_product_price'}= t('price')
12
+ = fields.text_field :price, :class => 'textbox', :maxlenth => 255, :value => number_to_currency(@shop_product.price, :unit => '', :delimiter => '')
13
+
14
+ - form.edit_extended_metadata do
15
+ = render :partial => '/admin/shop/products/edit/meta', :locals => { :fields => fields }
16
+
17
+ - form.edit_content do
18
+ #tab_control
19
+ #tabs.tabs
20
+ #tab_toolbar
21
+ #pages.pages
22
+ = hidden_field_tag 'page_part_index_field' #important
23
+ = render :partial => '/admin/shop/products/edit/part', :collection => @parts
24
+
25
+ - render_region :form_bottom do |form_bottom|
26
+ - form_bottom.edit_buttons do
27
+ %p.buttons{:style=>"clear: left"}
28
+ = save_model_button(@shop_product)
29
+ = save_model_and_continue_editing_button(@shop_product)
30
+ = t('or')
31
+ = link_to t('cancel'), admin_shop_products_url
32
+ - form_bottom.edit_timestamp do
33
+ = updated_stamp @shop_product
34
+
35
+ #routes{:style => 'display:none'}
36
+
37
+ = hidden_field_tag 'admin_shop_product_images_path', admin_shop_product_images_path(@shop_product)
38
+ = hidden_field_tag 'sort_admin_shop_product_images_path', sort_admin_shop_product_images_path(@shop_product)
@@ -0,0 +1,2 @@
1
+ - @buttons.each do |button|
2
+ = render :partial => 'admin/shop/products/edit/buttons/' + button
@@ -0,0 +1,12 @@
1
+ - type = image.class.to_s == "Image" ? "image" : "attachment"
2
+ - image_id = image.class.to_s == "Image" ? image.id : image.image_id
3
+ - attachment_id = image.class.to_s == "Image" ? nil : image.id
4
+
5
+ %li.image{:id => "#{type}_#{image.id}", :'data-image_id' => image_id, :'data-attachment_id' => attachment_id }
6
+ .wrapper
7
+ %span.buffer
8
+ = image_tag image.url(:preview)
9
+ %span.title= truncate(image.title, 30, '...')
10
+ %span.caption= image.caption
11
+ .actions
12
+ %span.delete
@@ -0,0 +1,8 @@
1
+ .drawer
2
+ .drawer_contents#attributes
3
+ %table.fieldset
4
+ - @meta.each do |meta|
5
+ = render :partial => 'admin/shop/products/edit/meta/' + meta, :locals => { :f => fields }
6
+ = render_region :extended_metadata, :locals => { :f => fields }
7
+ .drawer_handle
8
+ %a.toggle{:href=>'#attributes', :rel=>"toggle[attributes]", :class=>"#{(meta_errors? ? 'less' : 'more')}"}= meta_label
@@ -0,0 +1,3 @@
1
+ .page{:id => "shop_product_#{part}", 'data-caption'=>h(part)}
2
+ .part{:id => "shop_product-part-#{part}"}
3
+ = render :partial => "admin/shop/products/edit/parts/#{part}"
@@ -0,0 +1,3 @@
1
+ = @popups.each do |popup|
2
+ .popup{ :id => "#{popup}_popup"}
3
+ = render :partial => "admin/shop/products/edit/popups/#{popup}"
@@ -0,0 +1 @@
1
+ %a#browse_images.button{:href => '#browse_images_popup', :class => 'popup'}= t("browse_images")
@@ -0,0 +1 @@
1
+ %a#new_image.button{:href => '#new_image_popup', :class => 'popup'}= image('plus') + " " + t("new_image")
@@ -0,0 +1,5 @@
1
+ %tr
2
+ %th.label
3
+ = f.label :shop_category_id, t('category')
4
+ %td.field
5
+ = f.collection_select :shop_category_id, ShopCategory.all, :id, :name
@@ -0,0 +1,5 @@
1
+ %tr
2
+ %th.label
3
+ = f.label :sku, t('sku')
4
+ %td.field
5
+ = f.text_field :sku, :class => 'textbox', :maxlength => 160
@@ -0,0 +1 @@
1
+ ~ text_area_tag 'shop_product[description]', @shop_product.description, :class => "textarea large", :style => "width: 100%", :id => "shop_product_description_content"
@@ -0,0 +1,5 @@
1
+ - unless @shop_product.new_record?
2
+ %ul#product_attachments
3
+ = render :partial => '/admin/shop/products/edit/image', :collection => @shop_product.attachments
4
+ - else
5
+ %p You can add images once you've created the product
@@ -0,0 +1,6 @@
1
+ %h3.title Browse Images
2
+
3
+ %ol#images
4
+ = render :partial => '/admin/shop/products/edit/image', :collection => @shop_product.available_images
5
+
6
+ %a#browse_images_popup_close.close{ :href => '#browse_images_popup_close' }
@@ -0,0 +1,18 @@
1
+ %h3.title Upload New Image
2
+
3
+ .popup_content
4
+ - form_for :image, :url => admin_shop_product_images_path(@shop_product.id), :html => { :method => "post", :multipart => true, :id => 'image_form' } do |f|
5
+ %ol
6
+ %li.image_title
7
+ = f.label :title, t('name')
8
+ = f.text_field :title, :class => 'clearable'
9
+ %li.image_caption
10
+ = f.label :caption, t('caption')
11
+ = f.text_field :caption, :class => 'clearable'
12
+ %li.image_file
13
+ = f.file_field :asset, :class => 'clearable'
14
+
15
+ %li.image_submit
16
+ = f.submit 'Create'
17
+
18
+ %a#new_image_popup_close.close{ :href => '#new_image_popup' }
@@ -0,0 +1,10 @@
1
+ - @page_title = t('products') + ' - ' + default_page_title
2
+
3
+ .outset
4
+
5
+ #products_map
6
+ %ul#shop_categories
7
+ = render :partial => '/admin/shop/categories/index/category', :collection => @shop_categories
8
+
9
+ #actions
10
+ = render :partial => '/admin/shop/products/index/bottom'
@@ -0,0 +1,5 @@
1
+ %ul
2
+ - render_region :bottom do |bottom|
3
+ - bottom.add_category do
4
+ %li= link_to image('plus') + " " + t("add_category"), new_admin_shop_category_path
5
+
@@ -0,0 +1,13 @@
1
+ %li.product{:id => "shop_product_#{product.id}", :'data-id' => product.id}
2
+ .attributes
3
+ %span.handle.attribute
4
+ - render_region :product do |region|
5
+ - region.product_name do
6
+ %a{ :href => edit_admin_shop_product_path(product), :name => product.name}
7
+ - unless product.attachments.empty?
8
+ %img{:src => product.attachments.first.image.url(:preview), :class => 'icon'}
9
+ %span.name.attribute= link_to product.name, edit_admin_shop_product_path(product)
10
+ %span.sku.attribute= product.sku
11
+ - region.product_modify do
12
+ .modify
13
+ %span.remove= link_to t('remove'), remove_admin_shop_product_url(product)
@@ -0,0 +1,10 @@
1
+ - render_region :main do |main|
2
+ - main.edit_header do
3
+ %h1
4
+ = t('new_product')
5
+ = render :partial => 'admin/shop/products/edit/head'
6
+ - main.edit_form do
7
+ - form_for :shop_product, @shop_product, :url => admin_shop_products_path, :html => {:id => 'new_shop_product', :multipart => true, 'data-onsubmit_status'=>"Creating Product…"} do |f|
8
+ = render :partial => 'admin/shop/products/edit/fields', :object => f
9
+ - main.edit_popups do
10
+ - #empty
@@ -0,0 +1,12 @@
1
+ %h1
2
+ = t('remove_product')
3
+
4
+ %p
5
+ = t('text.remove_product.warning')
6
+
7
+ - form_for [:admin, @shop_product.becomes(ShopProduct)], :html => {:method => :delete, 'data-onsubmit_status'=>"Removing Product…"} do
8
+
9
+ %p.buttons
10
+ %input.button{:type=>"submit", :value => t('delete_product') }/
11
+ = t('or')
12
+ = link_to t('cancel'), admin_shop_products_path
@@ -0,0 +1 @@
1
+ -# empty
@@ -0,0 +1 @@
1
+ -# empty
@@ -0,0 +1 @@
1
+ -# empty
@@ -0,0 +1 @@
1
+ -# empty
@@ -0,0 +1,50 @@
1
+ ---
2
+ en:
3
+ shop: "shop"
4
+ shop_category: "Category"
5
+ shop_categories: "Categories"
6
+ shop_product: "Product"
7
+ shop_products: "Products"
8
+ shop_order: "Order"
9
+ flash:
10
+ successfully_created: "created successfully"
11
+ successfully_updated: "updated successfully"
12
+ successfully_destroyed: "deleted successfully"
13
+ successfully_sorted: "sorted successfully"
14
+ could_not_create: "Couldn't create"
15
+ could_not_update: "Couldn't update"
16
+ could_not_destroy: "Couldn't delete"
17
+ could_not_sort: "Couldn't sort"
18
+ handle: 'Handle'
19
+ title: 'Title'
20
+ category: 'Category'
21
+ categories: 'Categories'
22
+ no_categories: 'No Categories'
23
+ add_category: 'Add Category'
24
+ new_category: 'New Shop Category'
25
+ edit_category: 'Update Shop Category'
26
+ remove_category: 'This will delete the category'
27
+ delete_category: 'Delete Category'
28
+ custom_layout: 'Layout'
29
+ custom_product_layout: 'Product Layout'
30
+ product: 'Product'
31
+ products: 'Products'
32
+ no_products: 'No Products'
33
+ add_product: 'Add Product'
34
+ new_product: 'New Shop Product'
35
+ edit_product: 'Update Shop Product'
36
+ remove_product: 'This will delete the product'
37
+ delete_product: 'Delete Product'
38
+ image: 'Image'
39
+ images: 'Images'
40
+ no_images: 'No Images'
41
+ add_image: 'Add Image'
42
+ browse_images: 'Browse Images'
43
+ caption: 'Caption'
44
+ price: 'Price'
45
+ sku: 'SKU'
46
+ text:
47
+ remove_product:
48
+ warning: "Deleting a product is irreversible, make sure you're sure."
49
+ remove_category:
50
+ warning: "Deleting a category (and its products) is irreversible, make sure you're sure."
data/config/routes.rb ADDED
@@ -0,0 +1,38 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+
3
+ map.namespace :admin do |admin|
4
+ admin.namespace :shop, :member => { :remove => :get } do |shop|
5
+
6
+ shop.resources :categories, :collection => { :sort => :put }, :member => { :products => :get } do |category|
7
+ category.resources :products, :only => :new
8
+ end
9
+
10
+ shop.resources :products, :except => :new, :collection => { :sort => :put } do |product|
11
+ product.resources :images, :controller => 'products/images', :collection => { :sort => :put }, :only => [ :index, :create, :destroy]
12
+ end
13
+
14
+ shop.resources :customers
15
+ shop.resources :orders
16
+ end
17
+
18
+ admin.resources :shops, :as => 'shop', :only => [ :index ]
19
+ end
20
+
21
+ # Maps the following routes within a prefix scope of either the configured shop.url_prefix or shop
22
+ shop_prefix = Radiant::Config['shop.url_prefix'].blank? ? 'shop' : Radiant::Config['shop.url_prefix']
23
+ map.with_options(:path_prefix => shop_prefix) do |prefix|
24
+ prefix.namespace :shop do |shop|
25
+ shop.cart_finalize 'finalize', :controller => 'orders', :action => 'finalize', :conditions => { :method => :get }
26
+ shop.product_search 'search.:format', :controller => 'products', :action => 'index', :conditions => { :method => :post }
27
+ shop.product_search 'search/:query.:format', :controller => 'products', :action => 'index', :conditions => { :method => :get }
28
+ shop.shop_product ':handle/:sku.:format', :controller => 'products', :action => 'show', :conditions => { :method => :get }
29
+ shop.shop_category ':handle.:format', :controller => 'categories',:action => 'show', :conditions => { :method => :get }
30
+ shop.shop_categories 'categories', :controller => 'categories',:action => 'index', :conditions => { :method => :get }
31
+
32
+ shop.with_options :path_prefix => "#{shop_prefix}/cart" do |cart|
33
+ cart.resources :line_items, :as => :items, :member => { :destroy => :get }
34
+ end
35
+ end
36
+ end
37
+
38
+ end
@@ -0,0 +1,16 @@
1
+ merchant_account:
2
+ name: bogus
3
+ user_name: user
4
+ password: pwd
5
+
6
+ ups_shipping:
7
+ login: bogus
8
+ password: pwd
9
+ key: xxx
10
+
11
+ usps_shipping:
12
+ login: bogus
13
+
14
+ fedex_shipping:
15
+ login: bogus
16
+ password: pwd
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --format progress features --tags ~@proposed,~@in_progress
@@ -0,0 +1,153 @@
1
+ class Initial < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :shop_products do |t|
4
+ t.string :sku
5
+ t.string :name
6
+ t.text :description
7
+ t.integer :position
8
+ t.boolean :is_active, :default => true
9
+
10
+ t.decimal :price
11
+
12
+ t.decimal :weight
13
+ t.decimal :height
14
+ t.decimal :width
15
+ t.decimal :depth
16
+
17
+ t.references :layout
18
+ t.references :shop_category
19
+
20
+ t.integer :created_by
21
+ t.integer :updated_by
22
+
23
+ t.timestamps
24
+ end
25
+ add_index :shop_products, :position
26
+ add_index :shop_products, :shop_category_id
27
+
28
+ create_table :shop_product_attachments do |t|
29
+ t.integer :position
30
+
31
+ t.references :image
32
+ t.references :shop_product
33
+ end
34
+ add_index :shop_product_attachments, :position
35
+ add_index :shop_product_attachments, :image_id
36
+ add_index :shop_product_attachments, :shop_product_id
37
+
38
+ create_table :shop_categories do |t|
39
+ t.string :name
40
+ t.string :handle
41
+ t.text :description
42
+ t.integer :position
43
+ t.boolean :is_active, :default => true
44
+
45
+ t.references :layout
46
+ t.references :product_layout
47
+
48
+ t.integer :created_by
49
+ t.integer :updated_by
50
+
51
+ t.timestamps
52
+ end
53
+
54
+ create_table :shop_addressables do |t|
55
+ t.references :address, :polymorphic => true
56
+ t.references :addresser, :polymorphic => true
57
+ end
58
+ add_index :shop_addressables, :address_id
59
+ add_index :shop_addressables, :addresser_id
60
+
61
+ create_table :shop_addresses do |t|
62
+ t.string :email
63
+ t.string :name
64
+ t.string :unit
65
+ t.string :street
66
+ t.string :city
67
+ t.string :state
68
+ t.string :postcode
69
+ t.string :country
70
+ end
71
+
72
+ create_table :shop_address_billings do |t|
73
+ t.references :shop_address
74
+ end
75
+ add_index :shop_address_billings, :shop_address_id
76
+
77
+ create_table :shop_address_shippings do |t|
78
+ t.references :shop_address
79
+ end
80
+ add_index :shop_address_shippings, :shop_address_id
81
+
82
+ create_table :shop_line_items do |t|
83
+ t.integer :quantity, :default => 1
84
+
85
+ t.references :shop_order
86
+ t.references :item, :polymorphic => true
87
+
88
+ t.integer :created_by
89
+ t.integer :updated_by
90
+
91
+ t.timestamps
92
+ end
93
+ add_index :shop_line_items, :shop_order_id
94
+ add_index :shop_line_items, :item_id
95
+
96
+ create_table :shop_orders do |t|
97
+ t.text :notes
98
+ t.text :status, :default => 'new'
99
+
100
+ t.references :shop_customer
101
+ t.references :billing
102
+ t.references :shipping
103
+
104
+ t.integer :created_by
105
+ t.integer :updated_by
106
+
107
+ t.timestamps
108
+ end
109
+ add_index :shop_orders, :shop_customer_id
110
+ add_index :shop_orders, :status
111
+
112
+ create_table :shop_payments do |t|
113
+ t.float :amount
114
+
115
+ t.references :shop_order
116
+ t.references :shop_payment_method
117
+
118
+ t.integer :created_by
119
+ t.integer :updated_by
120
+
121
+ t.timestamps
122
+ end
123
+ add_index :shop_payments, :shop_order_id
124
+ add_index :shop_payments, :shop_payment_method_id
125
+
126
+ create_table :shop_payment_methods do |t|
127
+ t.string :name
128
+ end
129
+
130
+ add_column :pages, :shop_product_id, :integer
131
+ add_column :pages, :shop_category_id, :integer
132
+
133
+ end
134
+
135
+ def self.down
136
+ drop_table :shop_products
137
+ drop_table :shop_product_images
138
+ drop_table :shop_categories
139
+ drop_table :shop_orders
140
+ drop_table :shop_order_statuses
141
+ drop_table :shop_addressables
142
+ drop_table :shop_address_shippings
143
+ drop_table :shop_address_billings
144
+ drop_table :shop_addresses
145
+ drop_table :shop_line_items
146
+ drop_table :shop_orders
147
+ drop_table :shop_payments
148
+ drop_table :shop_payment_methods
149
+
150
+ remove_column :pages, :shop_product_id
151
+ remove_column :pages, :shop_category_id
152
+ end
153
+ end