Skip to content

Commit e3a20ff

Browse files
committed
Add current section element in quick_navigation
1 parent ab666e2 commit e3a20ff

File tree

10 files changed

+65
-74
lines changed

10 files changed

+65
-74
lines changed

assets/scss/_custom.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@
3333
font-style: normal;
3434
}
3535

36+
.highlight-potential-sm {
37+
border: rgba(255, 255, 255, 0) 0.3rem solid;
38+
border-radius: 0.75rem;
39+
padding: 0.25rem 0.5rem !important;
40+
color: #005aa7;
41+
font-style: normal;
42+
}
43+
.highlight-red-sm {
44+
background-color: rgba(255, 203, 189, 0.5);
45+
}
46+
3647
.yellow-button {
3748
margin-left: 20px;
3849
background-color: #005aa7;

assets/scss/templates/_main.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ a.post-title {
448448
padding-left: 20px;
449449
position: relative;
450450

451-
&:not(.ms-slider__word)::before {
451+
&:not(.ms-slider__word):not(.quick_navigation_li)::before {
452452
position: absolute;
453453
content: '';
454454
height: 8px;
@@ -698,7 +698,7 @@ vertical-align: top;
698698
padding-top: 5px;
699699
}
700700

701-
.content ul li:not(.ms-slider__word):before{
701+
.content ul li:not(.ms-slider__word):not(.quick_navigation_li):before{
702702
height: 0px;
703703
width: 0px;
704704
}

content/english/algoprudence/submit-a-case.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ subtitle: >
88
image: /images/svg-illustrations/case_repository.svg
99
form1:
1010
title: Case information
11-
content: ''
11+
content: ""
1212
button_text: Submit
13-
backend_link: 'https://formspree.io/f/xzbnrlan'
13+
backend_link: "https://formspree.io/f/xzbnrlan"
1414
id: submit-a-case
1515
questions:
1616
- label: |
@@ -61,9 +61,9 @@ form1:
6161
type: checkbox
6262
form2:
6363
title: Case information
64-
content: ''
65-
button_text: 'Submit '
66-
backend_link: 'https://formspree.io/f/xleqlakw'
64+
content: ""
65+
button_text: "Submit "
66+
backend_link: "https://formspree.io/f/xleqlakw"
6767
id: case-for-repository
6868
questions:
6969
- label: Name organisation
@@ -88,7 +88,7 @@ form2:
8888
file_upload_text: Choose file
8989
file_type: .pdf
9090
type: file
91-
placeholder: ''
91+
placeholder: ""
9292
- label: >
9393
Terms and conditions <br> <span style="font-size:12px;
9494
color=#777;">Submitted data will only be processed for the purpose
@@ -103,7 +103,7 @@ reports_preview:
103103
button_text: Case repository
104104
button_link: /algoprudence
105105
feature_item:
106-
- name: 'Risk Profiling Social Welfare Re-examination '
106+
- name: "Risk Profiling Social Welfare Re-examination "
107107
image: /images/algoprudence/AA202302/AA202302A_cover_EN.png
108108
link: >-
109109
/algoprudence/cases/aa202302_risk-profiling-for-social-welfare-reexamination/
@@ -122,11 +122,11 @@ quick_navigation:
122122
title: Content overview
123123
links:
124124
- title: Submit a case
125-
url: '#case-for-review'
125+
url: "#case-for-review_tab_btn"
126126
- title: Next steps
127-
url: '#next-steps'
127+
url: "#next-steps"
128128
- title: Recent cases
129-
url: '#case-repository'
129+
url: "#case-repository"
130130
---
131131

132132
{{< tab_header width="6" tab1_id="case-for-review" default_tab="case-for-review" tab1_title="Submit a case for normative review" tab2_id="case-repository" tab2_title="Add a case to algoprudence repository" >}}
@@ -155,4 +155,4 @@ Your submission is reviewed by Team Algoprudence. The team assesses whether de c
155155

156156
{{< container_close >}}
157157

158-
{{< reports_preview id="case-repository">}}
158+
{{< reports_preview id="case-repository">}}

content/nederlands/algoprudence/submit-a-case.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ image: /images/svg-illustrations/case_repository.svg
99
form1:
1010
title: Informatie over de case
1111
button_text: Verstuur
12-
backend_link: 'https://formspree.io/f/xzbnrlan'
12+
backend_link: "https://formspree.io/f/xzbnrlan"
1313
id: submit-a-case
1414
questions:
1515
- label: |
@@ -58,9 +58,9 @@ form1:
5858
type: checkbox
5959
form2:
6060
title: Informatie over het oordeel
61-
content: ''
61+
content: ""
6262
button_text: Verstuur
63-
backend_link: 'https://formspree.io/f/xleqlakw'
63+
backend_link: "https://formspree.io/f/xleqlakw"
6464
id: case-for-repository
6565
questions:
6666
- label: Naam organisatie
@@ -115,11 +115,11 @@ quick_navigation:
115115
title: Inhoudsopgave
116116
links:
117117
- title: Dien een case in
118-
url: '#case-for-review'
118+
url: "#case-for-review_tab_btn"
119119
- title: Vervolgstappen
120-
url: '#next-steps'
120+
url: "#next-steps"
121121
- title: Recente cases
122-
url: '#case-repository'
122+
url: "#case-repository"
123123
---
124124

125125
{{< tab_header width="6" tab1_id="case-for-review" default_tab="case-for-review" tab1_title="Dien een case in voor beoordeling" tab2_id="case-repository" tab2_title="Voeg oordeel toe aan algoprudentie uitspraken" >}}

layouts/partials/head.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
<!-- page header script -->
5656
<script src="/js/main.js"></script>
57+
<script src="/js/quicknavigation.js"></script>
5758
<!-- /page header script -->
5859

5960
<!-- accordion -->

layouts/section/sublandingpage.html

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,17 @@
1212
<h3>{{.Params.quick_navigation.title}}</h3>
1313
<ul>
1414
{{ range .Params.quick_navigation.links }}
15-
<li>
16-
<a href='{{.url}}'>
15+
<li class="quick_navigation_li d-flex align-items-center mb-0">
16+
<a href='{{.url}}' class="highlight-potential-sm d-inline-block ml-3">
1717
{{.title}}
1818
</a>
19-
{{ if .links }}
20-
<ul>
21-
{{ range .links }}
22-
<li>
23-
<a href='{{.url}}'>
24-
{{.title}}
25-
</a>
26-
</li>
27-
{{ end }}
28-
29-
</ul>
30-
{{ end }}
3119
</li>
3220
{{ end }}
3321
</ul>
3422
</div>
3523
</div>
3624
</div>
25+
3726
<div class="col-lg-8 col-12 mx-auto">
3827
<div class="content">{{ .Content }}</div>
3928
</div>

static/js/quicknavigation.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
docReady(function () {
2+
const setActiveSideNavigation = function () {
3+
// Highlight the active link in the quick navigation depending on the scroll position
4+
var quickLinks = $(".quicklinks-mobile-sticky-top ul li a");
5+
var sections = quickLinks.map(function () {
6+
return $(this).attr("href");
7+
});
8+
var sectionOffsets = sections.map(function (index, section) {
9+
return $(section).offset().top - 300; // Adjust offset as needed
10+
});
11+
let highestActiveIndex = -1;
12+
var scrollPos = $(this).scrollTop();
13+
quickLinks.each(function () {
14+
$(this).removeClass("highlight-red-sm");
15+
});
16+
sectionOffsets.each(function (index) {
17+
if (scrollPos >= this) {
18+
highestActiveIndex = index;
19+
}
20+
});
21+
if (highestActiveIndex >= 0) {
22+
quickLinks.eq(highestActiveIndex).addClass("highlight-red-sm");
23+
}
24+
};
25+
$(window).on("scroll", setActiveSideNavigation);
26+
setActiveSideNavigation();
27+
});

themes/bigspring-light/layouts/_default/single.html

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,17 @@ <h2 class="mb-4" style="color: #005aa7;">{{ .Title }}</h2>
3737
<h3>{{.Params.quick_navigation.title}}</h3>
3838
<ul>
3939
{{ range .Params.quick_navigation.links }}
40-
<li>
41-
<a href='{{.url}}'>
40+
<li class="quick_navigation_li d-flex align-items-center mb-0">
41+
<a href='{{.url}}' class="highlight-potential-sm d-inline-block ml-3">
4242
{{.title}}
4343
</a>
44-
{{ if .links }}
45-
<ul>
46-
{{ range .links }}
47-
<li>
48-
<a href='{{.url}}'>
49-
{{.title}}
50-
</a>
51-
</li>
52-
{{ end }}
53-
54-
</ul>
55-
{{ end }}
5644
</li>
5745
{{ end }}
5846
</ul>
5947
</div>
6048
</div>
6149
</div>
50+
6251
<div class="col-lg-8 col-12 mx-auto">
6352
<div class="content">{{ .Content }}</div>
6453
</div>

tina/collections/shared/page/quick_navigation.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,6 @@ const quick_navigation: TinaField = {
3535
required: true,
3636
},
3737
url,
38-
{
39-
type: "object",
40-
name: "links",
41-
label: "Links",
42-
required: false,
43-
list: true,
44-
ui: {
45-
itemProps: (item) => {
46-
return { label: item?.title };
47-
},
48-
},
49-
fields: [
50-
{
51-
type: "string",
52-
name: "title",
53-
label: "Title",
54-
required: true,
55-
},
56-
{
57-
type: "string",
58-
name: "url",
59-
label: "Url",
60-
required: true,
61-
},
62-
],
63-
},
6438
],
6539
},
6640
],

tina/tina-lock.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)