-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hover card to show an entity list
- Loading branch information
1 parent
b2b2a28
commit f72ba83
Showing
16 changed files
with
186 additions
and
75 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,41 @@ | ||
<!-- | ||
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> | ||
<router-link ref="link" :key="to" :to="to">{{ name }}</router-link> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, ref } from 'vue'; | ||
|
||
import useHoverCard from '../../composables/hover-card'; | ||
import useRoutes from '../../composables/routes'; | ||
|
||
defineOptions({ | ||
name: 'DatasetLink' | ||
}); | ||
const props = defineProps({ | ||
projectId: { | ||
type: [Number, String], | ||
required: true | ||
}, | ||
name: { | ||
type: String, | ||
required: true | ||
} | ||
}); | ||
|
||
const { datasetPath } = useRoutes(); | ||
const to = computed(() => datasetPath(props.projectId, props.name)); | ||
|
||
const link = ref(null); | ||
useHoverCard(computed(() => link.value?.$el), 'dataset', () => props); | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!-- | ||
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="database"> | ||
<template #title>{{ dataset.name }}</template> | ||
<template #subtitle>{{ $t('resource.entityList') }}</template> | ||
<template #body> | ||
<dl class="dl-horizontal"> | ||
<dt>{{ $t('resource.entities') }}</dt> | ||
<dd>{{ $n(dataset.entities) }}</dd> | ||
|
||
<dt>{{ $t('header.lastEntity') }}</dt> | ||
<dd><date-time :iso="dataset.lastEntity"/></dd> | ||
|
||
<dt>{{ $t('resource.properties') }}</dt> | ||
<dd>{{ $n(dataset.properties.length) }}</dd> | ||
</dl> | ||
</template> | ||
<template #footer> | ||
<div v-if="dataset.properties.length !== 0" | ||
class="hover-card-dataset-properties"> | ||
<div v-for="{ name } of dataset.properties" :key="name">{{ name }}</div> | ||
</div> | ||
</template> | ||
</hover-card> | ||
</template> | ||
|
||
<script setup> | ||
import DateTime from '../date-time.vue'; | ||
import HoverCard from '../hover-card.vue'; | ||
|
||
defineOptions({ | ||
name: 'HoverCardDataset' | ||
}); | ||
defineProps({ | ||
dataset: { | ||
type: Object, | ||
required: true | ||
} | ||
}); | ||
</script> | ||
|
||
<style lang="scss"> | ||
@import '../../assets/scss/variables'; | ||
|
||
.hover-card-dataset-properties { | ||
display: flex; | ||
margin-inline: -$padding-hover-card; | ||
overflow-x: hidden; | ||
padding-block: 6px; | ||
|
||
div { | ||
font-weight: bold; | ||
|
||
padding: 4px 6px; | ||
&:first-child { padding-left: $padding-hover-card; } | ||
&:last-child { padding-right: $padding-hover-card; } | ||
|
||
+ div { border-left: 1px solid #bbb; } | ||
} | ||
} | ||
</style> |
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.