refinerycms-products 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/addresses_controller.rb +22 -22
- data/app/controllers/admin/carts_controller.rb +7 -7
- data/app/controllers/admin/categories_controller.rb +50 -50
- data/app/controllers/admin/customers_controller.rb +12 -12
- data/app/controllers/admin/line_items_controller.rb +7 -7
- data/app/controllers/admin/products_controller.rb +23 -23
- data/app/controllers/carts_controller.rb +110 -110
- data/app/controllers/categories_controller.rb +32 -32
- data/app/controllers/customers_controller.rb +33 -33
- data/app/controllers/line_items_controller.rb +8 -8
- data/app/controllers/products_controller.rb +61 -61
- data/app/controllers/profiles_controller.rb +36 -36
- data/app/helpers/address_helper.rb +20 -20
- data/app/helpers/products_helper.rb +41 -33
- data/app/models/address.rb +18 -18
- data/app/models/cart.rb +54 -54
- data/app/models/category.rb +28 -28
- data/app/models/customer.rb +32 -32
- data/app/models/line_item.rb +28 -28
- data/app/models/product.rb +46 -46
- data/app/views/addresses/edit.html.erb +42 -42
- data/app/views/admin/carts/_actions.html.erb +27 -27
- data/app/views/admin/carts/_cart.html.erb +18 -18
- data/app/views/admin/carts/_carts.html.erb +1 -1
- data/app/views/admin/carts/_form.html.erb +24 -24
- data/app/views/admin/carts/_records.html.erb +17 -17
- data/app/views/admin/carts/_sortable_list.html.erb +7 -7
- data/app/views/admin/carts/edit.html.erb +1 -1
- data/app/views/admin/carts/index.html.erb +10 -10
- data/app/views/admin/carts/new.html.erb +1 -1
- data/app/views/admin/categories/_actions.html.erb +27 -27
- data/app/views/admin/categories/_categories.html.erb +1 -1
- data/app/views/admin/categories/_category.html.erb +25 -25
- data/app/views/admin/categories/_form.html.erb +49 -49
- data/app/views/admin/categories/_records.html.erb +17 -17
- data/app/views/admin/categories/_sortable_list.html.erb +10 -10
- data/app/views/admin/categories/edit.html.erb +1 -1
- data/app/views/admin/categories/index.html.erb +12 -12
- data/app/views/admin/categories/new.html.erb +1 -1
- data/app/views/admin/customers/_actions.html.erb +27 -27
- data/app/views/admin/customers/_customer.html.erb +18 -18
- data/app/views/admin/customers/_customers.html.erb +1 -1
- data/app/views/admin/customers/_form.html.erb +40 -40
- data/app/views/admin/customers/_records.html.erb +17 -17
- data/app/views/admin/customers/_sortable_list.html.erb +7 -7
- data/app/views/admin/customers/edit.html.erb +1 -1
- data/app/views/admin/customers/index.html.erb +10 -10
- data/app/views/admin/customers/new.html.erb +1 -1
- data/app/views/admin/customers/show.html.erb +59 -59
- data/app/views/admin/line_items/_actions.html.erb +27 -27
- data/app/views/admin/line_items/_form.html.erb +29 -29
- data/app/views/admin/line_items/_line_item.html.erb +18 -18
- data/app/views/admin/line_items/_line_items.html.erb +1 -1
- data/app/views/admin/line_items/_records.html.erb +17 -17
- data/app/views/admin/line_items/_sortable_list.html.erb +7 -7
- data/app/views/admin/line_items/edit.html.erb +1 -1
- data/app/views/admin/line_items/index.html.erb +10 -10
- data/app/views/admin/line_items/new.html.erb +1 -1
- data/app/views/admin/products/_actions.html.erb +42 -42
- data/app/views/admin/products/_form.html.erb +120 -120
- data/app/views/admin/products/_product.html.erb +23 -23
- data/app/views/admin/products/_products.html.erb +1 -1
- data/app/views/admin/products/_records.html.erb +17 -17
- data/app/views/admin/products/_sortable_list.html.erb +13 -13
- data/app/views/admin/products/edit.html.erb +1 -1
- data/app/views/admin/products/index.html.erb +12 -12
- data/app/views/admin/products/new.html.erb +1 -1
- data/app/views/carts/show.html.erb +56 -56
- data/app/views/categories/index.html.erb +11 -11
- data/app/views/categories/show.html.erb +33 -33
- data/app/views/customers/index.html.erb +11 -11
- data/app/views/customers/show.html.erb +52 -52
- data/app/views/line_items/index.html.erb +11 -11
- data/app/views/line_items/show.html.erb +39 -39
- data/app/views/products/index.html.erb +33 -33
- data/app/views/products/show.html.erb +65 -65
- data/app/views/profiles/_order_history.html.erb +23 -23
- data/app/views/profiles/_show_address.html.erb +3 -3
- data/app/views/profiles/account_details.html.erb +31 -31
- data/app/views/profiles/address_details.html.erb +9 -9
- data/app/views/profiles/index.html.erb +75 -75
- data/app/views/profiles/order_history_details.html.erb +39 -39
- data/config/locales/en.yml +97 -97
- data/config/locales/fr.yml +25 -25
- data/config/locales/lolcat.yml +25 -25
- data/config/locales/nb.yml +21 -21
- data/config/locales/nl.yml +21 -21
- data/config/routes.rb +58 -58
- data/lib/generators/refinerycms_products_generator.rb +5 -5
- data/lib/refinerycms-carts.rb +31 -31
- data/lib/refinerycms-categories.rb +30 -30
- data/lib/refinerycms-customers.rb +34 -34
- data/lib/refinerycms-line_items.rb +30 -30
- data/lib/refinerycms-products.rb +65 -65
- data/lib/tasks/products.rake +12 -12
- metadata +95 -98
data/app/models/address.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
class Address < ActiveRecord::Base
|
2
|
-
belongs_to :customer
|
3
|
-
|
4
|
-
validates_presence_of :address_line_1, :suburb, :city, :postal_code, :customer
|
5
|
-
|
6
|
-
scope :is_default, where(:default => true)
|
7
|
-
|
8
|
-
def set_as_default
|
9
|
-
self.update_attribute(:default, true)
|
10
|
-
|
11
|
-
other_addresses = Address.where(:customer_id => self.customer_id)
|
12
|
-
other_addresses.each do |address|
|
13
|
-
if self.id != address.id
|
14
|
-
address.update_attribute(:default, false)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
1
|
+
class Address < ActiveRecord::Base
|
2
|
+
belongs_to :customer
|
3
|
+
|
4
|
+
validates_presence_of :address_line_1, :suburb, :city, :postal_code, :customer
|
5
|
+
|
6
|
+
scope :is_default, where(:default => true)
|
7
|
+
|
8
|
+
def set_as_default
|
9
|
+
self.update_attribute(:default, true)
|
10
|
+
|
11
|
+
other_addresses = Address.where(:customer_id => self.customer_id)
|
12
|
+
other_addresses.each do |address|
|
13
|
+
if self.id != address.id
|
14
|
+
address.update_attribute(:default, false)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/app/models/cart.rb
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
class Cart < ActiveRecord::Base
|
2
|
-
before_save :check_is_current_for_sibling_carts
|
3
|
-
|
4
|
-
belongs_to :customer
|
5
|
-
has_many :line_items
|
6
|
-
has_many :products, :through => :line_items
|
7
|
-
|
8
|
-
# def title was created automatically because you didn't specify a string field
|
9
|
-
# when you ran the refinery_engine generator. Love, Refinery CMS.
|
10
|
-
def title
|
11
|
-
"Override def title in vendor/engines/carts/app/models/cart.rb"
|
12
|
-
end
|
13
|
-
|
14
|
-
def grand_total
|
15
|
-
total = 0
|
16
|
-
line_items.each do |li|
|
17
|
-
total += li.total_price
|
18
|
-
end
|
19
|
-
total
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
def add_to_the_cart(product_id, quantity = 1, variant_id = nil)
|
24
|
-
if variant_id.blank?
|
25
|
-
li = self.line_items.where(:product_id => product_id).first
|
26
|
-
else
|
27
|
-
li = self.line_items.where(:product_id => product_id, :variant_id => variant_id).first
|
28
|
-
end
|
29
|
-
|
30
|
-
#logger.info("****************** the variant id = #{variant_id}")
|
31
|
-
|
32
|
-
if li.present?
|
33
|
-
li.quantity += quantity.to_i
|
34
|
-
li.save
|
35
|
-
else
|
36
|
-
if variant_id.blank?
|
37
|
-
self.line_items.create(:product_id => product_id, :quantity => quantity)
|
38
|
-
else
|
39
|
-
self.line_items.create(:product_id => product_id, :quantity => quantity, :variant_id => variant_id)
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def check_is_current_for_sibling_carts
|
46
|
-
if is_current.present? and is_current == true and customer_id.present?
|
47
|
-
other_carts = Cart.where(:customer_id => self.customer_id)
|
48
|
-
other_carts.each do |cart|
|
49
|
-
cart.update_attributes(:is_current => false) if cart.id != self.id
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
1
|
+
class Cart < ActiveRecord::Base
|
2
|
+
before_save :check_is_current_for_sibling_carts
|
3
|
+
|
4
|
+
belongs_to :customer
|
5
|
+
has_many :line_items
|
6
|
+
has_many :products, :through => :line_items
|
7
|
+
|
8
|
+
# def title was created automatically because you didn't specify a string field
|
9
|
+
# when you ran the refinery_engine generator. Love, Refinery CMS.
|
10
|
+
def title
|
11
|
+
"Override def title in vendor/engines/carts/app/models/cart.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
def grand_total
|
15
|
+
total = 0
|
16
|
+
line_items.each do |li|
|
17
|
+
total += li.total_price
|
18
|
+
end
|
19
|
+
total
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def add_to_the_cart(product_id, quantity = 1, variant_id = nil)
|
24
|
+
if variant_id.blank?
|
25
|
+
li = self.line_items.where(:product_id => product_id).first
|
26
|
+
else
|
27
|
+
li = self.line_items.where(:product_id => product_id, :variant_id => variant_id).first
|
28
|
+
end
|
29
|
+
|
30
|
+
#logger.info("****************** the variant id = #{variant_id}")
|
31
|
+
|
32
|
+
if li.present?
|
33
|
+
li.quantity += quantity.to_i
|
34
|
+
li.save
|
35
|
+
else
|
36
|
+
if variant_id.blank?
|
37
|
+
self.line_items.create(:product_id => product_id, :quantity => quantity)
|
38
|
+
else
|
39
|
+
self.line_items.create(:product_id => product_id, :quantity => quantity, :variant_id => variant_id)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def check_is_current_for_sibling_carts
|
46
|
+
if is_current.present? and is_current == true and customer_id.present?
|
47
|
+
other_carts = Cart.where(:customer_id => self.customer_id)
|
48
|
+
other_carts.each do |cart|
|
49
|
+
cart.update_attributes(:is_current => false) if cart.id != self.id
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/app/models/category.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
class Category < ActiveRecord::Base
|
2
|
-
|
3
|
-
include Rails.application.routes.url_helpers
|
4
|
-
#default_url_options[:host] = request.host_with_port
|
5
|
-
|
6
|
-
|
7
|
-
acts_as_indexed :fields => [:name]
|
8
|
-
|
9
|
-
validates :name, :presence => true, :uniqueness => true
|
10
|
-
|
11
|
-
|
12
|
-
belongs_to :parent, :class_name => "Category", :foreign_key => "parent_id"
|
13
|
-
has_many :children, :class_name => "Category", :foreign_key => "parent_id"
|
14
|
-
|
15
|
-
has_and_belongs_to_many :products
|
16
|
-
has_and_belongs_to_many :banners
|
17
|
-
|
18
|
-
# Docs for acts_as_nested_set https://github.com/collectiveidea/awesome_nested_set
|
19
|
-
acts_as_nested_set :dependent => :destroy # rather than :delete_all
|
20
|
-
|
21
|
-
def title
|
22
|
-
name
|
23
|
-
end
|
24
|
-
|
25
|
-
def url
|
26
|
-
category_products_path(id)
|
27
|
-
end
|
28
|
-
end
|
1
|
+
class Category < ActiveRecord::Base
|
2
|
+
|
3
|
+
include Rails.application.routes.url_helpers
|
4
|
+
#default_url_options[:host] = request.host_with_port
|
5
|
+
|
6
|
+
|
7
|
+
acts_as_indexed :fields => [:name]
|
8
|
+
|
9
|
+
validates :name, :presence => true, :uniqueness => true
|
10
|
+
|
11
|
+
|
12
|
+
belongs_to :parent, :class_name => "Category", :foreign_key => "parent_id"
|
13
|
+
has_many :children, :class_name => "Category", :foreign_key => "parent_id"
|
14
|
+
|
15
|
+
has_and_belongs_to_many :products
|
16
|
+
has_and_belongs_to_many :banners
|
17
|
+
|
18
|
+
# Docs for acts_as_nested_set https://github.com/collectiveidea/awesome_nested_set
|
19
|
+
acts_as_nested_set :dependent => :destroy # rather than :delete_all
|
20
|
+
|
21
|
+
def title
|
22
|
+
name
|
23
|
+
end
|
24
|
+
|
25
|
+
def url
|
26
|
+
category_products_path(id)
|
27
|
+
end
|
28
|
+
end
|
data/app/models/customer.rb
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
class Customer < ActiveRecord::Base
|
2
|
-
|
3
|
-
# Include default devise modules. Others available are:
|
4
|
-
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
5
|
-
devise :database_authenticatable, :registerable,
|
6
|
-
:recoverable, :rememberable, :trackable
|
7
|
-
|
8
|
-
# Setup accessible (or protected) attributes for your model
|
9
|
-
attr_accessible :name, :surname, :contact_number, :email, :password, :password_confirmation #, :remember_me
|
10
|
-
|
11
|
-
acts_as_indexed :fields => [:name, :surname, :contact_number, :email, :encrypted_password]
|
12
|
-
|
13
|
-
validates :email, :presence => true, :uniqueness => true
|
14
|
-
|
15
|
-
has_many :carts
|
16
|
-
has_many :addresses
|
17
|
-
|
18
|
-
if defined?(Order)
|
19
|
-
has_many :orders
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.update_customer(id, name, surname, contact_number, email)
|
23
|
-
logger.info("********************** params = #{name}")
|
24
|
-
this_customer = self.find(id)
|
25
|
-
this_customer.update_attributes(:name => name, :surname => surname, :contact_number => contact_number, :email => email)
|
26
|
-
this_customer.save!
|
27
|
-
end
|
28
|
-
|
29
|
-
def delivery_address
|
30
|
-
addresses.is_default.first
|
31
|
-
end
|
32
|
-
end
|
1
|
+
class Customer < ActiveRecord::Base
|
2
|
+
|
3
|
+
# Include default devise modules. Others available are:
|
4
|
+
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
5
|
+
devise :database_authenticatable, :registerable,
|
6
|
+
:recoverable, :rememberable, :trackable
|
7
|
+
|
8
|
+
# Setup accessible (or protected) attributes for your model
|
9
|
+
attr_accessible :name, :surname, :contact_number, :email, :password, :password_confirmation #, :remember_me
|
10
|
+
|
11
|
+
acts_as_indexed :fields => [:name, :surname, :contact_number, :email, :encrypted_password]
|
12
|
+
|
13
|
+
validates :email, :presence => true, :uniqueness => true
|
14
|
+
|
15
|
+
has_many :carts
|
16
|
+
has_many :addresses
|
17
|
+
|
18
|
+
if defined?(Order)
|
19
|
+
has_many :orders
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.update_customer(id, name, surname, contact_number, email)
|
23
|
+
logger.info("********************** params = #{name}")
|
24
|
+
this_customer = self.find(id)
|
25
|
+
this_customer.update_attributes(:name => name, :surname => surname, :contact_number => contact_number, :email => email)
|
26
|
+
this_customer.save!
|
27
|
+
end
|
28
|
+
|
29
|
+
def delivery_address
|
30
|
+
addresses.is_default.first
|
31
|
+
end
|
32
|
+
end
|
data/app/models/line_item.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
class LineItem < ActiveRecord::Base
|
2
|
-
|
3
|
-
belongs_to :cart
|
4
|
-
belongs_to :product
|
5
|
-
|
6
|
-
# def title was created automatically because you didn't specify a string field
|
7
|
-
# when you ran the refinery_engine generator. Love, Refinery CMS.
|
8
|
-
def title
|
9
|
-
"line item for #{product.name}"
|
10
|
-
end
|
11
|
-
|
12
|
-
def total_price
|
13
|
-
if variant_id.present? and defined?(Variant)
|
14
|
-
variant.price * quantity
|
15
|
-
else
|
16
|
-
product.price * quantity
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def grand_total
|
21
|
-
total = 0
|
22
|
-
line_items.each do |li|
|
23
|
-
total += li.total_price
|
24
|
-
end
|
25
|
-
total
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
1
|
+
class LineItem < ActiveRecord::Base
|
2
|
+
|
3
|
+
belongs_to :cart
|
4
|
+
belongs_to :product
|
5
|
+
|
6
|
+
# def title was created automatically because you didn't specify a string field
|
7
|
+
# when you ran the refinery_engine generator. Love, Refinery CMS.
|
8
|
+
def title
|
9
|
+
"line item for #{product.name}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def total_price
|
13
|
+
if variant_id.present? and defined?(Variant) and variant.price.present?
|
14
|
+
variant.price * quantity
|
15
|
+
else
|
16
|
+
product.price * quantity
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def grand_total
|
21
|
+
total = 0
|
22
|
+
line_items.each do |li|
|
23
|
+
total += li.total_price
|
24
|
+
end
|
25
|
+
total
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/app/models/product.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
|
-
require 'acts-as-taggable-on'
|
2
|
-
|
3
|
-
class Product < ActiveRecord::Base
|
4
|
-
|
5
|
-
acts_as_indexed :fields => [:name, :description, :summary]
|
6
|
-
|
7
|
-
if defined?(ActsAsTaggableOn)
|
8
|
-
acts_as_taggable_on :tags
|
9
|
-
end
|
10
|
-
|
11
|
-
validates :name, :presence => true, :uniqueness => true
|
12
|
-
validate :validate_category
|
13
|
-
|
14
|
-
scope :less_than, lambda { |price| where("price < ?", price) }
|
15
|
-
scope :greater_than, lambda { |price| where("price > ?", price) }
|
16
|
-
|
17
|
-
scope :best_sellers, where(:best_seller => true)
|
18
|
-
scope :featured, where(:featured => true)
|
19
|
-
scope :new_products, where(:new_product => true)
|
20
|
-
|
21
|
-
scope :by_category, lambda { |category_id|
|
22
|
-
ids = []
|
23
|
-
Category.find(category_id).children.each do |child|
|
24
|
-
ids << child.id
|
25
|
-
end
|
26
|
-
ids << category_id
|
27
|
-
|
28
|
-
joins(:categories).where("categories.id" => ids)
|
29
|
-
}
|
30
|
-
|
31
|
-
belongs_to :image
|
32
|
-
has_and_belongs_to_many :categories
|
33
|
-
has_many :line_items
|
34
|
-
|
35
|
-
def title
|
36
|
-
name
|
37
|
-
end
|
38
|
-
|
39
|
-
def validate_category
|
40
|
-
categories.each do |category|
|
41
|
-
if category.children.present?
|
42
|
-
errors.add_to_base("Cannot assign product to a category that has sub-categories")
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
1
|
+
require 'acts-as-taggable-on'
|
2
|
+
|
3
|
+
class Product < ActiveRecord::Base
|
4
|
+
|
5
|
+
acts_as_indexed :fields => [:name, :description, :summary]
|
6
|
+
|
7
|
+
if defined?(ActsAsTaggableOn)
|
8
|
+
acts_as_taggable_on :tags
|
9
|
+
end
|
10
|
+
|
11
|
+
validates :name, :presence => true, :uniqueness => true
|
12
|
+
validate :validate_category
|
13
|
+
|
14
|
+
scope :less_than, lambda { |price| where("price < ?", price) }
|
15
|
+
scope :greater_than, lambda { |price| where("price > ?", price) }
|
16
|
+
|
17
|
+
scope :best_sellers, where(:best_seller => true)
|
18
|
+
scope :featured, where(:featured => true)
|
19
|
+
scope :new_products, where(:new_product => true)
|
20
|
+
|
21
|
+
scope :by_category, lambda { |category_id|
|
22
|
+
ids = []
|
23
|
+
Category.find(category_id).children.each do |child|
|
24
|
+
ids << child.id
|
25
|
+
end
|
26
|
+
ids << category_id
|
27
|
+
|
28
|
+
joins(:categories).where("categories.id" => ids)
|
29
|
+
}
|
30
|
+
|
31
|
+
belongs_to :image
|
32
|
+
has_and_belongs_to_many :categories
|
33
|
+
has_many :line_items
|
34
|
+
|
35
|
+
def title
|
36
|
+
name
|
37
|
+
end
|
38
|
+
|
39
|
+
def validate_category
|
40
|
+
categories.each do |category|
|
41
|
+
if category.children.present?
|
42
|
+
errors.add_to_base("Cannot assign product to a category that has sub-categories")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
<h3 class="category">Edit Address</h3>
|
2
|
-
|
3
|
-
<div class="newform">
|
4
|
-
<% form_for(@address) do |f| %>
|
5
|
-
<% if @address.errors.any? %>
|
6
|
-
<div id="error_explanation">
|
7
|
-
<ul>
|
8
|
-
<% @address.errors.full_messages.each do |msg| %>
|
9
|
-
<li><%= msg %></li>
|
10
|
-
<% end %>
|
11
|
-
</ul>
|
12
|
-
</div>
|
13
|
-
<% end %>
|
14
|
-
|
15
|
-
<%= f.hidden_field :customer_id %>
|
16
|
-
<%= f.hidden_field :default %>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
<%= f.label :address_line_1, "Address" %>
|
21
|
-
<div class="input"><%= f.text_field :address_line_1 %></div>
|
22
|
-
|
23
|
-
<label> </label>
|
24
|
-
<div class="input"><%= f.text_field :address_line_2 %></div>
|
25
|
-
|
26
|
-
<%= f.label :suburb %>
|
27
|
-
<div class="input"><%= f.text_field :suburb %></div>
|
28
|
-
|
29
|
-
|
30
|
-
<%= f.label :city, "City" %>
|
31
|
-
<div class="input"><%= f.text_field :city %></div>
|
32
|
-
|
33
|
-
<%= f.label :postal_code %>
|
34
|
-
<div class="input"><%= f.text_field :postal_code %></div>
|
35
|
-
|
36
|
-
|
37
|
-
<div class='btn'><%= f.submit "Update" %></div>
|
38
|
-
|
39
|
-
<% end %>
|
40
|
-
</div>
|
41
|
-
|
42
|
-
|
1
|
+
<h3 class="category">Edit Address</h3>
|
2
|
+
|
3
|
+
<div class="newform">
|
4
|
+
<% form_for(@address) do |f| %>
|
5
|
+
<% if @address.errors.any? %>
|
6
|
+
<div id="error_explanation">
|
7
|
+
<ul>
|
8
|
+
<% @address.errors.full_messages.each do |msg| %>
|
9
|
+
<li><%= msg %></li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= f.hidden_field :customer_id %>
|
16
|
+
<%= f.hidden_field :default %>
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
<%= f.label :address_line_1, "Address" %>
|
21
|
+
<div class="input"><%= f.text_field :address_line_1 %></div>
|
22
|
+
|
23
|
+
<label> </label>
|
24
|
+
<div class="input"><%= f.text_field :address_line_2 %></div>
|
25
|
+
|
26
|
+
<%= f.label :suburb %>
|
27
|
+
<div class="input"><%= f.text_field :suburb %></div>
|
28
|
+
|
29
|
+
|
30
|
+
<%= f.label :city, "City" %>
|
31
|
+
<div class="input"><%= f.text_field :city %></div>
|
32
|
+
|
33
|
+
<%= f.label :postal_code %>
|
34
|
+
<div class="input"><%= f.text_field :postal_code %></div>
|
35
|
+
|
36
|
+
|
37
|
+
<div class='btn'><%= f.submit "Update" %></div>
|
38
|
+
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
|