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}}:

View File

@@ -602,8 +602,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
who_is_managing_enterprise: "Who is responsible for managing %{enterprise}?"
enterprise_contact: "Primary Contact"
enterprise_contact_required: "You need to enter a primary contact."
enterprise_email: "Email address"
enterprise_email_required: "You need to enter valid email address."
enterprise_email_address: "Email address"
enterprise_phone: "Phone number"
back: "Back"
continue: "Continue"

View File

@@ -38,7 +38,7 @@ feature "Registration", js: true do
# Filling in Contact Details
expect(page).to have_content 'Who is responsible for managing My Awesome Enterprise?'
fill_in 'enterprise_contact', with: 'Saskia Munroe'
page.should have_field 'enterprise_email', with: user.email
page.should have_field 'enterprise_email_address', with: user.email
fill_in 'enterprise_phone', with: '12 3456 7890'
click_button 'Continue'