Skip to content

Commit 0122df1

Browse files
committed
add info icon for identifier options
1 parent 181f1fa commit 0122df1

1 file changed

Lines changed: 39 additions & 4 deletions

File tree

src/components/IdentifierCardEditing.vue

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class="bg-formcard q-pa-md"
66
>
77
<q-card-section>
8-
<div class="row items-center no-wrap">
8+
<div class="items-center no-wrap">
99
<q-option-group
1010
inline
1111
type="radio"
@@ -18,7 +18,11 @@
1818
"
1919
/>
2020
</div>
21-
<div class="q-gutter-md items-center no-wrap">
21+
<div class="q-gutter-md q-mt-md items-center no-wrap">
22+
<p class="question">
23+
What is the value of the {{getLinkLabel}}?
24+
<SchemaGuideLink :anchor="getLinkUrl" />
25+
</p>
2226
<q-input
2327
bg-color="white"
2428
label="Value"
@@ -33,7 +37,11 @@
3337
"
3438
/>
3539
</div>
36-
<div class="q-gutter-md items-center no-wrap">
40+
<div class="q-gutter-md q-mt-md items-center no-wrap">
41+
<p class="question">
42+
What is the description for the {{getLinkLabel}}?
43+
<SchemaGuideLink anchor="#definitionsidentifier-description" />
44+
</p>
3745
<q-input
3846
bg-color="white"
3947
label="Description"
@@ -84,10 +92,12 @@
8492
</template>
8593

8694
<script lang="ts">
95+
import {ref} from 'vue'
8796
import { IdentifierTypeType } from '../types'
8897
import { computed, defineComponent, PropType } from 'vue'
8998
import { getMyErrors } from 'src/store/validator'
9099
import { identifierErrors } from 'src/identifier-errors'
100+
import SchemaGuideLink from "components/SchemaGuideLink.vue";
91101
92102
export default defineComponent({
93103
name: 'IdentifierCardEditing',
@@ -113,20 +123,45 @@ export default defineComponent({
113123
default: 0
114124
}
115125
},
126+
components: {
127+
SchemaGuideLink
128+
},
116129
setup (props) {
130+
131+
const linkInfo: any = {
132+
doi: { linkLabel: 'DOI', linkUrl: '#definitionsdoi' },
133+
url: { linkLabel: 'URL', linkUrl: '#definitionsurl' },
134+
swh: { linkLabel: 'Software Heritage identifier', linkUrl: '#definitionsswh-identifier' },
135+
other: { linkLabel: 'identifier', linkUrl: '#definitionsidentifier-description' }
136+
}
137+
117138
return {
118139
typeOptions: [
119140
{ label: 'DOI', value: 'doi' },
120141
{ label: 'URL', value: 'url' },
121142
{ label: 'Software Heritage', value: 'swh' },
122143
{ label: 'Other', value: 'other' }
123144
],
145+
getLinkLabel: computed(() => {
146+
return linkInfo[props.type].linkLabel
147+
}),
148+
getLinkUrl: computed(() => {
149+
return linkInfo[props.type].linkUrl
150+
}),
124151
typeError: computed(() => getMyErrors(`/identifiers/${props.index}/type`)),
125152
valueError: computed(() => getMyErrors(`/identifiers/${props.index}/value`)),
126153
descriptionError: computed(() => getMyErrors(`/identifiers/${props.index}/description`)),
127-
identifierErrors: computed(() => identifierErrors(props.index))
154+
identifierErrors: computed(() => identifierErrors(props.index)),
155+
SchemaGuideLink
128156
}
129157
},
130158
emits: ['closePressed', 'removePressed', 'updateType', 'updateValue', 'updateDescription', 'moveUp', 'moveDown']
131159
})
132160
</script>
161+
<style scoped>
162+
.row {
163+
display: flex;
164+
flex-direction: row;
165+
column-gap: 10px;
166+
}
167+
</style>

0 commit comments

Comments
 (0)