-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e338e52
commit 1f040c7
Showing
17 changed files
with
329 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!-- | ||
Copyright 2024 ODK Central Developers | ||
See the NOTICE file at the top-level directory of this distribution and at | ||
https://github.com/getodk/central-frontend/blob/master/NOTICE. | ||
|
||
This file is part of ODK Central. It is subject to the license terms in | ||
the LICENSE file found in the top-level directory of this distribution and at | ||
https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, | ||
including this file, may be copied, modified, propagated, or distributed | ||
except according to the terms contained in the LICENSE file. | ||
--> | ||
|
||
<!-- Specifying :key so that if the link path changes, the element will be | ||
replaced. If a hover card is shown next to the element, it will be hidden. --> | ||
<template> | ||
<link-if-can v-if="to == null" ref="link" :key="toDefault" :to="toDefault"> | ||
{{ form.name ?? form.xmlFormId }} | ||
</link-if-can> | ||
<router-link v-else ref="link" :key="to" :to="to"> | ||
{{ form.name ?? form.xmlFormId }} | ||
</router-link> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, ref } from 'vue'; | ||
|
||
import LinkIfCan from '../link-if-can.vue'; | ||
|
||
import useHoverCard from '../../composables/hover-card'; | ||
import useRoutes from '../../composables/routes'; | ||
|
||
defineOptions({ | ||
name: 'FormLink' | ||
}); | ||
const props = defineProps({ | ||
// This may be a transformed form resource, but it is not required to be. For | ||
// example, props.form.nameOrId may or may not be defined. | ||
form: { | ||
type: Object, | ||
required: true | ||
}, | ||
to: String | ||
}); | ||
|
||
const { primaryFormPath } = useRoutes(); | ||
const toDefault = computed(() => primaryFormPath(props.form)); | ||
|
||
const link = ref(null); | ||
useHoverCard(computed(() => link.value?.$el), 'form', () => props.form); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!-- | ||
Copyright 2024 ODK Central Developers | ||
See the NOTICE file at the top-level directory of this distribution and at | ||
https://github.com/getodk/central-frontend/blob/master/NOTICE. | ||
|
||
This file is part of ODK Central. It is subject to the license terms in | ||
the LICENSE file found in the top-level directory of this distribution and at | ||
https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, | ||
including this file, may be copied, modified, propagated, or distributed | ||
except according to the terms contained in the LICENSE file. | ||
--> | ||
<template> | ||
<hover-card icon="file" :truncate-dt="false"> | ||
<template #title>{{ form.nameOrId }}</template> | ||
<template #subtitle>{{ $t('resource.form') }}</template> | ||
<template #body> | ||
<dl class="dl-horizontal"> | ||
<dt>{{ $t('common.version') }}</dt> | ||
<dd><form-version-string :version="form.version"/></dd> | ||
|
||
<dt>{{ $t('resource.submissions') }}</dt> | ||
<dd>{{ $n(form.submissions, 'default') }}</dd> | ||
|
||
<dt>{{ $t('header.lastSubmission') }}</dt> | ||
<dd><date-time :iso="form.lastSubmission"/></dd> | ||
</dl> | ||
</template> | ||
</hover-card> | ||
</template> | ||
|
||
<script setup> | ||
import DateTime from '../date-time.vue'; | ||
import FormVersionString from '../form-version/string.vue'; | ||
import HoverCard from '../hover-card.vue'; | ||
|
||
import { useRequestData } from '../../request-data'; | ||
|
||
defineOptions({ | ||
name: 'HoverCardForm' | ||
}); | ||
|
||
const { form } = useRequestData(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.