Skip to content

Commit 70bbd2c

Browse files
authored
Merge branch 'OneBusAway:main' into methodpagefix
2 parents c15f27c + 28da828 commit 70bbd2c

File tree

84 files changed

+4336
-73
lines changed

Some content is hidden

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

84 files changed

+4336
-73
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Welcome to the GitHub project that powers the official [OneBusAway Developer Doc
66

77
Want to help improve the documentation? Thank you! You can easily improve the official OneBusAway documentation by modifying the Markdown files that comprise it. We welcome any size of contribution, ranging from typos and corrected links, to brand-new tutorials.
88

9+
## Import Javadocs from OBA Sites
10+
11+
From the root of the project, run the command `bin/update_javadocs` to see a list of available projects from which Javadocs can be imported.
12+
913
## Develop New Features/Fix Bugs
1014

1115
### Prerequisites
@@ -94,7 +98,7 @@ The website built from this project is deployed automatically to a static hostin
9498
- For work in progress pull requests, please use the Draft PR feature.
9599
- Make sure all tests pass and add additional tests for the code you submit.
96100
- Document your reasoning behind the changes. Explain why you wrote the code in the way you did. The code should explain what it does.
97-
- If there's an existing issue, reference to it by adding something like `References/Closes/Fixes/Resolves #123`, where 123 is the issue number.
101+
- If there's an existing issue, reference to it by adding something like `References/Closes/Fixes/Resolves #123`, where 123 is the issue number.
98102
- Please fill out the PR Template when making a PR.
99103
100104
> Please note: maintainers may close your PR if it has gone stale or if we don't plan to merge the code.
@@ -118,7 +122,3 @@ This project exists because of all the people who have contributed.
118122
## The bottom line
119123
120124
We are all humans trying to work together to improve the community. Let's always be kind and appreciate the importance of making compromises. ❤️
121-
122-
123-
124-

bin/update_javadocs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'tmpdir'
4+
5+
MODULES = {
6+
"onebusaway-gtfs-modules" => (->{ build_gtfs_modules })
7+
}
8+
9+
def build_gtfs_modules
10+
repo_url = 'https://github.com/OneBusAway/onebusaway-gtfs-modules.git'
11+
temp_dir = Dir.mktmpdir
12+
13+
begin
14+
# Clone the repository into the temporary directory
15+
system("git clone --single-branch --branch gh-pages #{repo_url} #{temp_dir}")
16+
17+
if $?.success?
18+
puts "Repository cloned into temporary directory: #{temp_dir}"
19+
else
20+
puts "Failed to clone repository."
21+
exit
22+
end
23+
24+
archive_path = Dir.chdir(temp_dir) do |path|
25+
archive_command = "git archive --format=zip -o gh-pages.zip HEAD"
26+
system(archive_command)
27+
28+
archive_path = File.join(temp_dir, 'gh-pages.zip')
29+
30+
if $?.success?
31+
puts "Archive created successfully: #{archive_path}"
32+
else
33+
puts "Failed to create archive."
34+
exit
35+
end
36+
archive_path
37+
end
38+
39+
system("unzip -o #{archive_path} -d ./src/modules/onebusaway-gtfs-modules/current")
40+
ensure
41+
# Clean up the temporary directory
42+
FileUtils.remove_entry(temp_dir)
43+
end
44+
end
45+
46+
mod = ARGV[0]&.strip
47+
lam = MODULES[mod]
48+
49+
if lam
50+
lam.call
51+
else
52+
puts "Unknown module: '#{mod}'"
53+
puts "Call this script with one of the following options:"
54+
MODULES.keys.each {|k| puts " - #{k}"}
55+
exit
56+
end

frontend/javascript/page_navigation.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,9 @@ export function enableScrollToTop() {
1919
export function setupSidebar() {
2020
const h1Elements = document.querySelectorAll('h1');
2121
const h2Elements = document.querySelectorAll('article h2');
22-
const sidebar = document.querySelector('.sidebar');
23-
24-
function appendSidebarItem(textContent, tagName) {
25-
const newItem = document.createElement('a');
26-
newItem.textContent = textContent;
27-
if (tagName === 'h1') {
28-
newItem.classList.add('sidebar-item', 'text-green-500');
29-
}
30-
else if (tagName === 'h2') {
31-
newItem.classList.add('sidebar-item-h2', 'text-gray-500', 'hover:text-green-400', 'ml-4', 'cursor-pointer');
32-
}
33-
sidebar.appendChild(newItem);
3422

35-
newItem.addEventListener('click', function() {
36-
const currentVersion = newItem.textContent;
37-
const headings = document.querySelectorAll('h2');
38-
let targetElement = null;
39-
headings.forEach(function(heading) {
40-
if (heading.textContent.trim() === currentVersion.trim()) {
41-
targetElement = heading;
42-
}
43-
});
44-
if (targetElement) {
45-
window.scrollTo(0, targetElement.offsetTop - 100);
46-
}
47-
});
23+
if (h2Elements.length == 0) {
24+
return;
4825
}
4926

5027
h1Elements.forEach(function (element) {
@@ -67,3 +44,30 @@ export function saveAndRestoreNavigationPosition() {
6744
console.log('clicked')
6845
});
6946
};
47+
48+
function appendSidebarItem(textContent, tagName) {
49+
const sidebar = document.querySelector('.sidebar');
50+
const newItem = document.createElement('a');
51+
newItem.textContent = textContent;
52+
if (tagName === 'h1') {
53+
newItem.classList.add('sidebar-item', 'text-green-500', 'block');
54+
}
55+
else if (tagName === 'h2') {
56+
newItem.classList.add('sidebar-item-h2', 'text-gray-500', 'hover:text-green-400', 'ml-4', 'block', 'cursor-pointer');
57+
}
58+
sidebar.appendChild(newItem);
59+
60+
newItem.addEventListener('click', function() {
61+
const currentVersion = newItem.textContent;
62+
const headings = document.querySelectorAll('h2');
63+
let targetElement = null;
64+
headings.forEach(function(heading) {
65+
if (heading.textContent.trim() === currentVersion.trim()) {
66+
targetElement = heading;
67+
}
68+
});
69+
if (targetElement) {
70+
window.scrollTo(0, targetElement.offsetTop - 100);
71+
}
72+
});
73+
}

frontend/styles/index.css

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
@tailwind base;
2525
@tailwind components;
2626

27+
.prose h4 {
28+
font-weight: 600;
29+
}
30+
2731
button.DocSearch.DocSearch-Button {
2832
@apply h-8 w-full items-center gap-2 rounded-full bg-white pl-2 pr-3 text-sm text-zinc-500 ring-1 ring-zinc-900/10;
2933
@apply transition hover:ring-zinc-900/20 lg:flex dark:bg-white/5 dark:text-zinc-400 dark:ring-inset dark:ring-white/10 dark:hover:ring-white/20;
@@ -63,30 +67,28 @@ pre.highlight {
6367
}
6468

6569
::-webkit-scrollbar-track {
66-
background-color : #686868;
70+
@apply dark:bg-zinc-800 bg-[#f3f3f3];
6771
}
6872

6973
::-webkit-scrollbar-thumb {
70-
background: #424242;
74+
@apply dark:bg-zinc-600 bg-[#c2c2c2];
7175
}
7276

7377
::-webkit-scrollbar-thumb:hover {
74-
background: #848484;
78+
@apply dark:bg-zinc-400 bg-zinc-400;
7579
}
7680

77-
@media (prefers-color-scheme: light) {
78-
::-webkit-scrollbar-track {
79-
background-color: #f3f3f3;
80-
}
81-
82-
::-webkit-scrollbar-thumb {
83-
background: #848484;
84-
}
81+
::-webkit-scrollbar-thumb:active {
82+
@apply dark:bg-zinc-200 bg-zinc-500;
83+
}
8584

86-
::-webkit-scrollbar-thumb:hover {
87-
background: #333;
88-
}
85+
@tailwind utilities;
8986

87+
/* Prevent headings from getting hidden when directly accessing sections with ids: */
88+
:target:before {
89+
content: "";
90+
display: block;
91+
height: 80px;
92+
margin-top: -80px;
9093
}
9194

92-
@tailwind utilities;

src/_layouts/default.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</div>
3333
</article>
3434
</main>
35-
<div class="hidden sidebar text-xs p-4 2xl:flex flex-col fixed top-24 right-12 w-fit max-w-72 h-fit"></div>
35+
<div class="hidden md:block sidebar text-xs fixed top-24 right-6 w-fit max-w-60 h-fit"></div>
3636
<%= render "footer", locals: { metadata: site.metadata } %>
3737
</div>
3838
</div>

src/_partials/_navbar.erb

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,39 @@
1010
children: {
1111
"Home" => '/',
1212
"About" => '/about',
13+
"Features" => '/features',
1314
"Downloads" => '/downloads',
1415
"Getting Help" => '/getting-help',
15-
"Release Notes" => '/release-notes'
16+
# "Release Notes" => '/release-notes' # April 2024: wildly out of date. hiding until we can fix that.
1617
},
1718
current_path: resource.relative_url
1819
)) %>
1920

2021
<%= render(NavigationSection.new(
2122
"Guides",
2223
children: {
23-
"Ported Wiki Guides" => '/guides/ported-wiki-guides',
24-
"Quickstart" => '/guides/quickstart-guide',
25-
"Installation" => '/guides/installation-guide',
26-
"Transit Data Bundle" => '/guides/transit-data-bundle-guide',
27-
"Realtime Config" => '/guides/realtime-configuration-guide',
28-
"API Config" => '/guides/api-webapp-configuration-guide',
29-
"Phone (IVR) Config" => '/guides/phone-webapp-configuration-guide',
30-
"Web Config" => '/guides/webapp-configuration-guide',
31-
"Database Config" => '/guides/database-configuration-guide',
32-
"Troubleshooting" => '/guides/troubleshooting-guide'
24+
"Deployment" => '/guides/deployment',
25+
"Outdated Guides" => '/guides/outdated'
3326
},
3427
current_path: resource.relative_url
3528
)) %>
3629

3730
<%= render(NavigationSection.new(
38-
"Features",
31+
"Javadocs",
3932
children: {
40-
"Web" => '/features/web',
41-
"Phone and SMS" => '/features/phone-and-sms',
42-
"Sign Mode" => '/features/sign-mode',
43-
"GTFS Realtime" => '/features/gtfs-realtime',
44-
"REST API" => '/api/where',
45-
"Search API" => '/api/where/search',
33+
"onebusaway-gtfs-modules" => '/modules/onebusaway-gtfs-modules/current/'
4634
},
4735
current_path: resource.relative_url
4836
)) %>
4937

50-
<%= render (NavigationSection.new(
51-
"REST API Methods",
52-
children: site.data.rest_api['methods'].reduce({}) {|acc, kv| k = kv.first; acc[k] = "/api/where/methods/#{k}"; acc },
53-
current_path: resource.relative_url
54-
)) %>
55-
56-
<%= render (NavigationSection.new(
57-
"REST API Elements",
58-
children: site.data.rest_api['elements'].reduce({}) {|acc, kv| k = kv.first; v = kv.last; acc[(v['name'] || k)] = "/api/where/elements/#{k}"; acc },
38+
<%= render(NavigationSection.new(
39+
"REST API",
40+
children: {
41+
"About the REST API" => '/api/where',
42+
"API Methods" => '/api/where/methods',
43+
"API Elements" => '/api/where/elements',
44+
"Search" => '/api/where/search',
45+
},
5946
current_path: resource.relative_url
6047
)) %>
6148
</ul>

src/api/where/elements/index.erb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: page
3+
title: REST API Elements
4+
---
5+
6+
<ul>
7+
<% site.data.rest_api['elements'].each do |k,v| %>
8+
<li>
9+
<a href="/api/where/elements/<%= k %>">
10+
<%= v['name'] || k %>
11+
</a>
12+
<% if v['description'] %>
13+
- <%= v['description'] %>
14+
<% end %>
15+
</li>
16+
<% end %>
17+
</ul>

src/api/where/methods/index.erb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: page
3+
title: REST API Methods
4+
---
5+
6+
<ul>
7+
<% site.data.rest_api['methods'].each do |k,v| %>
8+
<li>
9+
<a href="/api/where/methods/<%= k %>">
10+
<%= v['name'] || k %>
11+
</a>
12+
<% if v['description'] %>
13+
- <%= v['description'] %>
14+
<% end %>
15+
</li>
16+
<% end %>
17+
</ul>

src/features/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
layout: page
3+
title: Features
4+
---
5+
6+
OneBusAway offers a rich set of features for transit agencies and end users.
7+
8+
* [Web UI](/features/web)
9+
* [Phone and SMS](/features/phone-and-sms)
10+
* [Sign Mode](/features/sign-mode)
11+
* [GTFS Realtime](/features/gtfs-realtime)
12+
* [REST API](/api/where)

src/guides/deployment/index.erb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Deployment Guides
3+
layout: page
4+
---
5+
6+
<p>
7+
This page is the hub for all of our guides and frequently asked questions about
8+
deploying OneBusAway for production use.
9+
</p>
10+
11+
<p>
12+
Over time, you can expect to find a variety of guides covering deployment to platforms like
13+
Kubernetes, AWS, Google Cloud Platform, Microsoft Azure, and more. For now, if you would like
14+
to help, check out our <a href="https://github.com/OneBusAway/onebusaway-docker/issues">onebusaway-docker issue tracker</a>
15+
where this work is being coordinated.
16+
</p>
17+
18+
<h2>Docker Images</h2>
19+
20+
<p>
21+
We maintain official OneBusAway Docker images on <a href='https://hub.docker.com/u/opentransitsoftwarefoundation'>Docker Hub</a>.
22+
We strongly recommend using a versioned image instead of the `latest` tag. You can learn more about using the Docker images with
23+
<a href="https://docs.docker.com/compose/">Docker Compose</a> in the <a href="https://github.com/OneBusAway/onebusaway-docker">onebusaway-docker project README</a>.
24+
</p>
25+
26+
<h2>Render</h2>
27+
28+
<p>
29+
<a href='https://www.render.com'>Render.com</a> is a Platform as a Service (PaaS) provider that can be much easier to work with than AWS, GCP, or Azure while still
30+
offering a rich and compelling set of services for creating, orchestrating, and maintaining software using Docker and Render's Infrastructure as Code (IaC) tooling.
31+
</p>
32+
33+
<p>
34+
<a href="/guides/deployment/render">Learn how to deploy OneBusAway on Render →</a>
35+
</p>

0 commit comments

Comments
 (0)