Skip to content

Commit 0d13efc

Browse files
committed
feat: Add modals for FIP 50 ticket and FIP coupon
1 parent eb7392a commit 0d13efc

File tree

8 files changed

+261
-0
lines changed

8 files changed

+261
-0
lines changed

content/operator/sncf/index.de.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ country:
1212
operator: "sncf"
1313
Params:
1414
fip_coupon: true
15+
fip_coupon_fields:
16+
oebb: 4
17+
renfe: 2
1518
fip_coupon_relatives:
1619
oebb: true
1720
renfe: false
1821
fip_50_ticket: true
22+
fip_50_ticket_discount:
23+
oebb: 25
24+
renfe: 75
1925
fip_global_fare: true
2026
---
2127

content/operator/sncf/index.en.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ country:
1212
operator: "sncf"
1313
Params:
1414
fip_coupon: true
15+
fip_coupon_fields:
16+
oebb: 4
17+
renfe: 2
1518
fip_coupon_relatives:
1619
oebb: true
1720
renfe: false
1821
fip_50_ticket: true
22+
fip_50_ticket_discount:
23+
oebb: 25
24+
renfe: 75
1925
fip_global_fare: true
2026
---
2127

content/operator/sncf/index.fr.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ country:
1212
operator: "sncf"
1313
Params:
1414
fip_coupon: true
15+
fip_coupon_fields:
16+
oebb: 4
17+
renfe: 2
1518
fip_coupon_relatives:
1619
oebb: true
1720
renfe: false
1821
fip_50_ticket: true
22+
fip_50_ticket_discount:
23+
oebb: 25
24+
renfe: 75
1925
fip_global_fare: true
2026
---
2127

i18n/de.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,19 @@ discord: FIP Guide Community
2929
editPage: Seite bearbeiten
3030
fipValidity:
3131
close-modal: Schließen
32+
discount: Rabatt
33+
fields: Felder
3234
fip-50-ticket: FIP 50 Ticket
35+
fip-50-ticket-discount-modal-description: >-
36+
Der Rabatt auf den regulären Fahrpreis für FIP 50 Tickets hängt von der
37+
Bahngesellschaft ab, die deinen FIP Ausweis ausgestellt hat.
38+
fip-50-ticket-discount-modal-title: FIP 50 Ticket Rabatt nach Betreiber
3339
fip-coupon: FIP Freifahrtschein
40+
fip-coupon-fields-modal-description: >-
41+
Die maximale Anzahl der Felder auf dem FIP Freifahrtschein hängt von der
42+
Bahngesellschaft ab, die deinen FIP Ausweis ausgestellt hat.
43+
fip-coupon-fields-modal-title: FIP Freifahrtschein Felder nach Betreiber
44+
fip-coupon-fields-value: '%d Felder'
3445
fip-coupon-relatives: FIP Freifahrt Angehörige
3546
fip-global-fare: FIP Globalpreis
3647
issuer: Aussteller des FIP Ausweises
@@ -39,6 +50,8 @@ fipValidity:
3950
Die Verfügbarkeit von FIP Freifahrt Angehörige hängt von der
4051
Bahngesellschaft ab, die deinen FIP Ausweis ausgestellt hat.
4152
relatives-modal-title: FIP Freifahrt Angehörige nach Betreiber
53+
show-50-ticket-discount-info: Informationen zu FIP 50 Ticket Rabatten anzeigen
54+
show-coupon-fields-info: Informationen zu FIP Freifahrtschein Feldern anzeigen
4255
show-relatives-info: Informationen zu FIP Freifahrt Angehörige anzeigen
4356
status-no: Nicht akzeptiert
4457
status-unknown: Unbekannt

