Skip to content

Commit

Permalink
disable sort for singleton collections
Browse files Browse the repository at this point in the history
  • Loading branch information
joselcvarela committed Oct 31, 2021
1 parent 41abc23 commit ee095c8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/src/modules/settings/routes/data-model/new-collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@
v-model="info.name"
class="monospace"
:class="{ active: info.enabled }"
:disabled="info.inputDisabled"
@focus="info.enabled = true"
>
<template #prepend>
<v-checkbox v-model="info.enabled" />
<v-checkbox v-model="info.enabled" :disabled="info.inputDisabled" />
</template>

<template #append>
Expand Down Expand Up @@ -122,7 +123,7 @@

<script lang="ts">
import { useI18n } from 'vue-i18n';
import { defineComponent, ref, reactive } from 'vue';
import { defineComponent, ref, reactive, watch } from 'vue';
import api from '@/api';
import { Field, Relation } from '@directus/shared/types';
import { useFieldsStore, useCollectionsStore, useRelationsStore } from '@/stores/';
Expand Down Expand Up @@ -160,36 +161,42 @@ export default defineComponent({
const systemFields = reactive({
status: {
enabled: false,
inputDisabled: false,
name: 'status',
label: 'status',
icon: 'flag',
},
sort: {
enabled: false,
inputDisabled: false,
name: 'sort',
label: 'sort',
icon: 'low_priority',
},
dateCreated: {
enabled: false,
inputDisabled: false,
name: 'date_created',
label: 'created_on',
icon: 'access_time',
},
userCreated: {
enabled: false,
inputDisabled: false,
name: 'user_created',
label: 'created_by',
icon: 'account_circle',
},
dateUpdated: {
enabled: false,
inputDisabled: false,
name: 'date_updated',
label: 'updated_on',
icon: 'access_time',
},
userUpdated: {
enabled: false,
inputDisabled: false,
name: 'user_updated',
label: 'updated_by',
icon: 'account_circle',
Expand All @@ -198,6 +205,8 @@ export default defineComponent({
const saving = ref(false);
watch(() => singleton.value, setOptionsForSingleton);
return {
t,
router,
Expand All @@ -212,6 +221,10 @@ export default defineComponent({
singleton,
};
function setOptionsForSingleton() {
systemFields.sort.inputDisabled = singleton.value;
}
async function save() {
saving.value = true;
Expand Down

0 comments on commit ee095c8

Please sign in to comment.