refinerycms-products 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/app/controllers/addresses_controller.rb +22 -0
  2. data/app/controllers/admin/carts_controller.rb +7 -0
  3. data/app/controllers/admin/categories_controller.rb +50 -0
  4. data/app/controllers/admin/customers_controller.rb +12 -0
  5. data/app/controllers/admin/line_items_controller.rb +7 -0
  6. data/app/controllers/admin/products_controller.rb +23 -0
  7. data/app/controllers/carts_controller.rb +110 -0
  8. data/app/controllers/categories_controller.rb +32 -0
  9. data/app/controllers/customers_controller.rb +33 -0
  10. data/app/controllers/line_items_controller.rb +8 -0
  11. data/app/controllers/products_controller.rb +61 -0
  12. data/app/controllers/profiles_controller.rb +37 -0
  13. data/app/helpers/address_helper.rb +20 -0
  14. data/app/helpers/products_helper.rb +34 -0
  15. data/app/models/address.rb +18 -0
  16. data/app/models/cart.rb +54 -0
  17. data/app/models/category.rb +28 -0
  18. data/app/models/customer.rb +32 -0
  19. data/app/models/line_item.rb +28 -0
  20. data/app/models/product.rb +46 -0
  21. data/app/views/addresses/edit.html.erb +42 -0
  22. data/app/views/admin/carts/_actions.html.erb +28 -0
  23. data/app/views/admin/carts/_cart.html.erb +18 -0
  24. data/app/views/admin/carts/_carts.html.erb +2 -0
  25. data/app/views/admin/carts/_form.html.erb +24 -0
  26. data/app/views/admin/carts/_records.html.erb +18 -0
  27. data/app/views/admin/carts/_sortable_list.html.erb +7 -0
  28. data/app/views/admin/carts/edit.html.erb +1 -0
  29. data/app/views/admin/carts/index.html.erb +10 -0
  30. data/app/views/admin/carts/new.html.erb +1 -0
  31. data/app/views/admin/categories/_actions.html.erb +28 -0
  32. data/app/views/admin/categories/_categories.html.erb +2 -0
  33. data/app/views/admin/categories/_category.html.erb +25 -0
  34. data/app/views/admin/categories/_form.html.erb +49 -0
  35. data/app/views/admin/categories/_records.html.erb +18 -0
  36. data/app/views/admin/categories/_sortable_list.html.erb +10 -0
  37. data/app/views/admin/categories/edit.html.erb +1 -0
  38. data/app/views/admin/categories/index.html.erb +12 -0
  39. data/app/views/admin/categories/new.html.erb +1 -0
  40. data/app/views/admin/customers/_actions.html.erb +28 -0
  41. data/app/views/admin/customers/_customer.html.erb +18 -0
  42. data/app/views/admin/customers/_customers.html.erb +2 -0
  43. data/app/views/admin/customers/_form.html.erb +40 -0
  44. data/app/views/admin/customers/_records.html.erb +18 -0
  45. data/app/views/admin/customers/_sortable_list.html.erb +7 -0
  46. data/app/views/admin/customers/edit.html.erb +1 -0
  47. data/app/views/admin/customers/index.html.erb +10 -0
  48. data/app/views/admin/customers/new.html.erb +1 -0
  49. data/app/views/admin/customers/show.html.erb +60 -0
  50. data/app/views/admin/line_items/_actions.html.erb +28 -0
  51. data/app/views/admin/line_items/_form.html.erb +29 -0
  52. data/app/views/admin/line_items/_line_item.html.erb +18 -0
  53. data/app/views/admin/line_items/_line_items.html.erb +2 -0
  54. data/app/views/admin/line_items/_records.html.erb +18 -0
  55. data/app/views/admin/line_items/_sortable_list.html.erb +7 -0
  56. data/app/views/admin/line_items/edit.html.erb +1 -0
  57. data/app/views/admin/line_items/index.html.erb +10 -0
  58. data/app/views/admin/line_items/new.html.erb +1 -0
  59. data/app/views/admin/products/_actions.html.erb +43 -0
  60. data/app/views/admin/products/_form.html.erb +120 -0
  61. data/app/views/admin/products/_product.html.erb +24 -0
  62. data/app/views/admin/products/_products.html.erb +2 -0
  63. data/app/views/admin/products/_records.html.erb +18 -0
  64. data/app/views/admin/products/_sortable_list.html.erb +13 -0
  65. data/app/views/admin/products/edit.html.erb +1 -0
  66. data/app/views/admin/products/index.html.erb +12 -0
  67. data/app/views/admin/products/new.html.erb +1 -0
  68. data/app/views/carts/show.html.erb +56 -0
  69. data/app/views/categories/index.html.erb +11 -0
  70. data/app/views/categories/show.html.erb +33 -0
  71. data/app/views/customers/index.html.erb +11 -0
  72. data/app/views/customers/show.html.erb +52 -0
  73. data/app/views/line_items/index.html.erb +11 -0
  74. data/app/views/line_items/show.html.erb +39 -0
  75. data/app/views/products/index.html.erb +33 -0
  76. data/app/views/products/show.html.erb +65 -0
  77. data/app/views/profiles/_order_history.html.erb +24 -0
  78. data/app/views/profiles/_show_address.html.erb +4 -0
  79. data/app/views/profiles/account_details.html.erb +32 -0
  80. data/app/views/profiles/address_details.html.erb +10 -0
  81. data/app/views/profiles/index.html.erb +75 -0
  82. data/app/views/profiles/order_history.html.erb +1 -0
  83. data/app/views/profiles/order_history_details.html.erb +39 -0
  84. data/config/locales/en.yml +97 -0
  85. data/config/locales/fr.yml +25 -0
  86. data/config/locales/lolcat.yml +25 -0
  87. data/config/locales/nb.yml +21 -0
  88. data/config/locales/nl.yml +21 -0
  89. data/config/routes.rb +58 -0
  90. data/lib/generators/refinerycms_products_generator.rb +6 -0
  91. data/lib/refinerycms-carts.rb +32 -0
  92. data/lib/refinerycms-categories.rb +30 -0
  93. data/lib/refinerycms-customers.rb +34 -0
  94. data/lib/refinerycms-line_items.rb +30 -0
  95. data/lib/refinerycms-products.rb +65 -0
  96. data/lib/tasks/products.rake +13 -0
  97. metadata +160 -0
