Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
939 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
root: true, | ||
extends: 'standard', | ||
parser: 'babel-eslint', | ||
parserOptions: { | ||
sourceType: 'module' | ||
}, | ||
plugins: [ | ||
'html', | ||
'standard', | ||
'promise', | ||
'you-dont-need-lodash-underscore' | ||
], | ||
rules: { | ||
'you-dont-need-lodash-underscore/for-each': 1, | ||
'you-dont-need-lodash-underscore/concat': 1 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
resources/assets/js/acacha-users/main/LoggedUserEmailForm.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<div> | ||
<adminlte-alert :alert="alert"></adminlte-alert> | ||
<form role="form" method="post" @submit.prevent="submit" @keydown="clearErrors($event.target.name)"> | ||
<adminlte-input-password name="current_password" :form-name="formName"></adminlte-input-password> | ||
<adminlte-input-email :form-name="formName"></adminlte-input-email> | ||
<div class="box-footer"> | ||
<button type="submit" class="btn btn-primary" :disabled="isDisabled()">Change email</button> | ||
</div> | ||
</form> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { AdminlteInputEmailComponent, AdminlteInputPasswordComponent } from 'acacha-adminlte-vue-forms' | ||
import { FlashMixin, DisabledSubmitMixin } from 'adminlte-vue' | ||
import Form, { FormsModule, UsesAcachaForms, registerForm, ClearErrorsMixin } from 'acacha-forms' | ||
import InteractsWithUser from './mixins/interactsWithUser' | ||
import SubmitsFormField from './mixins/SubmitsFormField' | ||
const UserEmailForm = new Form({ | ||
current_password: '', | ||
email: '' | ||
}) | ||
const API_ENDPOINT = '/api/v1/user/email' | ||
const ACACHA_FORM = FormsModule(UserEmailForm) | ||
const ACACHA_FORM_VUEX_MODULE = 'logged-user-email-form' | ||
export default { | ||
name: 'LoggedUserEmailForm', | ||
components: { AdminlteInputEmailComponent, AdminlteInputPasswordComponent }, | ||
mixins: [FlashMixin, DisabledSubmitMixin, InteractsWithUser, UsesAcachaForms, ClearErrorsMixin, SubmitsFormField], | ||
methods: { | ||
submit () { | ||
this.submitFormField('put', API_ENDPOINT, 'Email') | ||
}, | ||
fillForm () { | ||
// Update Form object with Current User | ||
const fields = [ | ||
{ | ||
field: 'name', | ||
value: this.user.name | ||
}, | ||
{ | ||
field: 'email', | ||
value: this.user.email | ||
} | ||
] | ||
this.updateForm(fields) | ||
} | ||
}, | ||
beforeCreate () { | ||
registerForm(this, ACACHA_FORM_VUEX_MODULE, ACACHA_FORM) | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<template> | ||
<div> | ||
<adminlte-alert :alert="alert"></adminlte-alert> | ||
<form role="form" method="post" @submit.prevent="submit" @keydown="clearErrors($event.target.name)"> | ||
<adminlte-input-text name="name" :form-name="formName"></adminlte-input-text> | ||
<adminlte-input-email :form-name="formName"></adminlte-input-email> | ||
<adminlte-input-password :form-name="formName"></adminlte-input-password> | ||
<div class="box-footer"> | ||
<button type="submit" class="btn btn-primary" :disabled="isDisabled()">Update</button> | ||
</div> | ||
</form> | ||
</div> | ||
</template> | ||
|
||
|
||
<script> | ||
import { AdminlteInputTextComponent, AdminlteInputEmailComponent, AdminlteInputPasswordComponent } from 'acacha-adminlte-vue-forms' | ||
import {FlashMixin, DisabledSubmitMixin} from 'adminlte-vue' | ||
import Form, { FormsModule, UsesAcachaForms, registerForm, ClearErrorsMixin } from 'acacha-forms' | ||
import InteractsWithUser from './mixins/interactsWithUser' | ||
import SubmitsFormWithMessage from './mixins/SubmitsFormWithMessage' | ||
const LoggedUserForm = new Form({ | ||
name: '', | ||
email: '', | ||
passsword: '' | ||
}) | ||
const API_ENDPOINT = '/api/v1/user' | ||
const ACACHA_FORM = FormsModule(LoggedUserForm) | ||
const ACACHA_FORM_VUEX_MODULE = 'user-form' | ||
export default { | ||
name: 'LoggedUserForm', | ||
components: { AdminlteInputTextComponent, AdminlteInputEmailComponent, AdminlteInputPasswordComponent }, | ||
mixins: [FlashMixin, DisabledSubmitMixin, UsesAcachaForms, InteractsWithUser, ClearErrorsMixin, SubmitsFormWithMessage], | ||
methods: { | ||
submit () { | ||
this.submitFormWithMessage('put', API_ENDPOINT, 'User changed ok!') | ||
}, | ||
fillForm () { | ||
// Update Form object with Current User | ||
const fields = [ | ||
{ | ||
field: 'name', | ||
value: this.user.name | ||
}, | ||
{ | ||
field: 'email', | ||
value: this.user.email | ||
} | ||
] | ||
this.updateForm(fields) | ||
} | ||
}, | ||
beforeCreate () { | ||
registerForm(this, ACACHA_FORM_VUEX_MODULE, ACACHA_FORM) | ||
} | ||
} | ||
</script> |
51 changes: 51 additions & 0 deletions
51
resources/assets/js/acacha-users/main/LoggedUserNameForm.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<template> | ||
<div> | ||
<adminlte-alert :alert="alert"></adminlte-alert> | ||
<form role="form" method="post" @submit.prevent="submit" @keydown="clearErrors($event.target.name)"> | ||
<adminlte-input-text name="name" :form-name="formName"></adminlte-input-text> | ||
<div class="box-footer"> | ||
<button type="submit" class="btn btn-primary" :disabled="isDisabled()">Change name</button> | ||
</div> | ||
</form> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { AdminlteInputTextComponent } from 'acacha-adminlte-vue-forms' | ||
import { FlashMixin, DisabledSubmitMixin } from 'adminlte-vue' | ||
import Form, { FormsModule, UsesAcachaForms, registerForm, ClearErrorsMixin } from 'acacha-forms' | ||
import InteractsWithUser from './mixins/interactsWithUser' | ||
import SubmitsFormField from './mixins/SubmitsFormField' | ||
const UserNameForm = new Form({ | ||
name: '' | ||
}) | ||
const API_ENDPOINT = '/api/v1/user/name' | ||
const ACACHA_FORM = FormsModule(UserNameForm) | ||
const ACACHA_FORM_VUEX_MODULE = 'logged-user-name-form' | ||
export default { | ||
name: 'LoggedUserNameForm', | ||
components: { AdminlteInputTextComponent }, | ||
mixins: [FlashMixin, DisabledSubmitMixin, InteractsWithUser, UsesAcachaForms, ClearErrorsMixin, SubmitsFormField], | ||
methods: { | ||
submit () { | ||
this.submitFormField('put', API_ENDPOINT, 'Name') | ||
}, | ||
fillForm () { | ||
// Update Form object with Current User | ||
const fields = [ | ||
{ | ||
field: 'name', | ||
value: this.user.name | ||
} | ||
] | ||
this.updateForm(fields) | ||
} | ||
}, | ||
beforeCreate () { | ||
registerForm(this, ACACHA_FORM_VUEX_MODULE, ACACHA_FORM) | ||
} | ||
} | ||
</script> |
58 changes: 58 additions & 0 deletions
58
resources/assets/js/acacha-users/main/LoggedUserNoPasswordForm.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<template> | ||
<div> | ||
<adminlte-alert :alert="alert"></adminlte-alert> | ||
<form role="form" method="post" @submit.prevent="submit" @keydown="clearErrors($event.target.name)"> | ||
<adminlte-input-text name="name" :form-name="formName"></adminlte-input-text> | ||
<adminlte-input-email :form-name="formName"></adminlte-input-email> | ||
<div class="box-footer"> | ||
<button type="submit" class="btn btn-primary" :disabled="isDisabled()">Update</button> | ||
</div> | ||
</form> | ||
</div> | ||
</template> | ||
|
||
|
||
<script> | ||
import { AdminlteInputTextComponent, AdminlteInputEmailComponent } from 'acacha-adminlte-vue-forms' | ||
import {FlashMixin, DisabledSubmitMixin} from 'adminlte-vue' | ||
import Form, { FormsModule, UsesAcachaForms, registerForm, ClearErrorsMixin } from 'acacha-forms' | ||
import InteractsWithUser from './mixins/interactsWithUser' | ||
import SubmitsFormWithMessage from './mixins/SubmitsFormWithMessage' | ||
const UserNoPasswordForm = new Form({ | ||
name: '', | ||
email: '' | ||
}) | ||
const API_ENDPOINT = '/api/v1/user' | ||
const ACACHA_FORM = FormsModule(UserNoPasswordForm) | ||
const ACACHA_FORM_VUEX_MODULE = 'logged-user-no-password-form' | ||
export default { | ||
name: 'LoggedUserNoPasswordForm', | ||
components: { AdminlteInputTextComponent, AdminlteInputEmailComponent }, | ||
mixins: [FlashMixin, DisabledSubmitMixin, InteractsWithUser, UsesAcachaForms, ClearErrorsMixin, SubmitsFormWithMessage], | ||
methods: { | ||
submit () { | ||
this.submitFormWithMessage('put', API_ENDPOINT, 'User changed ok!') | ||
}, | ||
fillForm () { | ||
// Update Form object with Current User | ||
const fields = [ | ||
{ | ||
field: 'name', | ||
value: this.user.name | ||
}, | ||
{ | ||
field: 'email', | ||
value: this.user.email | ||
} | ||
] | ||
this.updateForm(fields) | ||
} | ||
}, | ||
beforeCreate () { | ||
registerForm(this, ACACHA_FORM_VUEX_MODULE, ACACHA_FORM) | ||
} | ||
} | ||
</script> |
Oops, something went wrong.