Skip to content

Commit 6955c38

Browse files
committed
feat: Overwrite individual classes in booking expander
1 parent 0a90a56 commit 6955c38

File tree

5 files changed

+61
-53
lines changed

5 files changed

+61
-53
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,9 @@ To add a new operator:
7878
```zsh
7979
hugo new operator/${OPERATOR} # Replace ${OPERATOR} with the English operator name in lowercase
8080
```
81+
82+
To add a new booking platform:
83+
84+
```zsh
85+
hugo new booking/${PLATFORM} # Replace ${PLATFORM} with the name of the booking platform
86+
```

archetypes/operator/index.de.md

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -84,38 +84,35 @@ FIP Globalpreis: <✅/⛔>
8484

8585
### Online
8686

87-
- [Website des Buchungsanbieters](https://example.com): \
88-
**Reservierung:** <✅/⛔> \
89-
**FIP 50 Fahrkarten:** <✅/⛔>
90-
<!-- Optionale Buchungshinweise, wie kann man FIP Tickets oder Reservierungen kaufen? -->
91-
- [Website eines weiteren Buchungsanbieters](https://example.com): \
92-
**Reservierung:** <✅/⛔> \
93-
**FIP 50 Fahrkarten:** <✅/⛔>
94-
<!-- Optionale Buchungshinweise, wie kann man FIP Tickets oder Reservierungen kaufen? -->
95-
- Weitere Möglichkeiten:
96-
<!-- Sonstige Hinweise und weitere Seiten für die Onlinebuchung/-reservierung. -->
87+
<!--
88+
Bette hier Buchungsplattformen mit Onlinebuchung ein.
89+
90+
Individuelle Buchungsparameter können überschrieben werden, aber müssen nicht überschrieben werden.
91+
Wenn sie nicht übergeben werden, dann werden die definieren defaults der Seite der Buchungsplattform verwendet.
92+
93+
Mehr Informationen sind im booking archetype zu finden.
94+
-->
95+
{{% booking id="booking_id"
96+
subtitle="This subtitle is displayed in the summary of the expander and should not take too much space."
97+
info="This is an information text that can contain country specific information and is displayed in the expanded part."
98+
reservations=nil
99+
fip_50=false
100+
fip_global_fare=true
101+
classes.first="€20"
102+
classes.second="€10"
103+
%}}
97104

98105
### Telefon
99106

100-
- Name des Buchungsanbieters: \
101-
Telefonnummer: <Telefonnummer einfügen> \
102-
**Reservierung:** <✅/⛔> \
103-
**FIP 50 Fahrkarten:** <✅/⛔>
104-
<!-- Weitere Hinweise zur Buchung am Telefon> -->
105-
- Name eines weiteren Betreibers: \
106-
Telefonnummer: <Telefonnummer einfügen> \
107-
**Reservierung:** <✅/⛔> \
108-
**FIP 50 Fahrkarten:** <✅/⛔>
109-
<!-- Weitere Hinweise zur Buchung am Telefon> -->
107+
<!--
108+
Füge hier weitere Buchungsplattformen mit Buchung per Telefon hinzu.
109+
-->
110110

111111
### Vor Ort
112112

113-
- Schalter der <Bahngesellschaft>: \
114-
**Reservierung:**\
115-
**FIP 50 Fahrkarten:**
116-
<!-- Wo gibt es Ticketschalter allgemein? Wenn möglich, ergänze ein Link zu einer Übersicht. Ergänze zusätzliche Informationen zum Kauf am Schalter. -->
117-
- Weitere Möglichkeiten:
118-
<!-- Können die Tickets auch z.B. an anderen Schaltern im Ausland gekauft werden, wenn ja wo? -->
113+
<!--
114+
Füge hier weitere Buchungsplattformen mit Buchung vor Ort hinzu.
115+
-->
119116

120117
### Im Zug
121118

archetypes/operator/index.en.md

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -84,38 +84,35 @@ FIP Global Fare: <✅/⛔>
8484

8585
### Online
8686

87-
- [Booking page](<Link to the website>): \
88-
**Reservation:** <✅/⛔> \
89-
**FIP 50 Tickets:** <✅/⛔>
90-
<!-- Optional booking notes, how can FIP tickets or reservations be purchased? -->
91-
- [Another booking page](<Link to the website>): \
92-
**Reservation:** <✅/⛔> \
93-
**FIP 50 Tickets:** <✅/⛔>
94-
<!-- Optional booking notes, how can FIP tickets or reservations be purchased? -->
95-
- Other options:
96-
<!-- Other notes and additional websites for online booking/reservation. -->
87+
<!--
88+
Embed the information of a defined booking platform here.
89+
90+
You can overwrite individual booking parameters as listed below, but you don't have to.
91+
If you leave some parameters out, the defined defaults of the booking platform will be used.
92+
93+
For more information how to define a booking platform, check the booking archetype.
94+
-->
95+
{{% booking id="booking_id"
96+
subtitle="This subtitle is displayed in the summary of the expander and should not take too much space."
97+
info="This is an information text that can contain country specific information and is displayed in the expanded part."
98+
reservations=nil
99+
fip_50=false
100+
fip_global_fare=true
101+
classes.first="€20"
102+
classes.second="€10"
103+
%}}
97104

98105
### Telephone
99106

100-
- Name of the booking provider: \
101-
Phone number: <Phone number> \
102-
**Reservation:** <✅/⛔> \
103-
**FIP 50 Tickets:** <✅/⛔>
104-
<!-- Additional notes for booking by phone -->
105-
- Name of another booking provider: \
106-
Phone number: <Phone number> \
107-
**Reservation:** <✅/⛔> \
108-
**FIP 50 Tickets:** <✅/⛔>
109-
<!-- Additional notes for booking by phone -->
107+
<!--
108+
Embed additional booking platforms with booking via telephone here.
109+
-->
110110

111111
### On Site
112112

113-
- Ticket counter of <Railway Company>: \
114-
**Reservation:**\
115-
**FIP 50 Tickets:**
116-
<!-- Where are ticket counters generally located? If possible,add a to an overview. Add additional information about purchasing at the counter. -->
117-
- Other options:
118-
<!-- Can tickets also be purchased at other counters abroad, if so where? -->
113+
<!--
114+
Embed additional booking platforms with booking on site here.
115+
-->
119116

120117
### On the Train
121118

layouts/partials/booking.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{{- if ne .fip_global_fare "nil" -}}<div>{{- T "booking.fip-global-fare" }} {{ if .fip_global_fare -}}✅{{- else -}}⛔{{- end -}}</div>{{- end -}}
1818
</div>
1919
<div class="o-booking__classes">
20-
{{- range $k, $v := .page.Params.classes -}}
20+
{{- range $k, $v := .classes -}}
2121
<div><strong>{{- T (print "booking.classes." $k) -}}:</strong> {{ $v -}}</div>
2222
{{- end -}}
2323
</div>

layouts/shortcodes/booking.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
{{- $page := site.GetPage (print "booking/" (.Get "id")) -}}
2+
{{- $classes := ($page.Params.classes | default dict) -}}
3+
{{- range $k, $v := .Params }}
4+
{{- if (hasPrefix $k "classes.") }}
5+
{{- $classKey := (replace $k "classes." "") -}}
6+
{{- $classes = (dict $classKey $v) | merge $classes -}}
7+
{{- end }}
8+
{{- end }}
29
{{- $params := dict
310
"page" $page
411
"subtitle" (.Get "subtitle")
512
"fip_50" ((.Get "fip_50" ) | default $page.Params.fip_50 | default "nil")
613
"fip_global_fare" ((.Get "fip_global_fare" ) | default $page.Params.fip_global_fare | default "nil")
714
"reservations" ((.Get "reservations" ) | default $page.Params.reservations | default "nil")
15+
"classes" $classes
816
"link" ((.Get "link" ) | default $page.Params.link | default "nil")
917
-}}
1018

0 commit comments

Comments
 (0)