Skip to content

Commit

Permalink
Merge pull request #734 from Carrene/revise/username
Browse files Browse the repository at this point in the history
Update name field to first name and last name
  • Loading branch information
aryayi authored Jul 30, 2019
2 parents 9df17a9 + ead57b7 commit 38fbfcc
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 24 deletions.
19 changes: 16 additions & 3 deletions src/components/UsersForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,26 @@

<div class="input-container">
<label
:for="memberMetadata.fields.name.label"
:for="memberMetadata.fields.firstName.label"
class="label"
>{{ memberMetadata.fields.name.label }}</label>
>{{ memberMetadata.fields.firstName.label }}</label>
<input
type="text"
class="light-primary-input disabled"
v-model="user.name"
v-model="user.firstName"
readonly
>
</div>

<div class="input-container">
<label
:for="memberMetadata.fields.lastName.label"
class="label"
>{{ memberMetadata.fields.lastName.label }}</label>
<input
type="text"
class="light-primary-input disabled"
v-model="user.lastName"
readonly
>
</div>
Expand Down
33 changes: 18 additions & 15 deletions src/pages/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,35 @@
<div class="inputs">
<div class="input-container">
<label
for="title"
for="firstName"
class="label"
>{{ casMemberMetadata.fields.title.label }}</label>
>{{ casMemberMetadata.fields.firstName.label }}</label>
<input
type="text"
id="title"
class="light-primary-input disabled"
v-model.trim="member.title"
readonly
id="firstName"
class="light-primary-input"
v-model.trim="member.firstName"
>
<validation-message
:validation="$v.member.firstName"
:metadata="casMemberMetadata.fields.firstName"
/>
</div>
<div class="input-container">
<label
for="name"
for="lastName"
class="label"
>{{ casMemberMetadata.fields.name.label }}</label>
>{{ casMemberMetadata.fields.lastName.label }}</label>
<input
type="text"
id="name"
id="lastName"
class="light-primary-input"
v-model.trim="member.name"
@input="$v.member.name.$touch"
v-model.trim="member.lastName"
@input="$v.member.lastName.$touch"
>
<validation-message
:validation="$v.member.name"
:metadata="casMemberMetadata.fields.name"
:validation="$v.member.lastName"
:metadata="casMemberMetadata.fields.lastName"
/>
</div>
<div class="input-container">
Expand Down Expand Up @@ -127,8 +130,8 @@ export default {
validations () {
return {
member: {
title: this.casMemberMetadata.fields.title.createValidator(),
name: this.casMemberMetadata.fields.name.createValidator(),
firstName: this.casMemberMetadata.fields.firstName.createValidator(),
lastName: this.casMemberMetadata.fields.lastName.createValidator(),
email: this.casMemberMetadata.fields.email.createValidator()
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/pages/Users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
>
<!-- <div class="left-align"> -->
<td class="user-name cell">{{ user.title }}</td>
<td class="full-name cell">{{ user.name ? user.name : '-' }}</td>
<td class="first-name cell">{{ user.firstName ? user.firstName : '-' }}</td>
<td class="last-name cell">{{ user.lastName ? user.lastName : '-' }}</td>
<td class="email cell">{{ user.email }}</td>
<!-- </div> -->
<td
Expand Down Expand Up @@ -134,9 +135,14 @@ export default {
className: 'user-name'
},
{
label: this.memberMetadata.fields.name.label,
field: 'fullName',
className: 'full-name'
label: this.memberMetadata.fields.firstName.label,
field: 'firstName',
className: 'first-name'
},
{
label: this.memberMetadata.fields.lastName.label,
field: 'lastName',
className: 'last-name'
},
{
label: this.memberMetadata.fields.email.label,
Expand Down
2 changes: 1 addition & 1 deletion src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export const CAS_FRONTEND_BASE_URL =
? `${window.location.protocol}//alpha-cas.carrene.com`
: 'http://localhost:8082'

export const SCOPES = ['title', 'email', 'avatar', 'name']
export const SCOPES = ['title', 'email', 'avatar', 'firstName', 'lastName']

export const APPLICATION_ID = 1
2 changes: 1 addition & 1 deletion src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2895,7 +2895,7 @@ export default new Vuex.Store({
class Member extends casServer.metadata.models.Member {
prepareForSubmit (verb, url, data) {
if (verb === this.constructor.__verbs__.update) {
let allowedFields = ['name']
let allowedFields = ['firstName', 'lastName']
for (let field in data) {
if (!allowedFields.includes(field)) {
delete data[field]
Expand Down

0 comments on commit 38fbfcc

Please sign in to comment.