Skip to content

Commit 597e351

Browse files
aneta-petrovaekohl
andauthored
Rework navigation structure to simplify it (#4068)
* Remove unused code * Rework navigation structure This creates landing pages for each guide where all build flavors are shown. By default they are collapsed because they're fairly long. Then a new individual landing page is created for every build flavor. Then the navigation is changed so there is a link to the landing page. The version switcher remains in place to allow users to switch between different versions of the guide. * Convert remaining .json files to the new structure * Update main page to drop reference to flavor in navigation --------- Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
1 parent 17070bd commit 597e351

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1176
-2659
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ When a commit is pushed into `X.Y`:
7474
* Change `katello` to the right version.
7575
* Change `Nightly` in titles to the appropriate version.
7676
* Remove guides which aren't ready for stable branches.
77-
* Create a copy of [/web/releases/nightly.adoc](https://github.com/theforeman/foreman-documentation/tree/master/web/releases/nightly.adoc) as `X.Y.adoc` and edit it accordingly. Remove guides which aren't ready for stable branches.
7877
* Test the changes by following the instructions in [/web/README.md](https://github.com/theforeman/foreman-documentation/tree/master/web/README.md) to deploy the website locally.
7978
* Add the new Foreman version to [/.github/PULL_REQUEST_TEMPLATE.md](https://github.com/theforeman/foreman-documentation/blob/master/.github/PULL_REQUEST_TEMPLATE.md).
8079
* Update `VERSION_LINKS` in the root `Makefile`.

web/content/index.adoc.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For Foreman plugin overview, see link:https://theforeman.org/plugins/[Plugins].
1414

1515
== Navigating the docs.theforeman.org site
1616

17-
Use the top menu bar to select your release version and flavor.
17+
Start by using the top menu bar to select your release version.
1818

1919
For questions, visit the https://community.theforeman.org/c/support/10[support forum].
2020
For contribution, visit the https://github.com/theforeman/foreman-documentation[GitHub repository].

web/content/js/nav.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ function buildNavigation() {
44
if (currentVer && currentVer.length > 1) {
55
currentVer = currentVer[1];
66
} else {
7-
currentVer = "nightly";
7+
currentVer = latestVersion;
8+
}
9+
10+
const path_components = document.location.pathname.split('/');
11+
const filename = path_components[path_components.length - 1];
12+
if (filename.startsWith('index-')) {
13+
var guides_link = `/release/${currentVer}/${filename}`;
14+
} else {
15+
var guides_link = `/release/${currentVer}`;
816
}
9-
const navBuilds = navVersions.find(function(version) {
10-
return version['foreman'] == currentVer;
11-
}).builds;
1217

1318
return `<nav>
1419
<a href="/">
@@ -22,22 +27,11 @@ function buildNavigation() {
2227
<span></span>
2328
</button>
2429
<ul class="nav-menu">
25-
<li class="nav-item"><a href="https://theforeman.org/">About Foreman</a></li>`
26-
+ navBuilds.map(function(build){
27-
return(
28-
`<li class="nav-item dropdown">
29-
<a href="#" data-action="dropdown-toggle">${build.title}</a>
30-
<div class="dropdown-menu">`
31-
+ build.guides.map(function(guide){
32-
const url = `/${currentVer}/${guide.path}/${build.filename}`;
33-
return `<div class="dropdown-div"><a class="dropdown-item" href="${url}">${guide.title}</a></div>`;
34-
}).join("")
35-
+`</div>
36-
</li>`
37-
)}).join("")
38-
+ `<li class="nav-item dropdown">
39-
<a href="#" data-action="dropdown-toggle">Version ${currentVer}</a>
40-
<div class="dropdown-menu dropdown-menu-left">`
30+
<li class="nav-item"><a href="https://theforeman.org/">About Foreman</a></li>
31+
<li class="nav-item"><a href="${guides_link}">${currentVer} guides</a></li>
32+
<li class="nav-item dropdown">
33+
<a href="#" data-action="dropdown-toggle">All versions</a>
34+
<div class="dropdown-menu dropdown-menu-left">`
4135
+ navVersions.map(function(version) {
4236
if (document.location.pathname == "/") {
4337
var dl = `/release/${version.foreman}`;

web/content/js/versions.js.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
const navVersions = <%= releases.map { |release| release[:release] }.to_json %>
1+
const navVersions = <%= releases.map { |release| release[:release] }.to_json %>;
2+
const latestVersion = "<%= releases_in_state('supported').first[:release][:foreman] %>";

web/lib/releases.rb

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def versions
1717
end
1818

1919
def items
20-
versions.map do |version, filename|
20+
versions.flat_map do |version, filename|
2121
release = JSON.parse(File.read(filename))
2222
release['foreman'] = version
2323
release['state'] ||= 'unsupported'
@@ -29,13 +29,28 @@ def items
2929
state: release['state'],
3030
katello: release['katello'],
3131
release: release,
32+
builds: release['builds'],
3233
}
3334

34-
new_item(
35-
File.read(File.join(content_dir_name, "#{version}.adoc")),
36-
context,
37-
"/#{version}/index.adoc.erb",
38-
)
35+
[
36+
new_item(
37+
File.read(File.join(content_dir_name, 'release.adoc.erb')),
38+
context,
39+
"/#{version}/index.adoc.erb",
40+
)
41+
] + release['builds'].map do |build|
42+
context = build.merge(
43+
'foreman' => version,
44+
'katello' => release['katello'],
45+
'other_builds' => [],
46+
)
47+
48+
new_item(
49+
File.read(File.join(content_dir_name, 'release-build.adoc.erb')),
50+
context,
51+
"/#{version}/#{File.basename(build['filename'], '.html')}.adoc.erb",
52+
)
53+
end
3954
end
4055
end
4156

@@ -74,16 +89,3 @@ def releases
7489
def releases_in_state(state)
7590
releases.filter { |release| release[:state] == state }
7691
end
77-
78-
def guides_links(release, tag)
79-
raise "no release passed" unless release
80-
raise "release without builds" unless release[:builds]
81-
82-
release[:builds].filter_map do |build|
83-
guide = build[:guides].find { |guide| guide[:tag] == tag }
84-
next unless guide
85-
86-
link = "#{release[:path]}/#{guide[:path]}/#{build[:filename]}"
87-
[link, build[:title], guide[:title]]
88-
end
89-
end

web/releases/2.4.adoc

Lines changed: 0 additions & 18 deletions
This file was deleted.

web/releases/2.4.json

Lines changed: 32 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,35 @@
11
{
2-
"katello": "4.0",
3-
"builds": [
4-
{
5-
"title": "Katello on EL",
6-
"filename": "index-katello.html",
7-
"guides": [
8-
{
9-
"title": "Planning Guide",
10-
"path": "Planning_Guide"
11-
},
12-
{
13-
"title": "Quickstart Guide",
14-
"path": "Quickstart_Guide"
15-
},
16-
{
17-
"title": "Installing Katello Server",
18-
"path": "Installing_Server_on_Red_Hat"
19-
},
20-
{
21-
"title": "Installing Smart Proxy with Content",
22-
"path": "Installing_Proxy_on_Red_Hat"
23-
},
24-
{
25-
"title": "Upgrading and Updating",
26-
"path": "Upgrading_and_Updating"
27-
},
28-
{
29-
"title": "Configuring Smart Proxies with a Load Balancer",
30-
"path": "Configuring_Load_Balancer"
31-
},
32-
{
33-
"title": "Content Management Guide",
34-
"path": "Content_Management_Guide"
35-
},
36-
{
37-
"title": "Deploying Foreman on AWS",
38-
"path": "Deploying_on_AWS"
39-
},
40-
{
41-
"title": "Provisioning Guide",
42-
"path": "Provisioning_Guide"
43-
},
44-
{
45-
"title": "Configuring Foreman to use Ansible",
46-
"path": "Configuring_Ansible"
47-
},
48-
{
49-
"title": "Managing Hosts Guide",
50-
"path": "Managing_Hosts"
51-
},
52-
{
53-
"title": "Administering Foreman",
54-
"path": "Administering_Red_Hat_Satellite"
55-
},
56-
{
57-
"title": "Application Centric Deployment",
58-
"path": "Application_Centric_Deployment"
2+
"katello": "4.0",
3+
"builds": [
4+
{
5+
"title": "Katello on EL",
6+
"header": "Foreman {FOREMAN_VER} and Katello {KATELLO_VER}",
7+
"filename": "index-katello.html",
8+
"sections": {
9+
"Release notes and upgrading": [
10+
["Upgrading_and_Updating", "Upgrading and Updating"]
11+
],
12+
"Quickstart": [
13+
["Quickstart_Guide", "Quickstart Guide"]
14+
],
15+
"Deploying Foreman and Katello": [
16+
["Planning_Guide", "Planning Guide"],
17+
["Installing_Server_on_Red_Hat", "Installing Katello Server"],
18+
["Installing_Proxy_on_Red_Hat", "Installing Smart Proxy with Content"],
19+
["Configuring_Load_Balancer", "Configuring Smart Proxies with a Load Balancer"],
20+
["Deploying_on_AWS", "Deploying Foreman on AWS"]
21+
],
22+
"Administering Foreman server": [
23+
["Administering_Red_Hat_Satellite", "Administering Foreman"],
24+
["Content_Management_Guide", "Content Management Guide"]
25+
],
26+
"Administering hosts": [
27+
["Provisioning_Guide", "Provisioning Guide"],
28+
["Configuring_Ansible", "Configuring Foreman to use Ansible"],
29+
["Managing_Hosts", "Managing Hosts Guide"],
30+
["Application_Centric_Deployment", "Application Centric Deployment"]
31+
]
32+
}
5933
}
60-
]
61-
}
62-
]
34+
]
6335
}

web/releases/2.5.adoc

Lines changed: 0 additions & 18 deletions
This file was deleted.

web/releases/2.5.json

Lines changed: 32 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,35 @@
11
{
2-
"katello": "4.1",
3-
"builds": [
4-
{
5-
"title": "Katello on EL",
6-
"filename": "index-katello.html",
7-
"guides": [
8-
{
9-
"title": "Planning Guide",
10-
"path": "Planning_Guide"
11-
},
12-
{
13-
"title": "Quickstart Guide",
14-
"path": "Quickstart_Guide"
15-
},
16-
{
17-
"title": "Installing Katello Server",
18-
"path": "Installing_Server_on_Red_Hat"
19-
},
20-
{
21-
"title": "Installing Smart Proxy with Content",
22-
"path": "Installing_Proxy_on_Red_Hat"
23-
},
24-
{
25-
"title": "Upgrading and Updating",
26-
"path": "Upgrading_and_Updating"
27-
},
28-
{
29-
"title": "Configuring Smart Proxies with a Load Balancer",
30-
"path": "Configuring_Load_Balancer"
31-
},
32-
{
33-
"title": "Content Management Guide",
34-
"path": "Content_Management_Guide"
35-
},
36-
{
37-
"title": "Deploying Foreman on AWS",
38-
"path": "Deploying_on_AWS"
39-
},
40-
{
41-
"title": "Provisioning Guide",
42-
"path": "Provisioning_Guide"
43-
},
44-
{
45-
"title": "Configuring Foreman to use Ansible",
46-
"path": "Configuring_Ansible"
47-
},
48-
{
49-
"title": "Managing Hosts Guide",
50-
"path": "Managing_Hosts"
51-
},
52-
{
53-
"title": "Administering Foreman",
54-
"path": "Administering_Red_Hat_Satellite"
55-
},
56-
{
57-
"title": "Application Centric Deployment",
58-
"path": "Application_Centric_Deployment"
2+
"katello": "4.1",
3+
"builds": [
4+
{
5+
"title": "Katello on EL",
6+
"header": "Foreman {FOREMAN_VER} and Katello {KATELLO_VER}",
7+
"filename": "index-katello.html",
8+
"sections": {
9+
"Release notes and upgrading": [
10+
["Upgrading_and_Updating", "Upgrading and Updating"]
11+
],
12+
"Quickstart": [
13+
["Quickstart_Guide", "Quickstart Guide"]
14+
],
15+
"Deploying Foreman and Katello": [
16+
["Planning_Guide", "Planning Guide"],
17+
["Installing_Server_on_Red_Hat", "Installing Katello Server"],
18+
["Installing_Proxy_on_Red_Hat", "Installing Smart Proxy with Content"],
19+
["Configuring_Load_Balancer", "Configuring Smart Proxies with a Load Balancer"],
20+
["Deploying_on_AWS", "Deploying Foreman on AWS"]
21+
],
22+
"Administering Foreman server": [
23+
["Administering_Red_Hat_Satellite", "Administering Foreman"],
24+
["Content_Management_Guide", "Content Management Guide"]
25+
],
26+
"Administering hosts": [
27+
["Provisioning_Guide", "Provisioning Guide"],
28+
["Managing_Hosts", "Managing Hosts Guide"],
29+
["Configuring_Ansible", "Configuring Foreman to use Ansible"],
30+
["Application_Centric_Deployment", "Application Centric Deployment"]
31+
]
32+
}
5933
}
60-
]
61-
}
62-
]
34+
]
6335
}

web/releases/3.0.adoc

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)