i18n/en.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,19 @@ discord: FIP Guide Community
2828
editPage: Edit page
2929
fipValidity:
3030
close-modal: Close
31+
discount: Discount
32+
fields: Fields
3133
fip-50-ticket: FIP 50 Ticket
34+
fip-50-ticket-discount-modal-description: >-
35+
The discount on the regular fare for FIP 50 Tickets depends on the railway
36+
company that issued your FIP card.
37+
fip-50-ticket-discount-modal-title: FIP 50 Ticket Discount by Operator
3238
fip-coupon: FIP Coupon
39+
fip-coupon-fields-modal-description: >-
40+
The maximum number of fields on the FIP Coupon depends on the railway
41+
company that issued your FIP card.
42+
fip-coupon-fields-modal-title: FIP Coupon Fields by Operator
43+
fip-coupon-fields-value: '%d fields'
3344
fip-coupon-relatives: FIP Coupon for relatives
3445
fip-global-fare: FIP Global Fare
3546
issuer: Issuer of the FIP card
@@ -38,6 +49,8 @@ fipValidity:
3849
The availability of FIP Coupon for relatives depends on the railway company
3950
that issued your FIP card.
4051
relatives-modal-title: FIP Coupon for relatives by Operator
52+
show-50-ticket-discount-info: Show information about FIP 50 Ticket discounts
53+
show-coupon-fields-info: Show information about FIP Coupon fields
4154
show-relatives-info: Show information about FIP Coupon for relatives
4255
status-no: Not accepted
4356
status-unknown: Unknown

i18n/fr.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,19 @@ discord: Communauté FIP Guide
2929
editPage: Modifier la page
3030
fipValidity:
3131
close-modal: Fermer
32+
discount: Réduction
33+
fields: Champs
3234
fip-50-ticket: Billet FIP 50
35+
fip-50-ticket-discount-modal-description: >-
36+
La réduction sur le tarif régulier pour les Billets FIP 50 dépend de la
37+
compagnie ferroviaire qui a émis votre carte FIP.
38+
fip-50-ticket-discount-modal-title: Réduction Billet FIP 50 par opérateur
3339
fip-coupon: Coupon FIP
40+
fip-coupon-fields-modal-description: >-
41+
Le nombre maximum de champs sur le Coupon FIP dépend de la compagnie
42+
ferroviaire qui a émis votre carte FIP.
43+
fip-coupon-fields-modal-title: Champs du Coupon FIP par opérateur
44+
fip-coupon-fields-value: '%d champs'
3445
fip-coupon-relatives: Coupon FIP accompagnant
3546
fip-global-fare: Tarif Global FIP
3647
issuer: Émetteur de la carte FIP
@@ -39,6 +50,8 @@ fipValidity:
3950
La disponibilité du Coupon FIP accompagnant dépend de la compagnie
4051
ferroviaire qui a émis votre carte FIP.
4152
relatives-modal-title: Coupon FIP accompagnant par opérateur
53+
show-50-ticket-discount-info: Afficher les informations sur les réductions Billet FIP 50
54+
show-coupon-fields-info: Afficher les informations sur les champs du Coupon FIP
4255
show-relatives-info: Afficher les informations sur le Coupon FIP accompagnant
4356
status-no: Non accepté
4457
status-unknown: Inconnu

layouts/partials/fip-validity-item.html

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
<div class="a-fip-validity-item__content">
44
<span class="a-fip-validity-item__text">
55
{{ i18n .Text }}
6+
{{- if .ShowCouponFieldsInfo -}}
7+
<button
8+
class="a-fip-validity-item__info-button"
9+
aria-label="{{ i18n "fipValidity.show-coupon-fields-info" }}"
10+
data-modal-trigger="fip-coupon-fields-modal"
11+
>
12+
{{ partial "icon" "info" }}
13+
</button>
14+
{{- end -}}
15+
{{- if .Show50TicketDiscountInfo -}}
16+
<button
17+
class="a-fip-validity-item__info-button"
18+
aria-label="{{ i18n "fipValidity.show-50-ticket-discount-info" }}"
19+
data-modal-trigger="fip-50-ticket-discount-modal"
20+
>
21+
{{ partial "icon" "info" }}
22+
</button>
23+
{{- end -}}
624
{{- if .ShowRelativesInfo -}}
725
<button
826
class="a-fip-validity-item__info-button"
@@ -19,6 +37,188 @@
1937
</div>
2038
</div>
2139

