Skip to content
This repository was archived by the owner on Nov 10, 2020. It is now read-only.

Commit ee0bfbd

Browse files
committed
Finish better version switching system.
1 parent 85dc94c commit ee0bfbd

File tree

11 files changed

+60
-49
lines changed

11 files changed

+60
-49
lines changed

404.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
layout: default
33
title: Page not found
44
noversions: true
5+
isdoc: false
56
---
67

78
Sorry! Couldn't find what you were looking for.
89

9-
If you got here by switching versions, the item you were looking has probably been renamed. Try searching or returning to the home page for [**Swift 2.1**](/v2.1/) or [**Swift 1.2**](/v1.2/).
10-
10+
If you got here by switching versions, the item you were looking has probably been renamed. Select the version you'd like from the list below:
1111

12+
{% for version in site.data.versions %}
13+
- <a href="{{ version.path }}">{{ version.name }} ({{ version.note }}, {{version.version}})</a>
14+
{% endfor %}

_assets/css/theme.css.less

+3
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ body.home {
129129
padding-top: 0;
130130
padding-bottom: 0;
131131
}
132+
.dropdown-toggle,.dropdown-menu {
133+
width: 100%;
134+
}
132135
.navbar-toggle {
133136
border-color: @white;
134137

_assets/js/swift-site.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,9 @@ $(function() {
129129
$('.dropdown-menu a').each(function(i, item) {
130130
item.href = (item.href + location.href).replace(/(v[.a-z0-9]+\/).+?(\/v[.a-z0-9]+\/|$)/, '$1')
131131
});
132-
/*
133-
$('#version a').each(function(i, item) {
134-
item.href = (item.href + location.href).replace(/(v[.a-z0-9]+\/).+?(\/v[.a-z0-9]+\/|$)/, '$1');
132+
$('#header h1 a').each(function(i, item) {
133+
item.href = location.href.replace(/(v[.a-z0-9]+\/).+/, '$1')
135134
});
136-
*/
137135

138136
// highlight key parts of identifiers
139137
$('.toggle-link').each(function(i, link) {

_config.yml

+13
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,16 @@ paginate_path: /news/page:num
2424
tag_dir: /news/tags
2525
monthly_archive:
2626
path: /news
27+
28+
defaults:
29+
-
30+
scope:
31+
path: ""
32+
values:
33+
isdoc: true
34+
-
35+
scope:
36+
path: ""
37+
type: "posts"
38+
values:
39+
isdoc: false

_data/versions.csv

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
path,name,note
2-
/v3.0/,Swift 3.0,swift/master
3-
/v2.2/,Swift 2.2,Xcode 7.3 beta
4-
/v2.1/,Swift 2.1,Xcode 7.2
5-
/v1.2/,Swift 1.2,Xcode 6.3+
1+
path,name,note,version
2+
/v3.0/,Swift 3.0-dev,swift/master,Swift b92870f555
3+
/v2.2/,Swift 2.2,Xcode 7.3 beta 5,swiftlang-703.0.17.4
4+
/v2.1/,Swift 2.1,Xcode 7.2,swiftlang-700.1.101.19
5+
/v1.2/,Swift 1.2,Xcode 6.3+,swiftlang-602.0.49.6

_includes/footer.html

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<a href="/news/">News</a> &nbsp;&sdot;&nbsp;
1111
<a href="https://twitter.com/{{ site.twitter_username }}">@{{ site.twitter_username }}</a> &nbsp;&sdot;&nbsp;
1212
<a href="https://github.com/{{ site.github_username }}">github.com/{{ site.github_username }}</a><br />
13-
<span class="version">{{ site.swift_version }}</span>
1413
</p>
1514
<p>Created by parsing and analyzing the autogenerated header for the Swift standard library. Built using <a href="https://nodejs.org/en/">Node.js</a> and <a href="http://jekyllrb.com/">Jekyll</a>, hosted with <a href="https://pages.github.com/">GitHub Pages</a>.</p>
1615

_includes/header.html

+3-18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
{% capture homeUrl %}{% if page.url contains 'swift-2' %}/swift-2{% endif %}/{% endcapture %}
2-
{% assign current = 'Swift 2.2 (Xcode 7.3 beta)' %}
3-
{% for version in site.data.versions %}
4-
{% if page.url contains version.path %}
5-
{% capture current %}{{ version.name }} ({{ version.note }}){% endcapture %}
6-
{% endif %}
7-
{% endfor %}
8-
92
<nav class="navbar navbar-default" role="navigation" id="navbar">
103
<div class="container-fluid">
114
<!-- Brand and toggle get grouped for better mobile display -->
@@ -27,6 +20,8 @@ <h1><a href="{{ homeUrl }}">SwiftDoc.org</a></h1>
2720
<span class="glyphicon glyphicon-search form-control-feedback"></span>
2821
</div>
2922

23+
{% include version.html %}
24+
3025
</form>
3126
<ul class="nav navbar-nav navbar-right" id="navmenu">
3227
<li><a href="/type/">Types</a></li>
@@ -49,17 +44,7 @@ <h1><a href="{{ homeUrl }}">{{ site.title }}</a></h1>
4944
<span class="glyphicon glyphicon-search form-control-feedback"></span>
5045
</div>
5146

52-
<div class="dropdown">
53-
<button class="btn btn-default dropdown-toggle" type="button" id="versionMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
54-
{{ current }}
55-
<span class="caret"></span>
56-
</button>
57-
<ul class="dropdown-menu" aria-labelledby="versionMenu">
58-
{% for version in site.data.versions %}
59-
<li><a href="{{ version.path }}">{{ version.name }} ({{ version.note }})</a></li>
60-
{% endfor %}
61-
</ul>
62-
</div>
47+
{% include version.html %}
6348

6449
{% endif %}
6550
</div>

_includes/sidebar.html

+3-19
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
{% if page.isdoc %}
2-
{% assign current = 'Swift 2.2 (Xcode 7.3 beta)' %}
3-
{% for version in site.data.versions %}
4-
{% if page.url contains version.path %}
5-
{% capture current %}{{ version.name }} ({{ version.note }}){% endcapture %}
6-
{% endif %}
7-
{% endfor %}
81
<div id="intranav">
2+
{% if page.isdoc %}
93
<h4>On this page</h4>
104
<ul id="chapters">
115
<li><a href="#content">Declaration</a></li>
@@ -14,18 +8,8 @@ <h4>On this page</h4>
148
<h4>Display</h4>
159
<ul id="display">
1610
</ul>
11+
{% endif %}
1712

1813
<h4>Swift Version</h4>
19-
<div class="dropdown">
20-
<button class="btn btn-default dropdown-toggle" type="button" id="versionMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
21-
{{ current }}
22-
<span class="caret"></span>
23-
</button>
24-
<ul class="dropdown-menu" aria-labelledby="versionMenu">
25-
{% for version in site.data.versions %}
26-
<li><a href="{{ version.path }}">{{ version.name }} ({{ version.note }})</a></li>
27-
{% endfor %}
28-
</ul>
29-
</div>
14+
{% include version.html %}
3015
</div>
31-
{% endif %}

_includes/version.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% assign current = 'Swift 2.2 (Xcode 7.3 beta)' %}
2+
{% for version in site.data.versions %}
3+
{% if page.url contains version.path %}
4+
{% capture current %}{{ version.name }} ({{ version.note }}){% endcapture %}
5+
{% endif %}
6+
{% endfor %}
7+
<div class="dropdown">
8+
<button class="btn btn-default dropdown-toggle" type="button" id="versionMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
9+
{{ current }}
10+
<span class="caret"></span>
11+
</button>
12+
<ul class="dropdown-menu" aria-labelledby="versionMenu">
13+
{% for version in site.data.versions %}
14+
<li><a href="{{ version.path }}">{{ version.name }} ({{ version.note }})</a></li>
15+
{% endfor %}
16+
</ul>
17+
</div>

_layouts/wrapper.html

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
{% assign current = 'Swift 2.2 (Xcode 7.3 beta)' %}
2+
{% for version in site.data.versions %}
3+
{% if page.url contains version.path %}
4+
{% capture current %}{{ version.name }} ({{ version.note }}){% endcapture %}
5+
{% endif %}
6+
{% endfor %}
17
<!DOCTYPE html>
28
<html>
39
{% include head.html %}
@@ -12,12 +18,14 @@
1218

1319
<div id="fixed-sidebar" data-spy="">
1420

21+
{% if page.isdoc %}
1522
<div class="form-group">
1623
<div class="input-group has-feedback" id="select-container">
1724
<input type="hidden" class="form-control select2">
1825
<span class="glyphicon glyphicon-search form-control-feedback"></span>
1926
</div>
2027
</div>
28+
{% endif %}
2129

2230
{% include sidebar.html %}
2331

news/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
layout: default
33
title: News
44
indexpage: 1
5+
isdoc: false
56
---
67

78
<div class="posts">

0 commit comments

Comments
 (0)