Skip to content

Commit e7fb6e5

Browse files
authored
Merge pull request #683 from citation-file-format/659-info-identifiers
2 parents 0177557 + 2e3b560 commit e7fb6e5

2 files changed

Lines changed: 113 additions & 20 deletions

File tree

src/components/IdentifierCardEditing.vue

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
<div class="row">
1919
<h3 class="subquestion">
2020
What is the value of the {{ label }}?
21-
<SchemaGuideLink v-bind:anchor="anchor" />
21+
<q-icon
22+
name="ion-information-circle-outline"
23+
size="24px"
24+
color="primary"
25+
v-on:click="showIdentifierHelp = true"
26+
style="cursor:pointer;"
27+
/>
2228
</h3>
2329
</div>
2430
<q-input
@@ -39,7 +45,13 @@
3945
<div class="row">
4046
<h3 class="subquestion">
4147
What is the description for the {{ label }}?
42-
<SchemaGuideLink anchor="#definitionsidentifier-description" />
48+
<q-icon
49+
name="ion-information-circle-outline"
50+
size="24px"
51+
color="primary"
52+
v-on:click="showDescriptionHelp = true"
53+
style="cursor:pointer;"
54+
/>
4355
</h3>
4456
</div>
4557
<q-input
@@ -69,13 +81,21 @@
6981
/>
7082
</q-card-actions>
7183
</q-card>
84+
<InfoDialog
85+
v-model="showIdentifierHelp"
86+
v-bind:data="helpData[identifierType]"
87+
/>
88+
<InfoDialog
89+
v-model="showDescriptionHelp"
90+
v-bind:data="helpData.description"
91+
/>
7292
</template>
7393

