aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-11 20:24:30 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-11 20:24:30 +0800
commit3f0342fcbf5aafc13b3fce58c077d86275e3781d (patch)
treee7c7de2a2251763bb1773d11357e308a3b8878ef
parent*.html: Fix body class (diff)
downloadforge-3f0342fcbf5aafc13b3fce58c077d86275e3781d.tar.gz
forge-3f0342fcbf5aafc13b3fce58c077d86275e3781d.tar.zst
forge-3f0342fcbf5aafc13b3fce58c077d86275e3781d.zip
repo_index.html, style.css: CSS state machines
-rw-r--r--static/style.css21
-rw-r--r--templates/repo_index.html.tmpl21
-rw-r--r--templates/repo_raw_dir.html.tmpl5
-rw-r--r--templates/repo_tree_dir.html.tmpl5
4 files changed, 27 insertions, 25 deletions
diff --git a/static/style.css b/static/style.css
index 9d90dca..af5a9b3 100644
--- a/static/style.css
+++ b/static/style.css
@@ -91,3 +91,24 @@ td#readme > *:first-child {
pre, .scroll {
overflow-x: auto;
}
+.toggle-table-off, .toggle-table-on {
+ display: none;
+}
+.toggle-table-off + table > thead > tr > th, .toggle-table-on + table > thead > tr > th {
+ padding: 0;
+}
+.toggle-table-off + table > thead > tr > th > label, .toggle-table-on + table > thead > tr > th > label {
+ width: 100%;
+ display: inline-block;
+ padding: 3px 1px;
+ cursor: pointer;
+}
+.toggle-table-off:checked + table > tbody {
+ display: none;
+}
+.toggle-table-on + table > tbody {
+ display: none;
+}
+.toggle-table-on:checked + table > tbody {
+ display: table-row-group;
+}
diff --git a/templates/repo_index.html.tmpl b/templates/repo_index.html.tmpl
index 84ce662..c3b4759 100644
--- a/templates/repo_index.html.tmpl
+++ b/templates/repo_index.html.tmpl
@@ -7,15 +7,11 @@
</head>
<body class="repo-index">
<div class="padding-wrapper scroll">
+ <input id="toggle-table-recent-commits" type="checkbox" class="toggle-table-off" />
<table id="recent-commits" class="wide">
<thead>
<tr class="title-row">
- <th colspan="3">Recent Commits (<a href="log/{{ .ref }}/">see all</a>)</th>
- </tr>
- <tr>
- <th scope="col">Title</th>
- <th scope="col">Author</th>
- <th scope="col">Time</th>
+ <th colspan="3"><label for="toggle-table-recent-commits">Recent Commits (<a href="log/{{ .ref }}/">see all</a>)</label></th>
</tr>
</thead>
<tbody>
@@ -34,15 +30,11 @@
</table>
</div>
<div class="padding-wrapper scroll">
+ <input id="toggle-table-file-tree" type="checkbox" class="toggle-table-off" />
<table id="file-tree" class="wide">
<thead>
<tr class="title-row">
- <th colspan="3">/ on {{ .ref }}</th>
- </tr>
- <tr>
- <th scope="col">Mode</th>
- <th scope="col">Name</th>
- <th scope="col">Size</th>
+ <th colspan="3"><label for="toggle-table-file-tree">/ on {{ .ref }}</label></th>
</tr>
</thead>
<tbody>
@@ -63,12 +55,11 @@
</div>
<div class="padding-wrapper">
{{ if .readme }}
+ <input id="toggle-table-readme" type="checkbox" class="toggle-table-off" />
<table class="wide">
<thead>
<tr class="title-row">
- <th>
- README.md
- </th>
+ <th><label for="toggle-table-readme">README</label></th>
</tr>
</thead>
<tbody>
diff --git a/templates/repo_raw_dir.html.tmpl b/templates/repo_raw_dir.html.tmpl
index 3dcb8a6..f55d8c8 100644
--- a/templates/repo_raw_dir.html.tmpl
+++ b/templates/repo_raw_dir.html.tmpl
@@ -14,11 +14,6 @@
(Raw) /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} on {{ .ref }}
</th>
</tr>
- <tr>
- <th scope="col">Mode</th>
- <th scope="col">Name</th>
- <th scope="col">Size</th>
- </tr>
</thead>
<tbody>
{{- $path_spec := .path_spec }}
diff --git a/templates/repo_tree_dir.html.tmpl b/templates/repo_tree_dir.html.tmpl
index 7db2035..aa457c4 100644
--- a/templates/repo_tree_dir.html.tmpl
+++ b/templates/repo_tree_dir.html.tmpl
@@ -14,11 +14,6 @@
/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} on {{ .ref }}
</th>
</tr>
- <tr>
- <th scope="col">Mode</th>
- <th scope="col">Name</th>
- <th scope="col">Size</th>
- </tr>
</thead>
<tbody>
{{- $path_spec := .path_spec }}