Skip to content

Commit d8a1fc1

Browse files
committed
merge quick access menu from the staging site
1 parent 6d8ed4a commit d8a1fc1

File tree

3 files changed

+49
-12
lines changed

3 files changed

+49
-12
lines changed

_layouts/default.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<body>
3838
<div id='wrapper'>
3939
<div class="fillG cell11" id="banner-top">
40-
<div class="dropdown marginL"> <a> {{site.translations.[page.lang].language}} ... </a>
40+
<div class="dropdown language-switcher marginL"> <a> {{site.translations.[page.lang].language}} ... </a>
4141
<div class='language-switcher dropdown-content'>
4242
{% assign start_page = "/" | append: page.lang | append: "/" | strip %}
4343
{% assign this_page = page.permalink | strip %}
@@ -72,6 +72,29 @@
7272
{% endif %}
7373
</div>
7474
</div>
75+
<div class="dropdown quick-access"> <a> {{site.translations.[page.lang].quickaccess}} </a>
76+
<div class='quick-access dropdown-content'>
77+
<!-- find out whether the remote-tracing guide exists in the current language; otherwise we will use English -->
78+
{% assign remote_tracing = "/" | append: page.lang | append: "/coordination/remote-tracing/" %}
79+
{% assign found = "0" %}
80+
{% for post in site.categories['coordination'] %}
81+
{% if post.permalink == remote_tracing %}
82+
{% assign found = "1" %}
83+
{% break %}
84+
{% endif %}
85+
{% endfor %}
86+
{% if found == "1" %}
87+
{% assign use_lang = page.lang %}
88+
{% else %}
89+
{% assign use_lang = "en" %}
90+
{% endif %}
91+
<!-- now build the menu proper -->
92+
{% assign remote_tracing = "/" | append: use_lang | append: "/coordination/remote-tracing" %}
93+
<a href="{{remote_tracing}}/#highways-howto">Highways - How to map</a><br>
94+
<a href="{{remote_tracing}}/#residential-howto">landuse=residential - How to map</a><br>
95+
<a href="{{remote_tracing}}/#buildings-howto">Buildings - How to map</a><br>
96+
</div>
97+
</div>
7598
<!-- small search bar does not appear on the front page -->
7699
{% unless page.fronttitle or page.contributetitle%}
77100
<form class='searchbox-default rounded'>

site.js

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,35 @@
22
---
33
$(function() {
44
var app = window.app;
5-
$('.dropdown').hover(
5+
$('.dropdown.language-switcher').hover(
66
function() {
7-
$('.dropdown-content').addClass('active');
7+
$('.dropdown-content.language-switcher').addClass('active');
88
},
99
function() {
10-
$('.dropdown-content').removeClass('active');
10+
$('.dropdown-content.language-switcher').removeClass('active');
1111
}
1212
);
13+
$('.dropdown.quick-access').hover(
14+
function() {
15+
$('.dropdown-content.quick-access').addClass('active');
16+
},
17+
function() {
18+
$('.dropdown-content.quick-access').removeClass('active');
19+
}
20+
);
21+
$('.dropdown.language-switcher > a').on('touchstart', function(e) {
22+
e.preventDefault();
23+
$('.dropdown-content.language-switcher').toggleClass('active');
24+
});
25+
$('.dropdown.quick-access > a').on('touchstart', function(e) {
26+
e.preventDefault();
27+
$('.dropdown-content.quick-access').toggleClass('active');
28+
});
1329
$('.language-switcher a').each(function(i, e) {
1430
if (app.permalink.length < 3) return;
1531
var remainder = app.permalink.match(/(\/[^\/]+)(\/.*)/)[2];
16-
$(e).attr('href',
17-
app.baseurl + '/' +
18-
$(e).attr('lang') +
19-
remainder
20-
);
32+
var new_url = app.baseurl + '/' + $(e).attr('lang') + remainder;
33+
$(e).attr('href', new_url);
2134
});
2235
$('.language-switcher a[lang=' + app.lang + ']').addClass('active');
2336
// contribute banner pops out when hovered over

style.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,22 @@ body {
259259
left:0;
260260
}
261261
.dropdown {
262+
padding:6px 20px;
262263
position:relative;
263264
display:inline-block;
264265
}
265266
.dropdown-content {
266267
display:none;
267268
}
268269
.dropdown-content.active {
270+
padding:6px 20px;
269271
display:block;
270272
position:absolute;
271273
background-color:#f0f0f0;
272274
z-index:1;
273275
}
274-
.language-switcher {
275-
padding:6px 20px;
276-
}
276+
.dropdown-content.language-switcher { width: 20ch; }
277+
.dropdown-content.quick-access { width: 35ch; }
277278
.language-switcher a.active {
278279
color: #79bc5f;
279280
text-decoration: none;

0 commit comments

Comments
 (0)