Skip to content

Commit c97a28a

Browse files
MistryMistry
Mistry
authored and
Mistry
committed
Added option for horizontal table of contents
1 parent c43cd4b commit c97a28a

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

src/components/editor/helpers/metadata-content.vue

+18
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@
7171
<i> {{ $t('editor.contextLabel.info') }}</i>
7272
</p>
7373
<br />
74+
<label class="mr-15">{{ $t('editor.tocOrientation') }}:</label>
75+
<select
76+
class="border-solid border border-black p-1"
77+
name="tocOrientation"
78+
id="toc"
79+
@change="metadataChanged"
80+
v-model="metadata.tocOrientation"
81+
>
82+
<option value="vertical">{{ $t('editor.tocOrientation.vertical') }}</option>
83+
<option value="horizontal">{{ $t('editor.tocOrientation.horizontal') }}</option>
84+
</select>
85+
<br />
86+
<label class="mb-5"></label>
87+
<p class="inline-block">
88+
<i>{{ $t('editor.tocOrientation.info') }}</i>
89+
</p>
90+
<br />
7491
<label class="mb-5">{{ $t('editor.dateModified') }}:</label>
7592
<input type="date" name="dateModified" :value="metadata.dateModified" @change="metadataChanged" />
7693
<br /><br />
@@ -90,6 +107,7 @@ export default class MetadataEditorV extends Vue {
90107
logoAltText: string;
91108
contextLink: string;
92109
contextLabel: string;
110+
tocOrientation: string;
93111
dateModified: string;
94112
};
95113

src/components/editor/metadata-editor.vue

+16-2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export default class MetadataEditorV extends Vue {
244244
logoAltText: '',
245245
contextLink: '',
246246
contextLabel: '',
247+
tocOrientation: '',
247248
dateModified: ''
248249
};
249250
// add more required metadata fields to here as needed
@@ -272,6 +273,8 @@ export default class MetadataEditorV extends Vue {
272273
const month = (curDate.getMonth() + 1).toString().padStart(2, '0');
273274
const day = curDate.getDate().toString().padStart(2, '0');
274275
this.metadata.dateModified = `${year}-${month}-${day}`;
276+
// set vertical as the default table of contents orientation
277+
this.metadata.tocOrientation = 'vertical';
275278
}
276279
277280
// Find which view to render based on route
@@ -379,6 +382,7 @@ export default class MetadataEditorV extends Vue {
379382
slides: [],
380383
contextLabel: this.metadata.contextLabel,
381384
contextLink: this.metadata.contextLink,
385+
tocOrientation: this.metadata.tocOrientation,
382386
dateModified: this.metadata.dateModified
383387
};
384388
}
@@ -555,6 +559,7 @@ export default class MetadataEditorV extends Vue {
555559
this.metadata.introSubtitle = config.introSlide.subtitle;
556560
this.metadata.contextLink = config.contextLink;
557561
this.metadata.contextLabel = config.contextLabel;
562+
this.metadata.tocOrientation = config.tocOrientation;
558563
this.metadata.dateModified = config.dateModified;
559564
560565
// Conversion for individual image panels to slideshow for gallery display
@@ -647,7 +652,14 @@ export default class MetadataEditorV extends Vue {
647652
}
648653
649654
updateMetadata(
650-
key: 'title' | 'introTitle' | 'introSubtitle' | 'contextLink' | 'contextLabel' | 'dateModified',
655+
key:
656+
| 'title'
657+
| 'introTitle'
658+
| 'introSubtitle'
659+
| 'contextLink'
660+
| 'contextLabel'
661+
| 'tocOrientation'
662+
| 'dateModified',
651663
value: string
652664
): void {
653665
this.metadata[key] = value;
@@ -667,6 +679,7 @@ export default class MetadataEditorV extends Vue {
667679
config.introSlide.subtitle = this.metadata.introSubtitle;
668680
config.contextLink = this.metadata.contextLink;
669681
config.contextLabel = this.metadata.contextLabel;
682+
config.tocOrientation = this.metadata.tocOrientation;
670683
config.dateModified = this.metadata.dateModified;
671684
672685
// If the logo section is missing, create it here before overwriting values.
@@ -710,7 +723,8 @@ export default class MetadataEditorV extends Vue {
710723
dateModified: '',
711724
logoPreview: '',
712725
logoName: '',
713-
logoAltText: ''
726+
logoAltText: '',
727+
tocOrientation: ''
714728
};
715729
this.configs = { en: undefined, fr: undefined };
716730
this.slides = [];

src/definitions.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface StoryRampConfig {
77
slides: Slide[];
88
contextLink: string;
99
contextLabel: string;
10+
tocOrientation: string;
1011
dateModified: string;
1112
}
1213

@@ -38,6 +39,7 @@ export interface MetadataContent {
3839
logoAltText: string;
3940
contextLink: string;
4041
contextLabel: string;
42+
tocOrientation: string;
4143
dateModified: string;
4244
}
4345

src/lang/lang.csv

+5-1
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,8 @@ editor.slides.select,Please select a slide to edit,1,Veuillez sélectionner une
111111
editor.slides.panel.body,Panel body,1,Corps du panneau,1
112112
editor.slides.panel.title,Panel title,1,Titre du panneau,1
113113
editor.slides.intro,Intro subtitle,1,Sous-titre de l’introduction,1
114-
editor.slides.title,Intro title,1,Titre de l’introduction,1
114+
editor.slides.title,Intro title,1,Titre de l’introduction,1
115+
editor.tocOrientation,Table of Contents Orientation,1,Orientation de la table des matières,0
116+
editor.tocOrientation.info,The table of contents orientation will be set to vertical in mobile view.,1,L'orientation de la table des matières sera définie sur verticale en vue mobile.,0
117+
editor.tocOrientation.vertical,Vertical,1,Vertical,0
118+
editor.tocOrientation.horizontal,Horizontal,1,Horizontal,0

0 commit comments

Comments
 (0)