Skip to content

Commit a4a1c8a

Browse files
authored
Merge pull request #4503 from EshaanAgg/create.vue
Migrate `Create.vue` from `VCheckbox` to `Checkbox`
2 parents 9ed0725 + 91dc0e6 commit a4a1c8a

File tree

1 file changed

+15
-9
lines changed
  • contentcuration/contentcuration/frontend/accounts/pages

1 file changed

+15
-9
lines changed

contentcuration/contentcuration/frontend/accounts/pages/Create.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,20 @@
132132
</VSlideYTransition>
133133

134134
<!-- Agreements -->
135-
<VCheckbox
135+
<Checkbox
136136
v-model="acceptedAgreement"
137137
:label="$tr('agreement')"
138-
required
139-
:rules="tosAndPolicyRules"
140-
:hide-details="false"
141138
class="my-1 policy-checkbox"
142139
/>
140+
<!-- Error message for Agreements -->
141+
<VSlideYTransition>
142+
<div v-if="!acceptedAgreement" class="error--text policy-error theme--light v-messages">
143+
<div class="v-messages__message">
144+
{{ $tr("ToSRequiredMessage") }}
145+
</div>
146+
</div>
147+
</VSlideYTransition>
148+
143149
<div class="span-spacing">
144150
<span>
145151
<ActionLink
@@ -241,9 +247,6 @@
241247
passwordConfirmRules() {
242248
return [value => (this.form.password1 === value ? true : this.$tr('passwordMatchMessage'))];
243249
},
244-
tosAndPolicyRules() {
245-
return [value => (value ? true : this.$tr('ToSRequiredMessage'))];
246-
},
247250
acceptedAgreement: {
248251
get() {
249252
return this.form.accepted_tos && this.form.accepted_policy;
@@ -424,7 +427,9 @@
424427
return id === uses.OTHER && this.form.uses.includes(id);
425428
},
426429
submit() {
427-
if (this.$refs.form.validate()) {
430+
// We need to check the "acceptedAgreement" here explicitly because it is not a
431+
// Vuetify form field and does not trigger the form validation.
432+
if (this.$refs.form.validate() && this.acceptedAgreement) {
428433
const cleanedData = this.clean(this.form);
429434
return this.register(cleanedData)
430435
.then(() => {
@@ -528,8 +533,9 @@
528533
}
529534
}
530535
531-
.policy-checkbox /deep/ .v-messages {
536+
.policy-error {
532537
min-height: 0;
538+
margin-bottom: 4px;
533539
margin-left: 40px;
534540
}
535541

0 commit comments

Comments
 (0)