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"
1212 v-bind:error =" typeError.hasError"
1313 v-bind:error-message =" typeError.messages.join(', ')"
1414 v-bind:model-value =" type"
1515 v-bind:options =" typeOptions"
16- v-on:update:modelValue ="
17- $emit('updateType', 'type', $event)
18- "
16+ v-on:update:modelValue =" $emit('updateType', 'type', $event)"
1917 />
2018 </div >
21- <div class =" q-gutter-md items-center no-wrap" >
19+ <div class =" q-mt-md items-center no-wrap" >
20+ <div class =" row" >
21+ <q-label class =" text-dark" >
22+ What is the value of the {{ label }}?
23+ <SchemaGuideLink v-bind:anchor =" anchor" />
24+ </q-label >
25+ </div >
2226 <q-input
2327 bg-color =" white"
2428 label =" Value"
2832 v-bind:error =" valueError.hasError"
2933 v-bind:error-message =" valueError.messages.join(', ')"
3034 v-bind:model-value =" value"
31- v-on:update:modelValue ="
32- $emit('updateValue', 'value', $event)
33- "
35+ v-on:update:modelValue =" $emit('updateValue', 'value', $event)"
3436 />
3537 </div >
36- <div class =" q-gutter-md items-center no-wrap" >
38+ <div class =" q-mt-md items-center no-wrap" >
39+ <div class =" row" >
40+ <q-label class =" text-dark" >
41+ What is the description for the {{ label }}?
42+ <SchemaGuideLink anchor =" #definitionsidentifier-description" />
43+ </q-label >
44+ </div >
3745 <q-input
3846 bg-color =" white"
3947 label =" Description"
4351 v-bind:error =" descriptionError.hasError"
4452 v-bind:error-message =" descriptionError.messages.join(', ')"
4553 v-bind:model-value =" description"
46- v-on:update:modelValue ="
47- $emit('updateDescription', 'description', $event)
48- "
54+ v-on:update:modelValue =" $emit('updateDescription', 'description', $event)"
4955 />
5056 </div >
5157 </q-card-section >
@@ -88,6 +94,7 @@ import { IdentifierTypeType } from '../types'
8894import { computed , defineComponent , PropType } from ' vue'
8995import { getMyErrors } from ' src/store/validator'
9096import { identifierErrors } from ' src/identifier-errors'
97+ import SchemaGuideLink from ' src/components/SchemaGuideLink.vue'
9198
9299export default defineComponent ({
93100 name: ' IdentifierCardEditing' ,
@@ -97,11 +104,11 @@ export default defineComponent({
97104 required: true
98105 },
99106 type: {
100- type: String ,
107+ type: String as PropType < IdentifierTypeType > ,
101108 default: ' '
102109 },
103110 value: {
104- type: String as PropType < IdentifierTypeType > ,
111+ type: String ,
105112 default: ' '
106113 },
107114 description: {
@@ -113,20 +120,52 @@ export default defineComponent({
113120 default: 0
114121 }
115122 },
123+ components: {
124+ SchemaGuideLink
125+ },
116126 setup (props ) {
127+ const linkInfo = {
128+ doi: { label: ' DOI' , anchor: ' #definitionsdoi' },
129+ url: { label: ' URL' , anchor: ' #definitionsurl' },
130+ swh: {
131+ label: ' Software Heritage identifier' ,
132+ anchor: ' #definitionsswh-identifier'
133+ },
134+ other: { label: ' identifier' , anchor: ' #definitionsidentifier' }
135+ }
136+
117137 return {
118138 typeOptions: [
119139 { label: ' DOI' , value: ' doi' },
120140 { label: ' URL' , value: ' url' },
121141 { label: ' Software Heritage' , value: ' swh' },
122142 { label: ' Other' , value: ' other' }
123143 ],
144+ label: computed (() => linkInfo [props .type ].label ),
145+ anchor: computed (() => linkInfo [props .type ].anchor ),
124146 typeError: computed (() => getMyErrors (` /identifiers/${props .index }/type ` )),
125147 valueError: computed (() => getMyErrors (` /identifiers/${props .index }/value ` )),
126- descriptionError: computed (() => getMyErrors (` /identifiers/${props .index }/description ` )),
148+ descriptionError: computed (() =>
149+ getMyErrors (` /identifiers/${props .index }/description ` )
150+ ),
127151 identifierErrors: computed (() => identifierErrors (props .index ))
128152 }
129153 },
130- emits: [' closePressed' , ' removePressed' , ' updateType' , ' updateValue' , ' updateDescription' , ' moveUp' , ' moveDown' ]
154+ emits: [
155+ ' closePressed' ,
156+ ' removePressed' ,
157+ ' updateType' ,
158+ ' updateValue' ,
159+ ' updateDescription' ,
160+ ' moveUp' ,
161+ ' moveDown'
162+ ]
131163})
132164 </script >
165+ <style scoped>
166+ .row {
167+ display : flex ;
168+ flex-direction : row ;
169+ column-gap : 10px ;
170+ }
171+ </style >
0 commit comments