@@ -0,0 +1,75 @@
1
+ <h2>Customer Profile</h2>
2
+
3
+ <div class="account">
4
+ <h3>Account Details</h3>
5
+
6
+ <div class='newform'>
7
+ <%= form_for(@current_customer) do |f| %>
8
+
9
+ <%= f.label :name %>
10
+ <div class='input'>
11
+ <%= f.text_field :name, :disabled => true %>
12
+ </div>
13
+
14
+ <%= f.label :surname %>
15
+ <div class='input'>
16
+ <%= f.text_field :surname, :disabled => true %>
17
+ </div>
18
+
19
+ <%= f.label :contact_number %>
20
+ <div class='input'>
21
+ <%= f.text_field :contact_number, :disabled => true %>
22
+ </div>
23
+
24
+ <%= f.label :email %>
25
+ <div class='input'>
26
+ <%= f.email_field :email, :disabled => true %>
27
+ </div>
28
+ <% end %>
29
+
30
+
31
+ <div class="clear"></div>
32
+ <p><%= link_to "Edit Details", edit_customer_registration_path %></p>
33
+
34
+ </div>
35
+ </div>
36
+
37
+ <% if @delivery_addresses.present? %>
38
+ <div class="account">
39
+ <h3>Addresses</h3>
40
+
41
+ <% @delivery_addresses.each do |address| %>
42
+ <%= render :partial => 'show_address', :locals => {:address => address, :url_text => 'Edit this address', :url => edit_address_path(address)} %>
43
+ <% end %>
44
+ </div>
45
+ <% end %>
46
+ <div class="clear"></div>
47
+
48
+ <% if @orders.present? then %>
49
+ <div class="order">
50
+ <div>
51
+ <h3>Order History</h3>
52
+
53
+ <table>
54
+ <tr>
55
+ <th>Order Number</th>
56
+ <th>Status</th>
57
+ <th>Date</th>
58
+ <th>Total Price</th>
59
+ </tr>
60
+ <% @orders.each do |order| %>
61
+ <tr class="<%= cycle('odd', 'even') %>">
62
+ <td><%= link_to order.order_number, order_history_details_path(order.order_number) %></td>
63
+ <td><%= order.order_status %></td>
64
+ <td><%= order.created_at.strftime("%m/%d/%Y") if order.created_at.present? %></td>
65
+ <td><%= order.grand_total if order.grand_total.present? %></td>
66
+ </tr>
67
+ <% end %>
68
+ </table>
69
+ </div>
70
+ <p><%= link_to "View Full Order History", order_history_path %></p>
71
+ </div>
72
+ <% end %>
73
+
74
+
75
+
@@ -0,0 +1 @@
1
+ <%= render :partial => "order_history" if @orders.present? %>
@@ -0,0 +1,39 @@
1
+ <% if @current_order.present? then %>
2
+ <div class="confirmOrder">
3
+ <h2 class="category ordernumber">Order Number: <%= @current_order.order_number %></h2>
4
+ <h3 class="date"><%= @current_order.created_at.strftime("%d %B %Y") unless @current_order.created_at.blank? %></h3>
5
+ <div class="clear"></div>
6
+
7
+ <table>
8
+ <tr>
9
+ <th class="left">Product</th>
10
+ <th>Price</th>
11
+ <th>Quantity</th>
12
+ <th>Total</th>
13
+ </tr>
14
+ <% order = @current_order
15
+
16
+ total_price = order.grand_total %>
17
+
18
+
19
+ <% order.order_items.each do |order_item| %>
20
+ <tr class="<%= cycle('odd', 'even') %>">
21
+ <td class="first"><%= order_item.product_name %></td>
22
+ <td><%= rands(order_item.price) %></td>
23
+ <td><%= order_item.quantity %></td>
24
+ <td><%= rands(order_item.total) %></td>
25
+ </tr>
26
+ <% end %>
27
+
28
+
29
+ <tr>
30
+ <td class="total first" colspan="3">TOTAL PRICE</td>
31
+ <td class="total"><%= rands(total_price) %></td>
32
+ </tr>
33
+
34
+ </table>
35
+ </div>
36
+ <% end %>
37
+
38
+ <%= link_to "Back", :back %>
39
+
@@ -0,0 +1,97 @@
1
+ en:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: image
6
+ plugins:
7
+ line_items:
8
+ title: Line Items
9
+ carts:
10
+ title: Carts
11
+ customers:
12
+ title: Customers
13
+ products:
14
+ title: Products
15
+ categories:
16
+ title: Categories
17
+ admin:
18
+ line_items:
19
+ actions:
20
+ reorder: Reorder Line Items
21
+ create_new: Add New Line Item
22
+ reorder_done: Done Reordering Line Items
23
+ records:
24
+ no_items_yet: There are no Line Items yet. Click "Add New Line Item" to add your first line item.
25
+ title: Line Items
26
+ sorry_no_results: Sorry! There are no results found.
27
+ line_item:
28
+ edit: Edit this line item
29
+ delete: Remove this line item forever
30
+ view_live_html: View this line item live <br/><em>(opens in a new window)</em>
31
+ carts:
32
+ cart:
33
+ edit: Edit this cart
34
+ delete: Remove this cart forever
35
+ view_live_html: View this cart live <br/><em>(opens in a new window)</em>
36
+ actions:
37
+ reorder: Reorder Carts
38
+ create_new: Add New Cart
39
+ reorder_done: Done Reordering Carts
40
+ records:
41
+ no_items_yet: There are no Carts yet. Click "Add New Cart" to add your first cart.
42
+ title: Carts
43
+ sorry_no_results: Sorry! There are no results found.
44
+ customers:
45
+ actions:
46
+ create_new: Add New Customer
47
+ reorder: Reorder Customers
48
+ reorder_done: Done Reordering Customers
49
+ records:
50
+ title: Customers
51
+ sorry_no_results: Sorry! There are no results found.
52
+ no_items_yet: There are no Customers yet. Click "Add New Customer" to add your first customer.
53
+ customer:
54
+ view_live_html: View this customer live <br/><em>(opens in a new window)</em>
55
+ edit: Edit this customer
56
+ delete: Remove this customer forever
57
+ categories:
58
+ actions:
59
+ create_new: Add New Category
60
+ reorder: Reorder Categories
61
+ reorder_done: Done Reordering Categories
62
+ records:
63
+ title: Categories
64
+ sorry_no_results: Sorry! There are no results found.
65
+ no_items_yet: There are no Categories yet. Click "Add New Category" to add your first category.
66
+ category:
67
+ view_live_html: View this category live <br/><em>(opens in a new window)</em>
68
+ edit: Edit this category
69
+ delete: Remove this category forever
70
+ products:
71
+ actions:
72
+ create_new: Add New Product
73
+ reorder: Reorder Products
74
+ reorder_done: Done Reordering Products
75
+ records:
76
+ title: Products
77
+ sorry_no_results: Sorry! There are no results found.
78
+ no_items_yet: There are no Products yet. Click "Add New Product" to add your first product.
79
+ product:
80
+ view_live_html: View this product live <br/><em>(opens in a new window)</em>
81
+ edit: Edit this product
82
+ delete: Remove this product forever
83
+ categories:
84
+ show:
85
+ other: Other Categories
86
+ products:
87
+ show:
88
+ other: Other Products
89
+ customers:
90
+ show:
91
+ other: Other Customers
92
+ line_items:
93
+ show:
94
+ other: Other Line Items
95
+ carts:
96
+ show:
97
+ other: Other Carts
@@ -0,0 +1,25 @@
1
+ fr:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: image
6
+ plugins:
7
+ products:
8
+ title: Products
9
+ admin:
10
+ products:
11
+ actions:
12
+ create_new: Créer un(e) nouve(au/l/lle) Product
13
+ reorder: Réordonner les Products
14
+ reorder_done: Fin de réordonnancement des Products
15
+ records:
16
+ title: Products
17
+ sorry_no_results: "Désolé ! Aucun résultat."
18
+ no_items_yet: 'Il n''y a actuellement aucun(e) Product. Cliquer sur "Créer un(e) nouve(au/l/lle) Product" pour créer votre premi(er/ère) product.'
19
+ product:
20
+ view_live_html: Voir ce(t/tte) product <br/><em>(Ouvre une nouvelle fenêtre)</em>
21
+ edit: Modifier ce(t/tte) product
22
+ delete: Supprimer définitivement ce(t/tte) product
23
+ products:
24
+ show:
25
+ other: Autres Products
@@ -0,0 +1,25 @@
1
+ lolcat:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: IMAGE
6
+ plugins:
7
+ products:
8
+ title: Products
9
+ admin:
10
+ products:
11
+ actions:
12
+ create_new: CREATE NEW Product
13
+ reorder: REORDR Products
14
+ reorder_done: DUN REORDERIN Products
15
+ records:
16
+ title: Products
17
+ sorry_no_results: SRY! THAR R NO RESULTS FINDZ.
18
+ no_items_yet: THAR R NO Products YET. CLICK "CREATE NEW Product" 2 ADD UR FURST product.
19
+ product:
20
+ view_live_html: VIEW DIS product LIV <BR/><EM>(OPENS IN NEW WINDOW)</EM>
21
+ edit: EDIT DIS product
22
+ delete: REMOOV DIS product FOREVR
23
+ products:
24
+ show:
25
+ other: OTHR Products
@@ -0,0 +1,21 @@
1
+ nb:
2
+ plugins:
3
+ products:
4
+ title: Products
5
+ admin:
6
+ products:
7
+ actions:
8
+ create_new: Lag en ny Product
9
+ reorder: Endre rekkefølgen på Products
10
+ reorder_done: Ferdig å endre rekkefølgen Products
11
+ records:
12
+ title: Products
13
+ sorry_no_results: Beklager! Vi fant ikke noen resultater.
14
+ no_items_yet: Det er ingen Products enda. Klikk på "Lag en ny Product" for å legge til din første product.
15
+ product:
16
+ view_live_html: Vis hvordan denne product ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
17
+ edit: Rediger denne product
18
+ delete: Fjern denne product permanent
19
+ products:
20
+ show:
21
+ other: Andre Products
@@ -0,0 +1,21 @@
1
+ nl:
2
+ plugins:
3
+ products:
4
+ title: Products
5
+ admin:
6
+ products:
7
+ actions:
8
+ create_new: Maak een nieuwe Product
9
+ reorder: Wijzig de volgorde van de Products
10
+ reorder_done: Klaar met het wijzingen van de volgorde van de Products
11
+ records:
12
+ title: Products
13
+ sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
14
+ no_items_yet: Er zijn nog geen Products. Druk op 'Maak een nieuwe Product' om de eerste aan te maken.
15
+ product:
16
+ view_live_html: Bekijk deze product op de website <br/><em>(opent een nieuw venster)</em>
17
+ edit: Bewerk deze product
18
+ delete: Verwijder deze product voor eeuwig
19
+ products:
20
+ show:
21
+ other: Andere Products
data/config/routes.rb ADDED
@@ -0,0 +1,58 @@
1
+ ::Refinery::Application.routes.draw do
2
+ devise_for :customers
3
+
4
+ resources :products, :only => [:index, :show]
5
+
6
+ resources :categories, :only => [:index, :show] do
7
+ resources :products, :only => [:index, :show]
8
+ end
9
+
10
+ resources :customers, :only => [:show]
11
+ resources :addresses
12
+ resources :profiles
13
+ resources :carts, :only => [:show]
14
+ resources :line_items, :only => [:delete]
15
+
16
+ match "account_details" => "profiles#account_details", :as => "account_details"
17
+ match "address_details" => "profiles#address_details", :as => "address_details"
18
+
19
+ match "add_to_cart/:product_id" => "carts#add_to_cart", :as => "add_to_cart"
20
+ match "show_cart" => "carts#show_cart", :as => "show_cart"
21
+ match "increment_cart/:product_id" => "carts#increment_cart", :as => "increment_cart"
22
+ match "destroy_line_item/:id" => "line_items#destroy", :as => "destroy_line_item"
23
+
24
+ # Famous Categories
25
+ match 'best_selling' => 'products#best_selling', :as => :best_selling
26
+ match 'featured' => 'products#featured', :as => :featured
27
+ match 'new_product' => 'products#new_product', :as => :new_product
28
+
29
+ scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
30
+ resources :products do
31
+ collection do
32
+ put :update_prices
33
+ post :update_positions
34
+ end
35
+ end
36
+ resources :categories, :except => :show do
37
+ resources :products
38
+ collection do
39
+ post :update_positions
40
+ end
41
+ end
42
+ resources :customers do
43
+ collection do
44
+ post :update_positions
45
+ end
46
+ end
47
+ resources :carts, :except => :show do
48
+ collection do
49
+ post :update_positions
50
+ end
51
+ end
52
+ resources :line_items, :except => :show do
53
+ collection do
54
+ post :update_positions
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,6 @@
1
+ class RefinerycmsProducts < Refinery::Generators::EngineInstaller
2
+
3
+ source_root File.expand_path('../../../', __FILE__)
4
+ engine_name "products"
5
+
6
+ end
@@ -0,0 +1,32 @@
1
+ require 'refinerycms-base'
2
+
3
+ module Refinery
4
+ module Carts
5
+
6
+ class << self
7
+ attr_accessor :root
8
+ def root
9
+ @root ||= Pathname.new(File.expand_path('../../', __FILE__))
10
+ end
11
+ end
12
+
13
+ class Engine < Rails::Engine
14
+ initializer "static assets" do |app|
15
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
16
+ end
17
+
18
+ config.after_initialize do
19
+ Refinery::Plugin.register do |plugin|
20
+ plugin.name = "carts"
21
+ plugin.pathname = root
22
+ plugin.activity = {
23
+ :class => Cart
24
+ }
25
+ plugin.hide_from_menu = true
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ require File.expand_path('../refinerycms-line_items', __FILE__)
@@ -0,0 +1,30 @@
1
+ require 'refinerycms-base'
2
+
3
+ module Refinery
4
+ module Categories
5
+
6
+ class << self
7
+ attr_accessor :root
8
+ def root
9
+ @root ||= Pathname.new(File.expand_path('../../', __FILE__))
10
+ end
11
+ end
12
+
13
+ class Engine < Rails::Engine
14
+ initializer "static assets" do |app|
15
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
16
+ end
17
+
18
+ config.after_initialize do
19
+ Refinery::Plugin.register do |plugin|
20
+ plugin.name = "categories"
21
+ plugin.pathname = root
22
+ plugin.activity = {
23
+ :class => Category,
24
+ :title => 'name'
25
+ }
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ require 'refinerycms-base'
2
+
3
+ module Refinery
4
+ module Customers
5
+
6
+ class << self
7
+ attr_accessor :root
8
+ def root
9
+ @root ||= Pathname.new(File.expand_path('../../', __FILE__))
10
+ end
11
+ end
12
+
13
+ class Engine < Rails::Engine
14
+ initializer "static assets" do |app|
15
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
16
+ end
17
+
18
+ initializer 'Customer.helper' do |app|
19
+ ActionView::Base.send :include, AddressHelper
20
+ end
21
+
22
+ config.after_initialize do
23
+ Refinery::Plugin.register do |plugin|
24
+ plugin.name = "customers"
25
+ plugin.pathname = root
26
+ plugin.activity = {
27
+ :class => Customer,
28
+ :title => 'name'
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,30 @@
1
+ require 'refinerycms-base'
2
+
3
+ module Refinery
4
+ module LineItems
5
+
6
+ class << self
7
+ attr_accessor :root
8
+ def root
9
+ @root ||= Pathname.new(File.expand_path('../../', __FILE__))
10
+ end
11
+ end
12
+
13
+ class Engine < Rails::Engine
14
+ initializer "static assets" do |app|
15
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
16
+ end
17
+
18
+ config.after_initialize do
19
+ Refinery::Plugin.register do |plugin|
20
+ plugin.name = "line_items"
21
+ plugin.pathname = root
22
+ plugin.activity = {
23
+ :class => LineItem
24
+ }
25
+ plugin.hide_from_menu = true
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,65 @@
1
+ require 'refinerycms-base'
2
+ require 'refinerycms-categories'
3
+ require 'refinerycms-customers'
4
+ require 'refinerycms-carts'
5
+ require 'refinerycms-line_items'
6
+ require 'refinery'
7
+
8
+ module Refinery
9
+ module Products
10
+
11
+ class << self
12
+ attr_accessor :root
13
+ def root
14
+ @root ||= Pathname.new(File.expand_path('../../', __FILE__))
15
+ end
16
+ end
17
+
18
+ class Engine < Rails::Engine
19
+ initializer "static assets" do |app|
20
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
21
+ end
22
+
23
+ initializer 'Products.helper' do |app|
24
+ ActionView::Base.send :include, ProductsHelper
25
+ end
26
+
27
+ #refinery.after_inclusion do
28
+ # #Page.send :has_many_page_images
29
+ # #Product.class_eval { has_many :variants }
30
+ # #LineItem.class_eval { belongs_to :variant}
31
+ #
32
+ # #require 'line_item'
33
+ # #require 'product'
34
+ #
35
+ # LineItem rescue NameError #this is the ugliest thing ever. Need to reference so it autoloads and then we check for it
36
+ # Product rescue NameError #this is the ugliest thing ever. Need to reference so it autoloads and then we check for it
37
+ #
38
+ # puts "******************************** defined?(LineItem)= #{defined?(LineItem)}"
39
+ # puts "******************************** defined?(Product)= #{defined?(Product)}"
40
+ #
41
+ # Product.class_eval { has_many :variants }
42
+ # LineItem.class_eval { belongs_to :variant}
43
+ #
44
+ # #LineItem.send :include, Refinery::Variants::LineItemExtender
45
+ # #Product.send :include, Refinery::Variants::ProductExtender
46
+ #end
47
+
48
+ #config.to_prepare do
49
+ # Product.class_eval { has_many :variants }
50
+ # LineItem.class_eval { belongs_to :variant}
51
+ #end
52
+
53
+ config.after_initialize do
54
+ Refinery::Plugin.register do |plugin|
55
+ plugin.name = "products"
56
+ plugin.pathname = root
57
+ plugin.activity = {
58
+ :class => Product,
59
+ :title => 'name'
60
+ }
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :products do
4
+
5
+ # call this task my running: rake refinery:products:my_task
6
+ # desc "Description of my task below"
7
+ # task :my_task => :environment do
8
+ # # add your logic here
9
+ # end
10
+
11
+ end
12
+
13
+ end