Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create caption input for maps and charts #428

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions StorylinesSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@
"title": {
"type": "string",
"description": "A title that is displayed centered above this map."
},
"caption": {
"type": "string",
"description": "Supporting text content for the map."
}
},
"required": ["config", "type"]
Expand Down
8 changes: 8 additions & 0 deletions public/StorylinesSlideSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
"type": "string",
"description": "A title that is displayed centered above this map."
},
"caption": {
"type": "string",
"description": "Supporting text content for the map."
},
"timeSlider": {
"type": "object",
"description": "Configuration for a time slider on the map.",
Expand Down Expand Up @@ -256,6 +260,10 @@
"customStyles": {
"type": "string",
"description": "Additional CSS styles to apply to the panel."
},
"caption": {
"type": "string",
"description": "Supporting text content for the chart."
}
},
"additionalProperties": false,
Expand Down
2 changes: 2 additions & 0 deletions src/components/chart-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
:configFileStructure="configFileStructure"
:sourceCounts="sourceCounts"
:lang="lang"
:index="index"
@edit="editChart"
@delete="$vfm.open(`${element.name}-${index}`)"
@captionEdit="onChartsEdited"
></ChartPreview>
</template>
</draggable>
Expand Down
30 changes: 25 additions & 5 deletions src/components/helpers/chart-preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,32 @@
></storylines-chart>
</div>
<!-- chart description and edit -->
<div class="flex mt-4 items-center">
<label class="editor-label name-label font-bold flex-2"
>{{ $t('editor.chart.label.name') }}: <span class="font-normal">{{ chartName }}</span></label
>
<div class="flex mt-4 items-center flex-wrap">
<div class="flex flex-2 w-4/5" style="min-width: 130px">
<div class="flex flex-col mr-2 justify-between">
<label class="name-label font-bold"> {{ $t('editor.chart.label.name') }}: </label>
<label :for="'chartPreviewCaption' + index" class="name-label font-bold pb-2">
{{ $t('editor.image.label.caption') }}:
</label>
</div>
<div class="flex flex-col justify-between">
<label class="name-label font-bold">
<span class="font-normal break-all">{{ chartName }}</span>
</label>
<input
:id="'chartPreviewCaption' + index"
class="editor-input w-5/6"
type="text"
v-model="chart.caption"
:placeholder="$t('editor.caption.placeholder')"
@input="$emit('captionEdit')"
/>
</div>
</div>

<!-- edit button -->
<button
class="editor-button chart-btn bg-gray-100 cursor-pointer hover:bg-gray-200"
class="editor-button chart-btn bg-gray-100 cursor-pointer hover:bg-gray-200 m-0 mt-4"
:id="`edit-${chart.name}-btn`"
>
<div class="flex items-center">
Expand Down Expand Up @@ -92,6 +111,7 @@ export default class ChartPreviewV extends Vue {
@Prop() configFileStructure!: ConfigFileStructure;
@Prop() sourceCounts!: SourceCounts;
@Prop() lang!: string;
@Prop() index!: number;

loading = true;
chartIdx = 0;
Expand Down
15 changes: 14 additions & 1 deletion src/components/map-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@

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

<div class="flex items-center w-full text-left mt-2">
<label class="editor-label text-label" for="rampMapCaption">
{{ $t('editor.image.label.caption') }}:</label
>
<input
id="rampMapCaption"
class="editor-input w-2/5"
type="text"
v-model="panel.caption"
:placeholder="$t('editor.caption.placeholder')"
/>
</div>

<div class="ramp-editor mt-5" ref="editor" style="width: 70vw; height: 80vh"></div>
</div>
<vue-final-modal
Expand All @@ -44,7 +57,7 @@
:disabled="timeSliderError"
@click="saveTimeSlider"
>
Done
{{ $t('editor.done') }}
</button>
</div>
</vue-final-modal>
Expand Down
3 changes: 3 additions & 0 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export interface MapPanel extends BasePanel {
title: string;
scrollguard: boolean;
customStyles?: string;
caption?: string;
}
export interface TimeSliderConfig {
range: number[];
Expand Down Expand Up @@ -252,6 +253,7 @@ export interface ChartPanel extends BasePanel {
name?: string;
options?: DQVOptions;
customStyles?: string;
caption?: string;
}

export interface ChartConfig {
Expand All @@ -260,6 +262,7 @@ export interface ChartConfig {
config?: any;
name?: string;
options?: DQVOptions;
caption?: string;
}

export interface ImageFile {
Expand Down
1 change: 1 addition & 0 deletions src/lang/lang.csv
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ editor.next,Next,1,Suivant,1
editor.preview,Preview,1,Afficher l’aperçu,1
editor.confirm,Confirm,1,Confirmer,1
editor.cancel,Cancel,1,Annuler,1
editor.caption.placeholder,Add a caption,1,Ajouter une légende,0
editor.unsavedChanges,Unsaved changes,1,Modifications non enregistrées,1
editor.saveChanges,Save changes,1,Enregistrer les modifications,1
editor.discardChanges,Discard changes,1,Annuler les modifications,0
Expand Down
Loading