-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hover cards #1067
Add hover cards #1067
Changes from 6 commits
fd11ef8
79d2de9
e338e52
1f040c7
898aa14
5e95312
12afaf1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,7 @@ p { @include text-block; } | |
|
||
dl > * { | ||
border-bottom: 1px solid #ddd; | ||
padding-bottom: 10px; | ||
padding-top: 10px; | ||
padding-block: $padding-block-dl; | ||
|
||
&:first-of-type { padding-top: 0; } | ||
|
||
|
@@ -75,7 +74,7 @@ dl:not(.dl-horizontal) { | |
// down to the fact that .dl-horizontal uses a CSS grid, while other <dl> | ||
// elements use flexbox. | ||
.dl-horizontal { | ||
$padding-between: 10px; | ||
$padding-between: 12px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will have a minor effect on |
||
$dt-width: 160px + $padding-panel-body + $padding-between; | ||
|
||
display: grid; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- | ||
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 `to` changes, the element will be replaced. If a | ||
hover card is shown next to the element, it will be hidden. --> | ||
<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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to pass the |
||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ 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> | ||
<div id="dataset-show"> | ||
<breadcrumbs v-if="dataExists" :links="breadcrumbLinks"/> | ||
|
@@ -84,7 +83,7 @@ export default { | |
const { tabPath, tabClass } = useTabs(datasetPath()); | ||
return { | ||
project, dataset, ...resourceStates([project, dataset]), | ||
projectPath, datasetPath, tabPath, tabClass, canRoute | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I searched for all uses of |
||
projectPath, tabPath, tabClass, canRoute | ||
}; | ||
}, | ||
computed: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,8 @@ except according to the terms contained in the LICENSE file. | |
<div class="row"> | ||
<div class="col-xs-6 dataset-name-wrap"> | ||
<div class="dataset-name text-overflow-ellipsis" v-tooltip.text> | ||
<router-link v-if="!dataset.isNew" :to="datasetPath(projectId, dataset.name)" v-tooltip.text> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parent element specifies |
||
{{ dataset.name }} | ||
</router-link> | ||
<dataset-link v-if="!dataset.isNew" :project-id="projectId" | ||
:name="dataset.name"/> | ||
<template v-else> | ||
{{ dataset.name }} | ||
</template> | ||
|
@@ -50,13 +49,12 @@ except according to the terms contained in the LICENSE file. | |
</template> | ||
|
||
<script> | ||
import DatasetLink from '../link.vue'; | ||
import I18nList from '../../i18n/list.vue'; | ||
|
||
import useRoutes from '../../../composables/routes'; | ||
|
||
export default { | ||
name: 'DatasetSummaryRow', | ||
components: { I18nList }, | ||
components: { DatasetLink, I18nList }, | ||
props: { | ||
dataset: { | ||
type: Object, | ||
|
@@ -67,10 +65,6 @@ export default { | |
required: true | ||
} | ||
}, | ||
setup() { | ||
const { datasetPath } = useRoutes(); | ||
return { datasetPath }; | ||
}, | ||
data() { | ||
return { | ||
expanded: false | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because I want to be able to specify
v-if
before:is
. I feel likev-if
should generally be the very first thing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.