7494
<script lang="ts">
75-
import { PropType, computed, defineComponent } from 'vue'
95+
import { PropType, computed, defineComponent, ref } from 'vue'
7696
import { byError, identifierValueQueries, unique } from 'src/error-filtering'
7797
import { IdentifierTypeType } from 'src/types'
78-
import SchemaGuideLink from 'src/components/SchemaGuideLink.vue'
98+
import InfoDialog from 'src/components/InfoDialog.vue'
7999
import { useValidation } from 'src/store/validation'
80100
81101
export default defineComponent({
@@ -99,35 +119,83 @@ export default defineComponent({
99119
}
100120
},
101121
components: {
102-
SchemaGuideLink
122+
InfoDialog
103123
},
104124
setup (props) {
105125
const { errors } = useValidation()
106-
const linkInfo = {
107-
doi: { label: 'DOI', anchor: '#definitionsdoi' },
108-
url: { label: 'URL', anchor: '#definitionsurl' },
109-
swh: {
110-
label: 'Software Heritage identifier',
111-
anchor: '#definitionsswh-identifier'
112-
},
113-
other: { label: 'identifier', anchor: '#definitionsidentifier' }
126+
const labels = {
127+
doi: 'DOI',
128+
url: 'URL',
129+
swh: 'Software Heritage identifier',
130+
other: 'identifier'
114131
}
115132
const identifierValueErrors = computed(() => {
116133
return identifierValueQueries(props.index, ['doi', 'url', 'swh', 'other'].indexOf(props.type))
117134
.filter(byError(errors.value))
118135
.map(query => query.replace.message)
119136
.filter(unique)
120137
})
138+
const helpData = {
139+
doi: {
140+
title: 'doi',
141+
url: 'https://github.com/citation-file-format/citation-file-format/blob/1.2.0/schema-guide.md#definitionsdoi',
142+
description: 'The DOI (https://en.wikipedia.org/wiki/Digital_object_identifier) of the work.',
143+
examples: [
144+
'10.5281/zenodo.1003150'
145+
]
146+
},
147+
url: {
148+
title: 'url',
149+
url: 'https://github.com/citation-file-format/citation-file-format/blob/1.2.0/schema-guide.md#definitionsurl',
150+
description: 'A URL.',
151+
examples: [
152+
'https://research-software-project.org',
153+
'http://research-software-project.org',
154+
'sftp://files.research-software-project.org',
155+
'ftp://files.research-software-project.org'
156+
]
157+
},
158+
swh: {
159+
title: 'swh',
160+
url: 'https://github.com/citation-file-format/citation-file-format/blob/1.2.0/schema-guide.md#definitionsswh-identifier',
161+
description: 'The Software Heritage identifier (https://www.softwareheritage.org/).',
162+
examples: [
163+
'swh:1:rev:309cf2674ee7a0749978cf8265ab91a60aea0f7d'
164+
]
165+
},
166+
other: {
167+
title: 'other',
168+
url: 'https://github.com/citation-file-format/citation-file-format/blob/1.2.0/schema-guide.md#definitionsidentifier',
169+
description: 'An identifier that does not fit in the other categories.',
170+
examples: [
171+
'arXiv:2103.06681'
172+
]
173+
},
174+
description: {
175+
title: 'description',
176+
url: 'https://github.com/citation-file-format/citation-file-format/blob/1.2.0/schema-guide.md#definitionsidentifier-description',
177+
description: 'A description of the identifier.',
178+
examples: [
179+
'The concept DOI of the work.',
180+
'The URL of version 1.1.0 of the software',
181+
'The Software Heritage link for version 1.1.0.',
182+
'The ArXiv deposit of the encompassing paper.'
183+
]
184+
}
185+
}
121186
return {
187+
helpData,
122188
typeOptions: [
123189
{ label: 'DOI', value: 'doi' },
124190
{ label: 'URL', value: 'url' },
125191
{ label: 'Software Heritage', value: 'swh' },
126192
{ label: 'Other', value: 'other' }
127193
],
128-
label: computed(() => linkInfo[props.type].label),
129-
anchor: computed(() => linkInfo[props.type].anchor),
130-
identifierValueErrors
194+
identifierType: computed(() => props.type),
195+
label: computed(() => labels[props.type]),
196+
identifierValueErrors,
197+
showDescriptionHelp: ref(false),
198+
showIdentifierHelp: ref(false)
131199
}
132200
},
133201
emits: [

src/components/ScreenIdentifiers.vue

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
<div id="form-content">
99
<h2 class="question">
1010
What persistent identifiers are available for the work?
11-
<SchemaGuideLink anchor="#identifiers" />
11+
<q-icon
12+
name="ion-information-circle-outline"
13+
size="24px"
14+
color="primary"
15+
v-on:click="showIdentifiersHelp = true"
16+
style="cursor:pointer;"
17+
/>
1218
</h2>
1319
<div class="scroll-to-bottom-container">
1420
<span class="bottom" />
@@ -60,6 +66,10 @@
6066
{{ screenMessage }}
6167
</div>
6268
</q-banner>
69+
<InfoDialog
70+
v-model="showIdentifiersHelp"
71+
v-bind:data="helpData.identifiers"
72+
/>
6373
</div>
6474
</template>
6575

@@ -70,7 +80,7 @@ import { computed, defineComponent, nextTick, onUpdated, ref } from 'vue'
7080
import { moveDown, moveUp } from 'src/updown'
7181
import IdentifierCardEditing from 'components/IdentifierCardEditing.vue'
7282
import IdentifierCardViewing from 'components/IdentifierCardViewing.vue'
73-
import SchemaGuideLink from 'components/SchemaGuideLink.vue'
83+
import InfoDialog from 'components/InfoDialog.vue'
7484
import { scrollToBottom } from 'src/scroll-to-bottom'
7585
import { useCff } from 'src/store/cff'
7686
import { useStepperErrors } from 'src/store/stepper-errors'
@@ -79,7 +89,7 @@ import { useValidation } from 'src/store/validation'
7989
export default defineComponent({
8090
name: 'ScreenIdentifiers',
8191
components: {
82-
SchemaGuideLink,
92+
InfoDialog,
8393
IdentifierCardEditing,
8494
IdentifierCardViewing
8595
},
@@ -167,17 +177,32 @@ export default defineComponent({
167177
.filter(byError(errors.value))
168178
.map(query => query.replace.message)
169179
})
180+
const helpData = {
181+
identifiers: {
182+
title: 'identifiers',
183+
url: 'https://github.com/citation-file-format/citation-file-format/blob/1.2.0/schema-guide.md#identifiers',
184+
description: 'The identifiers of the work, such as DOIs, Software Heritage deposits, and URLs for relevant objects.',
185+
examples: [
186+
'DOI: 10.5281/zenodo.1003149 - The concept DOI of the work',
187+
'SWH: swh:1:dir:bc286860f423ea7ced246ba7458eef4b4541cf2d - The Software Heritage for version 1.1.0',
188+
'URL: https://github.com/citation-file-format/citation-file-format/releases/tag/1.1.0 - The GitHub release URL of tag 1.1.0',
189+
'OTHER: arXiv:2103.06681 - The ArXiv preprint of the paper'
190+
]
191+
}
192+
}
170193
return {
171194
addIdentifier,
172195
editingId,
196+
helpData,
173197
identifiers,
174198
identifiersErrors,
175199
moveIdentifierUp,
176200
moveIdentifierDown,
177201
removeIdentifier,
178202
setIdentifierDescriptionField,
179203
setIdentifierTypeField,
180-
setIdentifierValueField
204+
setIdentifierValueField,
205+
showIdentifiersHelp: ref(false)
181206
}
182207
}
183208
})

0 commit comments

Comments
 (0)