Adding addresses to existing groups and make them changable

This commit is contained in:
Maikel Linke
2015-01-22 12:10:54 +11:00
parent 0d9a0919e5
commit 87b092fdf7
3 changed files with 19 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ class EnterpriseGroup < ActiveRecord::Base
attr_accessible :name, :description, :long_description, :on_front_page, :enterprise_ids
attr_accessible :logo, :promo_image
attr_accessible :address_attributes
attr_accessible :email, :website, :facebook, :instagram, :linkedin, :twitter
delegate :phone, :to => :address
@@ -37,7 +38,7 @@ class EnterpriseGroup < ActiveRecord::Base
scope :on_front_page, where(on_front_page: true)
def set_unused_address_fields
address.firstname = address.lastname = address.phone = 'unused' if address.present?
address.firstname = address.lastname = 'unused' if address.present?
end
end

View File

@@ -52,9 +52,10 @@
%legend Contact
.row
.alpha.three.columns
= f.label :phone
= af.label :phone
%span.required *
.omega.eight.columns
= f.text_field :phone, { placeholder: "eg. 98 7654 3210"}
= af.text_field :phone, { placeholder: "eg. 98 7654 3210"}
.row
.three.columns.alpha
= af.label :address1