Documents Fix status default value

pull/3890/head
Julio Montoya 4 years ago
parent bb93151832
commit 331698b11f
  1. 35
      assets/vue/components/documents/ResourceLinkForm.vue

@ -19,11 +19,12 @@
<q-separator /> <q-separator />
<q-select <q-select
filled
v-model="link.visibility" v-model="link.visibility"
:options="visibilityList" :options="visibilityList"
emit-value
label="Status" label="Status"
persistent-hint emit-value
map-options
/> />
</li> </li>
</ul> </ul>
@ -38,7 +39,11 @@ import { required } from '@vuelidate/validators';
export default { export default {
name: 'ResourceLinkForm', name: 'ResourceLinkForm',
setup () { setup () {
return { v$: useVuelidate() } const visibilityList = [
{value: 2, label: 'Published'},
{value: 0, label: 'Draft'},
];
return {v$: useVuelidate(), visibilityList};
}, },
props: { props: {
values: { values: {
@ -54,34 +59,10 @@ export default {
default: () => {} default: () => {}
}, },
}, },
data() {
return {
// See ResourceLink entity constants.
visibilityList: [
{value: 2, label: 'Published'},
{value: 0, label: 'Draft'},
],
};
},
computed: { computed: {
item() { item() {
return this.initialValues || this.values; return this.initialValues || this.values;
}, },
titleErrors() {
const errors = [];
if (!this.$v.item.title.$dirty) return errors;
has(this.violations, 'title') && errors.push(this.violations.title);
!this.$v.item.title.required && errors.push(this.$t('Field is required'));
return errors;
},
violations() {
return this.errors || {};
}
}, },
validations: {
item: {
}
}
}; };
</script> </script>

Loading…
Cancel
Save