Skip to content

Commit 827094d

Browse files
committed
create caption input for maps and charts
1 parent 6ab1b8b commit 827094d

File tree

7 files changed

+57
-6
lines changed

7 files changed

+57
-6
lines changed

StorylinesSchema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@
185185
"title": {
186186
"type": "string",
187187
"description": "A title that is displayed centered above this map."
188+
},
189+
"caption": {
190+
"type": "string",
191+
"description": "Supporting text content for the map."
188192
}
189193
},
190194
"required": ["config", "type"]

public/StorylinesSlideSchema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@
192192
"type": "string",
193193
"description": "A title that is displayed centered above this map."
194194
},
195+
"caption": {
196+
"type": "string",
197+
"description": "Supporting text content for the map."
198+
},
195199
"timeSlider": {
196200
"type": "object",
197201
"description": "Configuration for a time slider on the map.",
@@ -256,6 +260,10 @@
256260
"customStyles": {
257261
"type": "string",
258262
"description": "Additional CSS styles to apply to the panel."
263+
},
264+
"caption": {
265+
"type": "string",
266+
"description": "Supporting text content for the chart."
259267
}
260268
},
261269
"additionalProperties": false,

src/components/chart-editor.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
:configFileStructure="configFileStructure"
4848
:sourceCounts="sourceCounts"
4949
:lang="lang"
50+
:index="index"
5051
@edit="editChart"
5152
@delete="$vfm.open(`${element.name}-${index}`)"
53+
@captionEdit="onChartsEdited"
5254
></ChartPreview>
5355
</template>
5456
</draggable>

src/components/helpers/chart-preview.vue

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,32 @@
4242
></storylines-chart>
4343
</div>
4444
<!-- chart description and edit -->
45-
<div class="flex mt-4 items-center">
46-
<label class="editor-label name-label font-bold flex-2"
47-
>{{ $t('editor.chart.label.name') }}: <span class="font-normal">{{ chartName }}</span></label
48-
>
45+
<div class="flex mt-4 items-center flex-wrap">
46+
<div class="flex flex-2 w-4/5" style="min-width: 130px">
47+
<div class="flex flex-col mr-2 justify-between">
48+
<label class="name-label font-bold"> {{ $t('editor.chart.label.name') }}: </label>
49+
<label :for="'chartPreviewCaption' + index" class="name-label font-bold pb-2">
50+
{{ $t('editor.image.label.caption') }}:
51+
</label>
52+
</div>
53+
<div class="flex flex-col justify-between">
54+
<label class="name-label font-bold">
55+
<span class="font-normal break-all">{{ chartName }}</span>
56+
</label>
57+
<input
58+
:id="'chartPreviewCaption' + index"
59+
class="editor-input w-5/6"
60+
type="text"
61+
v-model="chart.caption"
62+
:placeholder="$t('editor.caption.placeholder')"
63+
@input="$emit('captionEdit')"
64+
/>
65+
</div>
66+
</div>
67+
4968
<!-- edit button -->
5069
<button
51-
class="editor-button chart-btn bg-gray-100 cursor-pointer hover:bg-gray-200"
70+
class="editor-button chart-btn bg-gray-100 cursor-pointer hover:bg-gray-200 m-0 mt-4"
5271
:id="`edit-${chart.name}-btn`"
5372
>
5473
<div class="flex items-center">
@@ -92,6 +111,7 @@ export default class ChartPreviewV extends Vue {
92111
@Prop() configFileStructure!: ConfigFileStructure;
93112
@Prop() sourceCounts!: SourceCounts;
94113
@Prop() lang!: string;
114+
@Prop() index!: number;
95115
96116
loading = true;
97117
chartIdx = 0;

src/components/map-editor.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@
2424

2525
<div class="mb-4" v-if="usingTimeSlider"></div>
2626

27+
<div class="flex items-center w-full text-left mt-2">
28+
<label class="editor-label text-label" for="rampMapCaption">
29+
{{ $t('editor.image.label.caption') }}:</label
30+
>
31+
<input
32+
id="rampMapCaption"
33+
class="editor-input w-2/5"
34+
type="text"
35+
v-model="panel.caption"
36+
:placeholder="$t('editor.caption.placeholder')"
37+
/>
38+
</div>
39+
2740
<div class="ramp-editor mt-5" ref="editor" style="width: 70vw; height: 80vh"></div>
2841
</div>
2942
<vue-final-modal
@@ -44,7 +57,7 @@
4457
:disabled="timeSliderError"
4558
@click="saveTimeSlider"
4659
>
47-
Done
60+
{{ $t('editor.done') }}
4861
</button>
4962
</div>
5063
</vue-final-modal>

src/definitions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export interface MapPanel extends BasePanel {
183183
title: string;
184184
scrollguard: boolean;
185185
customStyles?: string;
186+
caption?: string;
186187
}
187188
export interface TimeSliderConfig {
188189
range: number[];
@@ -252,6 +253,7 @@ export interface ChartPanel extends BasePanel {
252253
name?: string;
253254
options?: DQVOptions;
254255
customStyles?: string;
256+
caption?: string;
255257
}
256258

257259
export interface ChartConfig {
@@ -260,6 +262,7 @@ export interface ChartConfig {
260262
config?: any;
261263
name?: string;
262264
options?: DQVOptions;
265+
caption?: string;
263266
}
264267

265268
export interface ImageFile {

src/lang/lang.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ editor.next,Next,1,Suivant,1
122122
editor.preview,Preview,1,Afficher l’aperçu,1
123123
editor.confirm,Confirm,1,Confirmer,1
124124
editor.cancel,Cancel,1,Annuler,1
125+
editor.caption.placeholder,Add a caption,1,Ajouter une légende,0
125126
editor.unsavedChanges,Unsaved changes,1,Modifications non enregistrées,1
126127
editor.saveChanges,Save changes,1,Enregistrer les modifications,1
127128
editor.discardChanges,Discard changes,1,Annuler les modifications,0

0 commit comments

Comments
 (0)