You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2022/05/17 16:18:30 UTC
[airavata-django-portal] 01/02: AIRAVATA-3565 Fixes to how other options are validated
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch AIRAVATA-3562
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit fef0a18fa3355ce96144dec11bddfaffda9a18f1
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue May 17 12:16:48 2022 -0400
AIRAVATA-3565 Fixes to how other options are validated
---
.../components/ExtendedUserProfileFieldEditor.vue | 1 +
.../ExtendedUserProfileMultiChoiceFieldEditor.vue | 31 ++++++++++++----------
.../ExtendedUserProfileSingleChoiceFieldEditor.vue | 31 ++++++++++++----------
3 files changed, 35 insertions(+), 28 deletions(-)
diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileFieldEditor.vue b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileFieldEditor.vue
index 13b7a664..d9e3ca46 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileFieldEditor.vue
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileFieldEditor.vue
@@ -15,6 +15,7 @@
v-for="link in extendedUserProfileField.links"
:key="link.id"
:header="link.label"
+ class="ml-3 mb-3"
>
<b-card-text v-if="link.display_inline">
<iframe :src="link.url" />
diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileMultiChoiceFieldEditor.vue b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileMultiChoiceFieldEditor.vue
index 17faef61..9e99fb7f 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileMultiChoiceFieldEditor.vue
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileMultiChoiceFieldEditor.vue
@@ -7,7 +7,9 @@
@change="onChange"
:state="validateStateErrorOnly($v.value)"
>
- <b-form-checkbox :value="otherOptionValue"
+ <b-form-checkbox
+ :value="otherOptionValue"
+ v-if="extendedUserProfileField.other"
>Other (please specify)</b-form-checkbox
>
@@ -15,24 +17,25 @@
>This field is required.</b-form-invalid-feedback
>
</b-form-checkbox-group>
- <b-form-input
- class="mt-2"
- v-if="showOther"
- v-model="other"
- placeholder="Please specify"
- :state="validateState($v.other)"
- @input="onInput"
- />
- <b-form-invalid-feedback :state="validateState($v.other)"
- >Please specify a value for 'Other'.</b-form-invalid-feedback
- >
+ <template v-if="showOther">
+ <b-form-input
+ class="mt-2"
+ v-model="other"
+ placeholder="Please specify"
+ :state="validateState($v.other)"
+ @input="onInput"
+ />
+ <b-form-invalid-feedback :state="validateState($v.other)"
+ >Please specify a value for 'Other'.</b-form-invalid-feedback
+ >
+ </template>
</extended-user-profile-field-editor>
</template>
<script>
import { mapGetters, mapMutations } from "vuex";
import { validationMixin } from "vuelidate";
-import { requiredIf } from "vuelidate/lib/validators";
+import { required, requiredIf } from "vuelidate/lib/validators";
import { errors } from "django-airavata-common-ui";
import ExtendedUserProfileFieldEditor from "./ExtendedUserProfileFieldEditor.vue";
const OTHER_OPTION = new Object(); // sentinel value
@@ -113,7 +116,7 @@ export default {
other: {},
};
if (this.showOther) {
- validations.other = { required: requiredIf("required") };
+ validations.other = { required };
}
return validations;
},
diff --git a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileSingleChoiceFieldEditor.vue b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileSingleChoiceFieldEditor.vue
index 61c672f5..7bc1f26d 100644
--- a/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileSingleChoiceFieldEditor.vue
+++ b/django_airavata/apps/auth/static/django_airavata_auth/js/components/ExtendedUserProfileSingleChoiceFieldEditor.vue
@@ -12,31 +12,34 @@
>
</template>
- <b-form-select-option :value="otherOptionValue"
+ <b-form-select-option
+ :value="otherOptionValue"
+ v-if="extendedUserProfileField.other"
>Other (please specify)</b-form-select-option
>
</b-form-select>
<b-form-invalid-feedback :state="validateState($v.value)"
>This field is required.</b-form-invalid-feedback
>
- <b-form-input
- class="mt-2"
- v-if="showOther"
- v-model="other"
- placeholder="Please specify"
- :state="validateState($v.other)"
- @input="onInput"
- />
- <b-form-invalid-feedback :state="validateState($v.other)"
- >Please specify a value for 'Other'.</b-form-invalid-feedback
- >
+ <template v-if="showOther">
+ <b-form-input
+ class="mt-2"
+ v-model="other"
+ placeholder="Please specify"
+ :state="validateState($v.other)"
+ @input="onInput"
+ />
+ <b-form-invalid-feedback :state="validateState($v.other)"
+ >Please specify a value for 'Other'.</b-form-invalid-feedback
+ >
+ </template>
</extended-user-profile-field-editor>
</template>
<script>
import { mapGetters, mapMutations } from "vuex";
import { validationMixin } from "vuelidate";
-import { requiredIf } from "vuelidate/lib/validators";
+import { required, requiredIf } from "vuelidate/lib/validators";
import { errors } from "django-airavata-common-ui";
import ExtendedUserProfileFieldEditor from "./ExtendedUserProfileFieldEditor.vue";
const OTHER_OPTION = new Object(); // sentinel value
@@ -116,7 +119,7 @@ export default {
other: {},
};
if (this.showOther) {
- validations.other = { required: requiredIf("required") };
+ validations.other = { required };
} else {
validations.value = { required: requiredIf("required") };
}