Set public enterprise.email_address at registration

Sets the public email address to the given email address as well as the
internal enterprise.email (notification email address).

The field is not mandatory any more since enterprise.email is populated
from the owner's email address if no value was given.
This commit is contained in:
Maikel Linke
2016-03-04 17:50:04 +11:00
parent 28e2d4041f
commit c1647ccd2c
4 changed files with 6 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
new class EnterpriseRegistrationService
enterprise:
user_ids: [CurrentUser.id]
email: CurrentUser.email
email_address: CurrentUser.email
address: {}
country: availableCountries[0]
@@ -55,6 +55,7 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
excluded = [ 'address', 'country', 'id' ]
for key, value of @enterprise when key not in excluded
enterprise[key] = value
enterprise.email = enterprise.email_address
enterprise.address_attributes = @enterprise.address if @enterprise.address?
enterprise.address_attributes.country_id = @enterprise.country.id if @enterprise.country?
enterprise

View File

@@ -17,10 +17,8 @@
{{'enterprise_contact_required' | t}}
.row
.small-12.columns.field
%label{ for: 'enterprise_email' } {{'enterprise_email' | t}}:
%input.chunky.small-12.columns{ id: 'enterprise_email', name: 'email', type: 'email', required: true, placeholder: "eg. charlie@thefarm.com", ng: { model: 'enterprise.email' } }
%span.error.small-12.columns{ ng: { show: "(contact.email.$error.email || contact.email.$error.required) && submitted" } }
{{'enterprise_email_required' | t}}
%label{ for: 'enterprise_email_address' } {{'enterprise_email_address' | t}}:
%input.chunky.small-12.columns{ id: 'enterprise_email_address', name: 'email_address', type: 'email', placeholder: "eg. charlie@thefarm.com", ng: { model: 'enterprise.email_address' } }
.row
.small-12.columns.field
%label{ for: 'enterprise_phone' } {{'enterprise_phone' | t}}: