Skip to content

Commit

Permalink
Avoid hard-coding creation label
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jan 3, 2025
1 parent a417829 commit c01944f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
15 changes: 10 additions & 5 deletions arches_lingo/src/arches_lingo/components/scheme/SchemeCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { inject } from "vue";
import { systemLanguageKey } from "@/arches_lingo/constants.ts";
import { systemLanguageKey, NEW } from "@/arches_lingo/constants.ts";
import { routeNames } from "@/arches_lingo/routes.ts";
import Card from "primevue/card";
Expand All @@ -24,19 +24,24 @@ let schemeDescriptor: ResourceDescriptor = {
if (descriptors) {
const descriptor =
descriptors[systemLanguage.code] ?? Object.values(descriptors)[0];
schemeDescriptor.name = descriptor.name ?? "";
schemeDescriptor.description = descriptor.description ?? "";
if (descriptor) {
schemeDescriptor.name = descriptor.name ?? "";
schemeDescriptor.description = descriptor.description ?? "";
}
}
</script>

<template>
<RouterLink :to="schemeURL">
<Card>
<template #title>
{{ schemeDescriptor.name }}
<p v-if="scheme.resourceinstanceid === NEW">
{{ $gettext("Create a new scheme") }}
</p>
<p v-else>{{ schemeDescriptor.name }}</p>
</template>
<template #content>
{{ schemeDescriptor.description }}
<p>{{ schemeDescriptor.description }}</p>
</template>
</Card>
</RouterLink>
Expand Down
7 changes: 1 addition & 6 deletions arches_lingo/src/arches_lingo/pages/SchemeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ onMounted(async () => {
}
schemes.value.unshift({
resourceinstanceid: NEW,
descriptors: {
en: {
name: "Create a new scheme",
description: "",
},
},
descriptors: {},
});
});
</script>
Expand Down

0 comments on commit c01944f

Please sign in to comment.