refinerycms-products 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ class CreateAddresses < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :addresses do |t|
4
+ t.string :address_line_1
5
+ t.string :address_line_2
6
+ t.string :suburb
7
+ t.string :city
8
+ t.string :postal_code
9
+ t.references :customer
10
+
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+
16
+ def self.down
17
+ drop_table :addresses
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ class DefaultAddedToAddress < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :addresses, :default, :boolean
4
+ end
5
+
6
+ def self.down
7
+ remove_column :addresses, :default
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ class CreateCarts < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :carts do |t|
5
+ t.references :customer
6
+ t.boolean :is_current
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :carts, :id
13
+
14
+ load(Rails.root.join('db', 'seeds', 'carts.rb'))
15
+ end
16
+
17
+ def self.down
18
+ if defined?(UserPlugin)
19
+ UserPlugin.destroy_all({:name => "carts"})
20
+ end
21
+
22
+ #if defined?(Page)
23
+ # Page.delete_all({:link_url => "/carts"})
24
+ #end
25
+
26
+ drop_table :carts
27
+ end
28
+
29
+ end
@@ -0,0 +1,30 @@
1
+ class CreateLineItems < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :line_items do |t|
5
+ t.references :cart
6
+ t.references :product
7
+ t.integer :quantity
8
+ t.integer :position
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :line_items, :id
14
+
15
+ load(Rails.root.join('db', 'seeds', 'line_items.rb'))
16
+ end
17
+
18
+ def self.down
19
+ if defined?(UserPlugin)
20
+ UserPlugin.destroy_all({:name => "line_items"})
21
+ end
22
+
23
+ #if defined?(Page)
24
+ # Page.delete_all({:link_url => "/line_items"})
25
+ #end
26
+
27
+ drop_table :line_items
28
+ end
29
+
30
+ end
@@ -0,0 +1,9 @@
1
+ class FieldsAddedToLineItems < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :line_items, :variant_id, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :line_items, :variant_id
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ class CreateCategories < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :categories do |t|
5
+ t.string :name
6
+ t.integer :parent_id
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :categories, :id
13
+
14
+ load(Rails.root.join('db', 'seeds', 'categories.rb'))
15
+ end
16
+
17
+ def self.down
18
+ if defined?(UserPlugin)
19
+ UserPlugin.destroy_all({:name => "categories"})
20
+ end
21
+
22
+ #if defined?(Page)
23
+ # Page.delete_all({:link_url => "/categories"})
24
+ #end
25
+
26
+ drop_table :categories
27
+ end
28
+
29
+ end
@@ -0,0 +1,9 @@
1
+ class DescriptionAddedToCategory < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :categories, :description, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :categories, :description
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ class FieldsAddedToCategory < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :categories, :lft, :integer
4
+ add_column :categories, :rgt, :integer
5
+ add_column :categories, :depth, :integer
6
+ end
7
+
8
+ def self.down
9
+ remove_column :categories, :depth
10
+ remove_column :categories, :rgt
11
+ remove_column :categories, :lft
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ class TableCreateBannersCategories < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :banners_categories, :id => false do |t|
4
+ t.integer :category_id
5
+ t.integer :banner_id
6
+ t.timestamps
7
+ end
8
+
9
+ add_index :banners_categories, :category_id
10
+ add_index :banners_categories, :banner_id
11
+ end
12
+
13
+ def self.down
14
+ drop_table :banners_categories
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ class CreateCategoriesProducts < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :categories_products, :id => false do |t|
4
+ t.integer :category_id
5
+ t.integer :product_id
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :categories_products
12
+ end
13
+ end
@@ -0,0 +1,32 @@
1
+ class CreateProducts < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :products do |t|
5
+ t.string :name
6
+ t.string :description
7
+ t.text :summary
8
+ t.decimal :price
9
+ t.integer :image_id
10
+ t.integer :position
11
+
12
+ t.timestamps
13
+ end
14
+
15
+ add_index :products, :id
16
+
17
+ load(Rails.root.join('db', 'seeds', 'products.rb'))
18
+ end
19
+
20
+ def self.down
21
+ if defined?(UserPlugin)
22
+ UserPlugin.destroy_all({:name => "products"})
23
+ end
24
+
25
+ #if defined?(Page)
26
+ # Page.delete_all({:link_url => "/products"})
27
+ #end
28
+
29
+ drop_table :products
30
+ end
31
+
32
+ end
@@ -0,0 +1,13 @@
1
+ class FieldsAddedToProduct < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :products, :best_seller, :boolean
4
+ add_column :products, :featured, :boolean
5
+ add_column :products, :new_product, :boolean
6
+ end
7
+
8
+ def self.down
9
+ remove_column :products, :new_product
10
+ remove_column :products, :featured
11
+ remove_column :products, :best_seller
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ class StockCodeAddedToProduct < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :products, :stock_code, :string
4
+ end
5
+
6
+ def self.down
7
+ remove_column :products, :stock_code
8
+ end
9
+ end
@@ -0,0 +1,39 @@
1
+ class DeviseCreateCustomers < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :customers do |t|
5
+ t.string :name
6
+ t.string :surname
7
+ t.string :contact_number
8
+
9
+ t.database_authenticatable :null => false
10
+ t.recoverable
11
+ t.rememberable
12
+ t.trackable
13
+
14
+ t.timestamps
15
+ end
16
+
17
+ add_index :customers, :id
18
+ add_index :customers, :email, :unique => true
19
+ add_index :customers, :reset_password_token, :unique => true
20
+ # add_index :customers, :confirmation_token, :unique => true
21
+ # add_index :customers, :unlock_token, :unique => true
22
+ # add_index :customers, :authentication_token, :unique => true
23
+
24
+ load(Rails.root.join('db', 'seeds', 'customers.rb'))
25
+ end
26
+
27
+ def self.down
28
+ if defined?(UserPlugin)
29
+ UserPlugin.destroy_all({:name => "customers"})
30
+ end
31
+
32
+ #if defined?(Page)
33
+ # Page.delete_all({:link_url => "/customers"})
34
+ #end
35
+
36
+ drop_table :customers
37
+ end
38
+
39
+ end
data/db/seeds/carts.rb ADDED
@@ -0,0 +1,21 @@
1
+ if defined?(User)
2
+ User.all.each do |user|
3
+ if user.plugins.where(:name => 'carts').blank?
4
+ user.plugins.create(:name => 'carts',
5
+ :position => (user.plugins.maximum(:position) || -1) +1)
6
+ end
7
+ end
8
+ end
9
+
10
+ #if defined?(Page)
11
+ # page = Page.create(
12
+ # :title => 'Carts',
13
+ # :link_url => '/carts',
14
+ # :deletable => false,
15
+ # :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
16
+ # :menu_match => '^/carts(\/|\/.+?|)$'
17
+ # )
18
+ # Page.default_parts.each do |default_page_part|
19
+ # page.parts.create(:title => default_page_part, :body => nil)
20
+ # end
21
+ #end
@@ -0,0 +1,21 @@
1
+ if defined?(User)
2
+ User.all.each do |user|
3
+ if user.plugins.where(:name => 'categories').blank?
4
+ user.plugins.create(:name => 'categories',
5
+ :position => (user.plugins.maximum(:position) || -1) +1)
6
+ end
7
+ end
8
+ end
9
+
10
+ if defined?(Page)
11
+ page = Page.create(
12
+ :title => 'Categories',
13
+ :link_url => '/categories',
14
+ :deletable => false,
15
+ :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
16
+ :menu_match => '^/categories(\/|\/.+?|)$'
17
+ )
18
+ Page.default_parts.each do |default_page_part|
19
+ page.parts.create(:title => default_page_part, :body => nil)
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ if defined?(User)
2
+ User.all.each do |user|
3
+ if user.plugins.where(:name => 'customers').blank?
4
+ user.plugins.create(:name => 'customers',
5
+ :position => (user.plugins.maximum(:position) || -1) +1)
6
+ end
7
+ end
8
+ end
9
+
10
+ #if defined?(Page)
11
+ # page = Page.create(
12
+ # :title => 'Customers',
13
+ # :link_url => '/customers',
14
+ # :deletable => false,
15
+ # :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
16
+ # :menu_match => '^/customers(\/|\/.+?|)$'
17
+ # )
18
+ # Page.default_parts.each do |default_page_part|
19
+ # page.parts.create(:title => default_page_part, :body => nil)
20
+ # end
21
+ #end
@@ -0,0 +1,21 @@
1
+ if defined?(User)
2
+ User.all.each do |user|
3
+ if user.plugins.where(:name => 'line_items').blank?
4
+ user.plugins.create(:name => 'line_items',
5
+ :position => (user.plugins.maximum(:position) || -1) +1)
6
+ end
7
+ end
8
+ end
9
+
10
+ #if defined?(Page)
11
+ # page = Page.create(
12
+ # :title => 'Line Items',
13
+ # :link_url => '/line_items',
14
+ # :deletable => false,
15
+ # :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
16
+ # :menu_match => '^/line_items(\/|\/.+?|)$'
17
+ # )
18
+ # Page.default_parts.each do |default_page_part|
19
+ # page.parts.create(:title => default_page_part, :body => nil)
20
+ # end
21
+ #end
@@ -0,0 +1,21 @@
1
+ if defined?(User)
2
+ User.all.each do |user|
3
+ if user.plugins.where(:name => 'products').blank?
4
+ user.plugins.create(:name => 'products',
5
+ :position => (user.plugins.maximum(:position) || -1) +1)
6
+ end
7
+ end
8
+ end
9
+
10
+ if defined?(Page)
11
+ page = Page.create(
12
+ :title => 'Products',
13
+ :link_url => '/products',
14
+ :deletable => false,
15
+ :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
16
+ :menu_match => '^/products(\/|\/.+?|)$'
17
+ )
18
+ Page.default_parts.each do |default_page_part|
19
+ page.parts.create(:title => default_page_part, :body => nil)
20
+ end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-products
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -130,6 +130,25 @@ files:
130
130
  - app/views/profiles/order_history_details.html.erb
