|
2 | 2 | <q-card |
3 | 3 | bordered |
4 | 4 | flat |
5 | | - style="display: flex; flex-direction: row" |
6 | 5 | v-bind:class="['bg-formcard', authorErrors.length > 0 ? 'red-border' : '']" |
7 | 6 | > |
8 | | - <div style="flex-grow: 1.0"> |
9 | | - <ul v-bind:data-cy="'card-info' + index"> |
10 | | - <li>{{ author.givenNames }} {{ author.nameParticle }} {{ author.familyNames }} {{ author.nameSuffix }}</li> |
11 | | - <li>{{ author.email }}</li> |
12 | | - <li>{{ author.affiliation }} {{ author.orcid }}</li> |
13 | | - </ul> |
14 | | - </div> |
15 | | - <div> |
16 | | - <q-btn |
17 | | - class="author-button" |
18 | | - color="blue" |
19 | | - icon="ion-arrow-up" |
20 | | - v-bind:aria-label="`Move author ${index + 1} up`" |
21 | | - v-bind:data-cy="'btn-move-up' + index" |
22 | | - v-bind:disable="index == 0" |
23 | | - v-on:click="$emit('moveUp')" |
24 | | - /> |
25 | | - <q-btn |
26 | | - class="author-button" |
27 | | - color="blue" |
28 | | - icon="ion-arrow-down" |
29 | | - v-bind:aria-label="`Move author ${index + 1} down`" |
30 | | - v-bind:data-cy="'btn-move-down' + index" |
31 | | - v-bind:disable="index >= numAuthors - 1" |
32 | | - v-on:click="$emit('moveDown')" |
33 | | - /> |
34 | | - <q-btn |
35 | | - class="author-button" |
36 | | - color="primary" |
37 | | - flat |
38 | | - hover-color="negative" |
39 | | - icon="edit" |
40 | | - title="Edit" |
41 | | - v-bind:aria-label="`Edit author ${index + 1}`" |
42 | | - v-bind:data-cy="'btn-edit' + index" |
43 | | - v-on:click="$emit('editPressed')" |
44 | | - /> |
45 | | - <q-btn |
46 | | - class="author-button" |
47 | | - color="negative" |
48 | | - hover-color="negative" |
49 | | - icon="delete" |
50 | | - title="Remove author" |
51 | | - v-bind:aria-label="`Remove author ${index + 1}`" |
52 | | - v-bind:data-cy="'btn-remove' + index" |
53 | | - v-on:click="$emit('removePressed')" |
54 | | - /> |
55 | | - </div> |
| 7 | + <q-card-section |
| 8 | + horizontal |
| 9 | + > |
| 10 | + <div class="col"> |
| 11 | + <ul |
| 12 | + class="q-pl-md" |
| 13 | + v-bind:data-cy="'card-info' + index" |
| 14 | + > |
| 15 | + <li |
| 16 | + v-for="(field, fieldIndex) in authorFields" |
| 17 | + v-bind:key="fieldIndex" |
| 18 | + class="row" |
| 19 | + > |
| 20 | + {{ field }} |
| 21 | + </li> |
| 22 | + </ul> |
| 23 | + </div> |
| 24 | + <q-card-actions> |
| 25 | + <q-btn |
| 26 | + color="secondary" |
| 27 | + flat |
| 28 | + icon="ion-arrow-up" |
| 29 | + v-bind:aria-label="`Move author ${index + 1} up`" |
| 30 | + v-bind:data-cy="'btn-move-up' + index" |
| 31 | + v-bind:disable="index == 0" |
| 32 | + v-on:click="$emit('moveUp')" |
| 33 | + /> |
| 34 | + <q-btn |
| 35 | + color="secondary" |
| 36 | + flat |
| 37 | + icon="ion-arrow-down" |
| 38 | + v-bind:aria-label="`Move author ${index + 1} down`" |
| 39 | + v-bind:data-cy="'btn-move-down' + index" |
| 40 | + v-bind:disable="index >= numAuthors - 1" |
| 41 | + v-on:click="$emit('moveDown')" |
| 42 | + /> |
| 43 | + <q-btn |
| 44 | + color="secondary" |
| 45 | + flat |
| 46 | + hover-color="negative" |
| 47 | + icon="edit" |
| 48 | + title="Edit" |
| 49 | + v-bind:aria-label="`Edit author ${index + 1}`" |
| 50 | + v-bind:data-cy="'btn-edit' + index" |
| 51 | + v-on:click="$emit('editPressed')" |
| 52 | + /> |
| 53 | + <q-btn |
| 54 | + color="negative" |
| 55 | + flat |
| 56 | + hover-color="negative" |
| 57 | + icon="delete" |
| 58 | + title="Remove author" |
| 59 | + v-bind:aria-label="`Remove author ${index + 1}`" |
| 60 | + v-bind:data-cy="'btn-remove' + index" |
| 61 | + v-on:click="$emit('removePressed')" |
| 62 | + /> |
| 63 | + </q-card-actions> |
| 64 | + </q-card-section> |
56 | 65 | </q-card> |
57 | 66 | </template> |
58 | 67 |
|
@@ -97,28 +106,17 @@ export default defineComponent({ |
97 | 106 | .map(query => query.replace.message) |
98 | 107 | }) |
99 | 108 | const authorErrors = computed(() => [...emailErrors.value, ...orcidErrors.value, ...duplicateErrors.value]) |
| 109 | + const authorFields = computed(() => [ |
| 110 | + [props.author.givenNames, props.author.nameParticle, props.author.familyNames, props.author.nameSuffix].join(' '), |
| 111 | + props.author.email, |
| 112 | + props.author.affiliation, |
| 113 | + props.author.orcid |
| 114 | + ].filter((x) => x)) |
100 | 115 | return { |
101 | | - authorErrors |
| 116 | + authorErrors, |
| 117 | + authorFields |
102 | 118 | } |
103 | 119 | }, |
104 | 120 | emits: ['editPressed', 'moveDown', 'moveUp', 'removePressed'] |
105 | 121 | }) |
106 | 122 | </script> |
107 | | -<style scoped> |
108 | | -ul { |
109 | | - padding-inline-start: 20px; |
110 | | -} |
111 | | -li { |
112 | | - list-style: none; |
113 | | - list-style-position: inside; |
114 | | -} |
115 | | -.author-button { |
116 | | - background-color: white; |
117 | | - border: 1px solid #ccc; |
118 | | - margin-bottom: 5px; |
119 | | - margin-left: 5px; |
120 | | - margin-right: 5px; |
121 | | - margin-top: 5px; |
122 | | - padding: 10px; |
123 | | -} |
124 | | -</style> |
0 commit comments