From 4bded490cf0227d0c450e85b242db1ad4a7c22f2 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Tue, 3 Sep 2019 14:50:21 +0900 Subject: [PATCH] Extract form button --- frontend/components/molecules/BaseCard.vue | 42 ++++++++++++++++++- .../organisms/MemberAdditionForm.vue | 41 ++++++++---------- .../organisms/MemberDeletionForm.vue | 27 ++++-------- .../organisms/ProjectCreationForm.vue | 31 ++++---------- .../organisms/ProjectDeletionForm.vue | 27 ++++-------- 5 files changed, 82 insertions(+), 86 deletions(-) diff --git a/frontend/components/molecules/BaseCard.vue b/frontend/components/molecules/BaseCard.vue index d0f59b66..5f2ba0b3 100644 --- a/frontend/components/molecules/BaseCard.vue +++ b/frontend/components/molecules/BaseCard.vue @@ -12,7 +12,24 @@ - + + {{ cancelText }} + + + {{ agreeText }} + @@ -24,6 +41,29 @@ export default { type: String, default: '', required: true + }, + cancelText: { + type: String, + default: '', + required: true + }, + agreeText: { + type: String, + default: '', + required: true + }, + disabled: { + type: Boolean, + default: false + } + }, + + methods: { + agree() { + this.$emit('agree') + }, + cancel() { + this.$emit('cancel') } } } diff --git a/frontend/components/organisms/MemberAdditionForm.vue b/frontend/components/organisms/MemberAdditionForm.vue index 8e0e4efb..b60e94b2 100644 --- a/frontend/components/organisms/MemberAdditionForm.vue +++ b/frontend/components/organisms/MemberAdditionForm.vue @@ -1,5 +1,12 @@ @@ -71,12 +60,18 @@ export default { }, data() { return { - valid: true, + valid: false, username: '', role: null, isLoading: false, selectedUser: null, - roles: ['Admin', 'Member'] + roles: ['Admin', 'Member'], + userRules: [ + v => !!v || 'User is required' + ], + roleRules: [ + v => !!v || 'Role is required' + ] } }, diff --git a/frontend/components/organisms/MemberDeletionForm.vue b/frontend/components/organisms/MemberDeletionForm.vue index 76a123a5..9c2ce20d 100644 --- a/frontend/components/organisms/MemberDeletionForm.vue +++ b/frontend/components/organisms/MemberDeletionForm.vue @@ -1,5 +1,11 @@ diff --git a/frontend/components/organisms/ProjectCreationForm.vue b/frontend/components/organisms/ProjectCreationForm.vue index ef26d56e..826f9c0f 100644 --- a/frontend/components/organisms/ProjectCreationForm.vue +++ b/frontend/components/organisms/ProjectCreationForm.vue @@ -1,5 +1,12 @@ @@ -80,7 +67,7 @@ export default { }, data() { return { - valid: true, + valid: false, name: '', description: '', projectType: null, diff --git a/frontend/components/organisms/ProjectDeletionForm.vue b/frontend/components/organisms/ProjectDeletionForm.vue index da1ff725..7cfdf98f 100644 --- a/frontend/components/organisms/ProjectDeletionForm.vue +++ b/frontend/components/organisms/ProjectDeletionForm.vue @@ -1,5 +1,11 @@