131
131
  - app/views/profiles/_order_history.html.erb
132
132
  - app/views/profiles/_show_address.html.erb
133
+ - db/migrate/10_create_addresses.rb
134
+ - db/migrate/11_default_added_to_address.rb
135
+ - db/migrate/12_create_carts.rb
136
+ - db/migrate/13_create_line_items.rb
137
+ - db/migrate/14_fields_added_to_line_items.rb
138
+ - db/migrate/1_create_categories.rb
139
+ - db/migrate/2_description_added_to_category.rb
140
+ - db/migrate/3_fields_added_to_category.rb
141
+ - db/migrate/4_table_create_banners_categories.rb
142
+ - db/migrate/5_create_categories_products.rb
143
+ - db/migrate/6_create_products.rb
144
+ - db/migrate/7_fields_added_to_product.rb
145
+ - db/migrate/8_stock_code_added_to_product.rb
146
+ - db/migrate/9_devise_create_customers.rb
147
+ - db/seeds/carts.rb
148
+ - db/seeds/categories.rb
149
+ - db/seeds/customers.rb
150
+ - db/seeds/line_items.rb
151
+ - db/seeds/products.rb
133
152
  homepage: https://github.com/julesce/refinerycms-products
134
153
  licenses: []
135
154
  post_install_message: