Render collection name in field creation modal

This commit is contained in:
rijkvanzanten
2020-09-03 17:23:25 -04:00
parent 096ba4c91b
commit 33c15bcb44
2 changed files with 12 additions and 4 deletions

View File

@@ -104,7 +104,7 @@
"create_field": "Create Field",
"update_field": "Update Field",
"creating_new_field": "Creating New Field",
"creating_new_field": "Creating New Field within {collection}",
"updating_field_field": "Updating Field {field}",
"within_collection": "Within {collection}",

View File

@@ -1,7 +1,11 @@
<template>
<v-modal
:active="true"
:title="field === '+' ? $t('creating_new_field') : $t('updating_field_field', { field: existingField.name })"
:title="
field === '+'
? $t('creating_new_field', { collection: collectionInfo.name })
: $t('updating_field_field', { field: existingField.name })
"
:subtitle="localType ? $t(`field_${localType}`) : null"
persistent
>
@@ -52,7 +56,7 @@
</template>
<script lang="ts">
import { defineComponent, onMounted, ref, computed, reactive, PropType, watch } from '@vue/composition-api';
import { defineComponent, onMounted, ref, computed, reactive, PropType, watch, toRefs } from '@vue/composition-api';
import SetupTabs from './components/tabs.vue';
import SetupActions from './components/actions.vue';
import SetupSchema from './components/schema.vue';
@@ -66,6 +70,7 @@ import { Relation } from '@/types';
import { useFieldsStore, useRelationsStore } from '@/stores/';
import { Field } from '@/types';
import router from '@/router';
import useCollection from '@/composables/use-collection';
import { initLocalStore, state, clearLocalStore } from './store';
@@ -96,6 +101,9 @@ export default defineComponent({
const fieldsStore = useFieldsStore();
const relationsStore = useRelationsStore();
const { collection } = toRefs(props);
const { info: collectionInfo } = useCollection(collection);
const existingField = computed(() => {
if (props.field === '+') return null;
@@ -119,7 +127,6 @@ export default defineComponent({
const saving = ref(false);
return {
// active,
tabs,
currentTab,
fieldData: state.fieldData,
@@ -130,6 +137,7 @@ export default defineComponent({
cancelField,
localType,
existingField,
collectionInfo,
};
function useTabs() {