40+
{{- if .ShowCouponFieldsInfo -}}
41+
<div class="o-modal" id="fip-coupon-fields-modal" aria-hidden="true">
42+
<div class="o-modal__overlay" data-modal-close></div>
43+
<div class="o-modal__container" role="dialog" aria-modal="true">
44+
<div class="o-modal__header">
45+
<h2 class="o-modal__title">
46+
{{ i18n "fipValidity.fip-coupon-fields-modal-title" }}
47+
</h2>
48+
<button
49+
class="o-modal__close"
50+
data-modal-close
51+
aria-label="{{ i18n "fipValidity.close-modal" }}"
52+
>
53+
{{ partial "icon" "close" }}
54+
</button>
55+
</div>
56+
<div class="o-modal__content">
57+
<p class="o-modal__description">
58+
{{ i18n "fipValidity.fip-coupon-fields-modal-description" }}
59+
</p>
60+
<table class="o-modal__table">
61+
<thead>
62+
<tr>
63+
<th>{{ i18n "fipValidity.issuer" }}</th>
64+
<th>{{ i18n "fipValidity.fields" }}</th>
65+
</tr>
66+
</thead>
67+
</table>
68+
<div class="o-modal__table-wrapper">
69+
<table class="o-modal__table o-modal__table--body">
70+
<colgroup>
71+
<col style="width: 50%" />
72+
<col style="width: 50%" />
73+
</colgroup>
74+
<tbody>
75+
{{- $currentPage := .Page -}}
76+
{{- $currentOperatorDir := $currentPage.File.Dir -}}
77+
{{- $seenOperators := slice -}}
78+
79+
{{- $currentFieldsParam := $currentPage.Params.fip_coupon_fields -}}
80+
{{- $fieldsMap := dict -}}
81+
82+
{{- if reflect.IsMap $currentFieldsParam -}}
83+
{{- $fieldsMap = $currentFieldsParam -}}
84+
{{- end -}}
85+
86+
{{- range where .Page.Site.Pages "Section" "operator" -}}
87+
{{- if and (eq .Lang $currentPage.Lang) (ne .File.LogicalName "_index.de.md") (ne .File.LogicalName "_index.en.md") (ne .File.LogicalName "_index.fr.md") -}}
88+
{{- $operatorId := .File.Dir -}}
89+
{{- if and (not (in $seenOperators $operatorId)) (ne $operatorId $currentOperatorDir) -}}
90+
{{- $seenOperators = $seenOperators | append $operatorId -}}
91+
{{- $operatorIdClean := trim $operatorId "/" -}}
92+
{{- $operatorName := path.Base $operatorIdClean -}}
93+
94+
{{- $fields := "" -}}
95+
{{- $hasValue := false -}}
96+
{{- $status := "unknown" -}}
97+
{{- $icon := "help" -}}
98+
99+
{{- range $key, $value := $fieldsMap -}}
100+
{{- if eq $key $operatorName -}}
101+
{{- $fields = $value -}}
102+
{{- $hasValue = true -}}
103+
{{- $status = "yes" -}}
104+
{{- $icon = "check_circle" -}}
105+
{{- end -}}
106+
{{- end -}}
107+
108+
109+
<tr>
110+
<td><a href="{{ .RelPermalink }}">{{ .Title }}</a></td>
111+
<td
112+
class="o-modal__status o-modal__status--{{ $status }}"
113+
>
114+
{{ partial "icon" $icon }}
115+
<span>
116+
{{- if $hasValue -}}
117+
{{ printf (i18n "fipValidity.fip-coupon-fields-value") $fields }}
118+
{{- else -}}
119+
{{ i18n "fipValidity.status-unknown" }}
120+
{{- end -}}
121+
</span>
122+
</td>
123+
</tr>
124+
{{- end -}}
125+
{{- end -}}
126+
{{- end -}}
127+
</tbody>
128+
</table>
129+
</div>
130+
</div>
131+
</div>
132+
</div>
133+
{{- end -}}
134+
135+
{{- if .Show50TicketDiscountInfo -}}
136+
<div class="o-modal" id="fip-50-ticket-discount-modal" aria-hidden="true">
137+
<div class="o-modal__overlay" data-modal-close></div>
138+
<div class="o-modal__container" role="dialog" aria-modal="true">
139+
<div class="o-modal__header">
140+
<h2 class="o-modal__title">
141+
{{ i18n "fipValidity.fip-50-ticket-discount-modal-title" }}
142+
</h2>
143+
<button
144+
class="o-modal__close"
145+
data-modal-close
146+
aria-label="{{ i18n "fipValidity.close-modal" }}"
147+
>
148+
{{ partial "icon" "close" }}
149+
</button>
150+
</div>
151+
<div class="o-modal__content">
152+
<p class="o-modal__description">
153+
{{ i18n "fipValidity.fip-50-ticket-discount-modal-description" }}
154+
</p>
155+
<table class="o-modal__table">
156+
<thead>
157+
<tr>
158+
<th>{{ i18n "fipValidity.issuer" }}</th>
159+
<th>{{ i18n "fipValidity.discount" }}</th>
160+
</tr>
161+
</thead>
162+
</table>
163+
<div class="o-modal__table-wrapper">
164+
<table class="o-modal__table o-modal__table--body">
165+
<colgroup>
166+
<col style="width: 50%" />
167+
<col style="width: 50%" />
168+
</colgroup>
169+
<tbody>
170+
{{- $currentPage := .Page -}}
171+
{{- $currentOperatorDir := $currentPage.File.Dir -}}
172+
{{- $seenOperators := slice -}}
173+
174+
{{- $currentDiscountParam := $currentPage.Params.fip_50_ticket_discount -}}
175+
{{- $discountMap := dict -}}
176+
177+
{{- if reflect.IsMap $currentDiscountParam -}}
178+
{{- $discountMap = $currentDiscountParam -}}
179+
{{- end -}}
180+
181+
{{- range where .Page.Site.Pages "Section" "operator" -}}
182+
{{- if and (eq .Lang $currentPage.Lang) (ne .File.LogicalName "_index.de.md") (ne .File.LogicalName "_index.en.md") (ne .File.LogicalName "_index.fr.md") -}}
183+
{{- $operatorId := .File.Dir -}}
184+
{{- if and (not (in $seenOperators $operatorId)) (ne $operatorId $currentOperatorDir) -}}
185+
{{- $seenOperators = $seenOperators | append $operatorId -}}
186+
{{- $operatorIdClean := trim $operatorId "/" -}}
187+
{{- $operatorName := path.Base $operatorIdClean -}}
188+
189+
{{- $discount := 50 -}}
190+
{{- $hasValue := false -}}
191+
{{- $status := "yes" -}}
192+
{{- $icon := "check_circle" -}}
193+
194+
{{- range $key, $value := $discountMap -}}
195+
{{- if eq $key $operatorName -}}
196+
{{- $discount = $value -}}
197+
{{- $hasValue = true -}}
198+
{{- end -}}
199+
{{- end -}}
200+
201+
202+
<tr>
203+
<td><a href="{{ .RelPermalink }}">{{ .Title }}</a></td>
204+
<td
205+
class="o-modal__status o-modal__status--{{ $status }}"
206+
>
207+
{{ partial "icon" $icon }}
208+
<span>{{ $discount }}%</span>
209+
</td>
210+
</tr>
211+
{{- end -}}
212+
{{- end -}}
213+
{{- end -}}
214+
</tbody>
215+
</table>
216+
</div>
217+
</div>
218+
</div>
219+
</div>
220+
{{- end -}}
221+
22222
{{- if .ShowRelativesInfo -}}
23223
<div class="o-modal" id="fip-relatives-modal" aria-hidden="true">
24224
<div class="o-modal__overlay" data-modal-close></div>

layouts/shortcodes/fip-validity.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"Text" "fipValidity.fip-coupon"
1616
"Type" (cond $accepted "success" "error")
1717
"Note" $note
18+
"ShowCouponFieldsInfo" (isset $page.Params "fip_coupon_fields")
19+
"Page" $page
1820
)
1921
}}
2022
{{- end -}}
@@ -50,6 +52,8 @@
5052
"Text" "fipValidity.fip-50-ticket"
5153
"Type" (cond $accepted "success" "error")
5254
"Note" $note
55+
"Show50TicketDiscountInfo" $accepted
56+
"Page" $page
5357
)
5458
}}
5559
{{- end -}}

0 commit comments

Comments
 (0)