Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make table responsive when on mobile #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 72 additions & 70 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,81 +36,83 @@

<!-- the main page container -->
<main class="site-container">
<table class="table non-roi-mode hide-archive container-xxl" id="release-megatable">
<thead>
<tr>
<th class="all-togglers">
<div class="btn-group" role="group">
<button type="button" class="btn btn-sm btn-outline-primary" id="expand-all">⊕ Expand all</button>
<button type="button" class="btn btn-sm btn-outline-secondary" id="collapse-all">⊙ Collapse all</button>
</div>
</th>
{{ range $idx, $rel := .Timeline.Releases }}
<th
class="{{ getReleaseHeaderClass $.Timeline $rel }}"
data-release="{{ $rel.Version }}"
data-released="{{ $rel.Released }}"
data-latest-version="{{ $rel.LatestVersion }}"
data-release-date="{{ $rel.ReleaseDate.Format "2006-01-02" }}"
data-eol-date="{{ with $rel.EndOfLifeDate }}{{ .Format "2006-01-02" }}{{ end }}"
>
<a tabindex="{{ $idx }}" role="button" data-bs-toggle="popover" data-release="{{ $rel.Version }}">{{ $rel.Version }}</a>
</th>
{{ end }}
</tr>
</thead>
<div class="table-responsive-md">
<table class="table non-roi-mode hide-archive container-xxl" id="release-megatable">
<thead>
<tr>
<th class="all-togglers">
<div class="btn-group" role="group">
<button type="button" class="btn btn-sm btn-outline-primary" id="expand-all">⊕ Expand all</button>
<button type="button" class="btn btn-sm btn-outline-secondary" id="collapse-all">⊙ Collapse all</button>
</div>
</th>
{{ range $idx, $rel := .Timeline.Releases }}
<th
class="{{ getReleaseHeaderClass $.Timeline $rel }}"
data-release="{{ $rel.Version }}"
data-released="{{ $rel.Released }}"
data-latest-version="{{ $rel.LatestVersion }}"
data-release-date="{{ $rel.ReleaseDate.Format "2006-01-02" }}"
data-eol-date="{{ with $rel.EndOfLifeDate }}{{ .Format "2006-01-02" }}{{ end }}"
>
<a tabindex="{{ $idx }}" role="button" data-bs-toggle="popover" data-release="{{ $rel.Version }}">{{ $rel.Version }}</a>
</th>
{{ end }}
</tr>
</thead>

{{ range $apiGroup := .Timeline.APIGroups }}
<tbody data-apigroup="{{ $apiGroup.Name }}" class="{{ getAPIGroupBodyClass $.Timeline $apiGroup }}">
<!-- row for the API group -->
<tr class="{{ getAPIGroupClass $.Timeline $apiGroup }}">
<th class="name">
<a href="#" class="toggle" title="expand/collapse this API group"><span class="icons hidden">⊕</span> <span class="name">{{ $apiGroup.Name }}</span></a>
</th>
{{ range $rel := $.Timeline.Releases }}
<td class="{{ getAPIGroupReleaseClass $.Timeline $apiGroup $rel }}">
<span class="badge text-bg">{{ $apiGroup.PreferredVersion $rel.Version }}</span>
</td>
{{ end }}
</tr>
{{ range $apiGroup := .Timeline.APIGroups }}
<tbody data-apigroup="{{ $apiGroup.Name }}" class="{{ getAPIGroupBodyClass $.Timeline $apiGroup }}">
<!-- row for the API group -->
<tr class="{{ getAPIGroupClass $.Timeline $apiGroup }}">
<th class="name">
<a href="#" class="toggle" title="expand/collapse this API group"><span class="icons hidden">⊕</span> <span class="name">{{ $apiGroup.Name }}</span></a>
</th>
{{ range $rel := $.Timeline.Releases }}
<td class="{{ getAPIGroupReleaseClass $.Timeline $apiGroup $rel }}">
<span class="badge text-bg">{{ $apiGroup.PreferredVersion $rel.Version }}</span>
</td>
{{ end }}
</tr>

