Skip to content

Commit 021ece3

Browse files
author
Desmond
committed
update
1 parent 744c51e commit 021ece3

File tree

12 files changed

+1096
-49
lines changed

12 files changed

+1096
-49
lines changed

_data/docbar.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- introduction:
2+
name: Introduction
3+
- view:
4+
name: View
5+
key: view
6+
- security:
7+
name: Security
8+
key: security
9+
child:
10+
- csrf:
11+
name: CSRF Protection
12+
key: csrf
13+
- authentication:
14+
name: Authentication
15+
key: authentication
16+
- routing:
17+
name: Routing
18+
key: routing

_includes/docsbar.html

+38-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
1-
<a class="nav-link" href="{{ site.baseurl }}/docs">Introduction</a>
1+
<!-- <a class="nav-link" href="{{ site.baseurl }}/docs">Introduction</a>
22
<a class="nav-link" href="{{ site.baseurl }}/docs/security">Security</a>
33
<a class="nav-link" href="{{ site.baseurl }}/docs/view">View</a>
44
<a class="nav-link" href="{{ site.baseurl }}/docs/route">Route</a>
5-
<a class="nav-link" href="{{ site.baseurl }}/docs/storage">Storage</a>
5+
<a class="nav-link" href="{{ site.baseurl }}/docs/storage">Storage</a> -->
6+
7+
{% for site in site.data.docbar %}
8+
{% if site.child %}
9+
<a role="button" class="nav-link nav-link-dropdown collapsed" data-toggle="collapse" aria-expanded="false" aria-controls="#_{{ site.key }}" href="#_{{ site.key }}">{{ site.name }}</a>
10+
<div class="collapse" id="_{{ site.key }}">
11+
<div class="card-body">
12+
{% for child in site.child %}
13+
<a class="nav-link nav-link-child" href="/docs/~version/{{ site.key }}/{{ child.key }}">{{ child.name }}</a>
14+
{% endfor %}
15+
</div>
16+
</div>
17+
{% else %}
18+
<a class="nav-link" href="/docs/~version/{{ site.key }}">{{ site.name }}</a>
19+
{% endif %}
20+
21+
{% endfor %}
22+
23+
24+
<script>
25+
$('.nav-link').each(function(){
26+
let url = $(this).attr('href');
27+
url = url.replace('~version', window.sessionStorage.getItem('_version'));
28+
29+
$(this).attr('href', url);
30+
31+
// console.log(window.location.pathname)
32+
if(url == window.location.pathname){
33+
34+
if($(this).hasClass('nav-link-child')){
35+
let id = $(this).closest('.collapse').attr('id');
36+
$("[href='#"+id+"']").removeClass('collapsed');
37+
$(this).closest('.collapse').addClass('show');
38+
}
39+
}
40+
})
41+
</script>

_layouts/docs.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
77

8+
<script
9+
src="https://code.jquery.com/jquery-3.4.1.min.js"
10+
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
11+
crossorigin="anonymous"></script>
812
<!-- Bootstrap CSS -->
913
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
1014
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
@@ -66,7 +70,7 @@
6670
<!-- </div> -->
6771
<!-- Optional JavaScript -->
6872
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
69-
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
73+
7074
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
7175
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
7276
<script defer src="https://use.fontawesome.com/releases/v5.4.1/js/all.js" integrity="sha384-L469/ELG4Bg9sDQbl0hvjMq8pOcqFgkSpwhwnslzvVVGpDjYJ6wJJyYjvG3u8XW7" crossorigin="anonymous"></script>

0 commit comments

Comments
 (0)