{{ range $apiVersionIdx, $apiVersion := $apiGroup.APIVersions }}
<!-- row for the API version -->
<!-- TODO: collapsed should be applied via JS -->
<tr class="{{ getAPIVersionClass $.Timeline $apiGroup $apiVersion }} collapsed" data-apiversion="{{ $apiVersion.Version }}">
<th class="name">
<a href="#" class="toggle" title="expand/collapse this API version"><span class="icons">⊕</span> <span class="hidden">{{ $apiGroup.Name }}/</span><span class="name">{{ $apiVersion.Version }}</span></a>
</th>
{{ range $rel := $.Timeline.Releases }}
<td class="{{ getAPIVersionReleaseClass $.Timeline $apiGroup $apiVersion $rel }}">
<span class="badge text-bg">{{ getAPIVersionReleaseContent $.Timeline $apiGroup $apiVersion $rel }}</span>
</td>
{{ end }}
</tr>
{{ range $apiVersionIdx, $apiVersion := $apiGroup.APIVersions }}
<!-- row for the API version -->
<!-- TODO: collapsed should be applied via JS -->
<tr class="{{ getAPIVersionClass $.Timeline $apiGroup $apiVersion }} collapsed" data-apiversion="{{ $apiVersion.Version }}">
<th class="name">
<a href="#" class="toggle" title="expand/collapse this API version"><span class="icons">⊕</span> <span class="hidden">{{ $apiGroup.Name }}/</span><span class="name">{{ $apiVersion.Version }}</span></a>
</th>
{{ range $rel := $.Timeline.Releases }}
<td class="{{ getAPIVersionReleaseClass $.Timeline $apiGroup $apiVersion $rel }}">
<span class="badge text-bg">{{ getAPIVersionReleaseContent $.Timeline $apiGroup $apiVersion $rel }}</span>
</td>
{{ end }}
</tr>

{{ range $apiResource := $apiVersion.Resources }}
<!-- row for an API resource -->
<tr class="{{ getAPIResourceClass $.Timeline $apiGroup $apiVersion $apiResource }}" data-apiversion="{{ $apiVersion.Version }}" data-apiresource="{{ $apiResource.Plural }}">
<th class="name">
<span title="{{ $apiResource.Description }}">{{ $apiResource.Kind }}</span>
<span class="icons"><small><a href="{{ getResourceDocumentationLink $.Timeline $apiGroup $apiVersion $apiResource }}" class="docs" title="view documentation for most recent Kubernetes release" target="_blank"><i class="fa-solid fa-book"></i></a></small></span>
</th>
{{ range $rel := $.Timeline.Releases }}
<td class="{{ getAPIResourceReleaseClass $.Timeline $apiGroup $apiVersion $apiResource $rel }}">
<span class="badge text-bg">{{ getAPIResourceReleaseContent $.Timeline $apiGroup $apiVersion $apiResource $rel }}</span>
</td>
{{ range $apiResource := $apiVersion.Resources }}
<!-- row for an API resource -->
<tr class="{{ getAPIResourceClass $.Timeline $apiGroup $apiVersion $apiResource }}" data-apiversion="{{ $apiVersion.Version }}" data-apiresource="{{ $apiResource.Plural }}">
<th class="name">
<span title="{{ $apiResource.Description }}">{{ $apiResource.Kind }}</span>
<span class="icons"><small><a href="{{ getResourceDocumentationLink $.Timeline $apiGroup $apiVersion $apiResource }}" class="docs" title="view documentation for most recent Kubernetes release" target="_blank"><i class="fa-solid fa-book"></i></a></small></span>
</th>
{{ range $rel := $.Timeline.Releases }}
<td class="{{ getAPIResourceReleaseClass $.Timeline $apiGroup $apiVersion $apiResource $rel }}">
<span class="badge text-bg">{{ getAPIResourceReleaseContent $.Timeline $apiGroup $apiVersion $apiResource $rel }}</span>
</td>
{{ end }}
</tr>
{{ end }}
</tr>
{{ end }}
{{ end }}
</tbody>
{{ end }}
</tbody>
{{ end }}
<tfoot>
<tr class="no-notable-changes">
<td colspan="{{ add 1 (len .Timeline.Releases) }}" class="infotext">There are no notable API changes in this release.<br><i class="fa-solid fa-face-smile-beam"></i></td>
</tr>
</tfoot>
</table>
<tfoot>
<tr class="no-notable-changes">
<td colspan="{{ add 1 (len .Timeline.Releases) }}" class="infotext">There are no notable API changes in this release.<br><i class="fa-solid fa-face-smile-beam"></i></td>
</tr>
</tfoot>
</table>
</div>
</main> <!-- main content done -->

<div class="hidden">
Expand Down
5 changes: 5 additions & 0 deletions templates/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ a.toggle .name {
padding: .2rem .2rem;
}

/* make sure the togglers always show when scrolling the table */
.all-togglers {
z-index: 2 !important;
}

/* fix missing table borders in Firefox */
/* thanks to https://stackoverflow.com/a/58319944 */
.table tbody th {
Expand Down