From f142234be0bc353a6d92eb44a03d9e4812bc3efc Mon Sep 17 00:00:00 2001 From: Trevor Bentley Date: Fri, 13 Jan 2023 04:39:20 +0100 Subject: [PATCH] add a stylized default template --- templates/base.html | 48 +++++- templates/branch.html | 19 ++- templates/branches.html | 26 ++- templates/commit.html | 50 +++--- templates/dir.html | 26 ++- templates/file.html | 10 +- templates/files.html | 29 ++++ templates/footer.html | 3 +- templates/header.html | 16 +- templates/history.html | 43 +++-- templates/repos.html | 23 ++- templates/style.css | 339 +++++++++++++++++++++++++++++++++++++++ templates/subheader.html | 1 + templates/summary.html | 104 +++++++----- templates/tag.html | 23 +-- templates/tags.html | 26 ++- 16 files changed, 664 insertions(+), 122 deletions(-) create mode 100644 templates/files.html create mode 100644 templates/style.css create mode 100644 templates/subheader.html diff --git a/templates/base.html b/templates/base.html index 882f694..f729531 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,16 +1,60 @@ +{% set head_title = site_name | default(value="Itsy-Gitsy") -%} +{% set head_description = metadata.description | default(value=site_description | default(value="Static Git repository listings")) -%} +{% set root_url = site_url | default(value=site_dir) -%} +{% if name -%} +{% set repo_url = root_url ~ "/" ~ name -%} +{% set head_title = head_title ~ " -- " ~ name -%} +{% endif -%} +{% set asset_url = root_url ~ "/" ~ site_assets -%} +{% set head_url = repo_url | default(value=root_url) -%} + {% block html_head -%} -{{site_name | default(value="Itsy-Gitsy")}} + + + + + {{head_title}} + + + + + + + {% block html_head_extra -%} {% endblock html_head_extra -%} {% endblock html_head -%} - + {% block header -%}{% include "header.html" -%}{% endblock header -%} +
+ +
+{% block subheader -%}{% include "subheader.html" -%}{% endblock subheader -%} +
+ +{% if repo_url -%} + + + + + + + + + +
summaryhistorybranchestagsfiles
+{% endif -%} + +
{% block content %}{% endblock content %} +
+ +
{% block footer -%}{% include "footer.html" -%}{% endblock footer -%} diff --git a/templates/branch.html b/templates/branch.html index 0731947..6c6ee14 100644 --- a/templates/branch.html +++ b/templates/branch.html @@ -1,11 +1,16 @@ {% extends "base.html" %} +{% block tab_branches_selected -%}selected{% endblock -%} + {% block content %} -branch: {{branch.ref_name}}
-hash: {{branch.full_hash}} ({{branch.short_hash}})
-author: {{branch.author.name}}
-committer: {{branch.committer.name}}
-date: {{ts_to_date(ts=branch.ts_utc, tz=branch.ts_offset)}}
-summary: {{branch.summary}}
-
{{branch.message}}
+
+ + + + + + +
branch:{{branch.ref_name}}
commit:{% if branch.full_hash in commits -%}{{branch.full_hash}}{% else -%}{{branch.full_hash}}{% endif -%}
author:{{branch.author.name}} <{{branch.author.email}}>
committer:{{branch.committer.name}} <{{branch.committer.email}}>
date:{{ts_to_git_timestamp(ts=branch.ts_utc, tz=branch.ts_offset)}}
+
{{branch.message}}
+
{% endblock content %} diff --git a/templates/branches.html b/templates/branches.html index db98fea..1e4c620 100644 --- a/templates/branches.html +++ b/templates/branches.html @@ -1,11 +1,21 @@ {% extends "base.html" %} +{% block tab_branches_selected -%}selected{% endblock -%} + {% block content %} - + +
+ + + + + + + - - + + @@ -13,11 +23,15 @@ - - + + {% endfor -%}
BranchCommit IDMessageCommitMessage Author Date
{{entry.ref_name}} {{entry.short_hash}}{{entry.summary}}{{entry.author.name}}{{entry.summary}}{{entry.author.name}} {{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}
-{% if page.prev_page %}PREV{% endif %}       CUR       {%if page.next_page %}NEXT{% endif %}
+ {% endblock content %} diff --git a/templates/commit.html b/templates/commit.html index 9afc401..442ae4a 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -1,31 +1,37 @@ {% extends "base.html" %} +{% block tab_history_selected -%}selected{% endblock -%} + {% block content %} - - commit: {{commit.full_hash}}
- author: {{commit.author.name}}
- committer: {{commit.committer.name}}
- parent: {% if commit.parents | length > 0 -%}{{commit.parents | first}}{%-endif-%}
-
-
-
{{commit.message}}
+
+ + + + + + +
commit:{{commit.full_hash}}
author:{{commit.author.name}} <{{commit.author.email}}>
committer:{{commit.committer.name}} <{{commit.committer.email}}>
date:{{ts_to_git_timestamp(ts=commit.ts_utc, tz=commit.ts_offset)}}
parents:{% for parent in commit.parents -%}{% if loop.index0 > 0 -%}, {%endif-%}{% if parent in commits -%}{{parent}}{%else-%}{{parent}}{%endif-%}{%-endfor-%}
+
+
{{commit.message}}
+
{% for file in commit.diff.files -%} -
- - diff --git a/{{file.basefile}} b/{{file.basefile}}
- line changes: +{{file.additions}}/-{{file.deletions}}
- index {{file.oldid | truncate(length=7,end="")}}..{{file.newid | truncate(length=7,end="")}}
- --- {{file.oldfile}}
- +++ {{file.newfile}} -
+
+
+
diff --git a/{{file.basefile}} b/{{file.basefile}}
+line changes: +{{file.additions}}/-{{file.deletions}}
+index {{file.oldid | truncate(length=7,end="")}}..{{file.newid | truncate(length=7,end="")}}
+--- {{file.oldfile}}
++++ {{file.newfile}}
+
{% for hunk in file.hunks -%} -
{{hunk.context}}
-  {%- for line in hunk.lines -%}
-  {%- if line.kind in ["del","add"] -%}{%- endif -%}
-    {{line.prefix}}{{line.text}}
-    {%- if line.kind in ["del","add"] -%}{%- endif -%}
-  {%- endfor -%}
+
{{hunk.context}}
+{%- for line in hunk.lines -%}
+{{line.prefix}}{{line.text}}
+{%- endfor -%}
 
{% endfor -%} +
{% endfor -%} +
+
{% endblock content %} diff --git a/templates/dir.html b/templates/dir.html index a56436a..bdbc262 100644 --- a/templates/dir.html +++ b/templates/dir.html @@ -1,21 +1,33 @@ {% extends "base.html" %} +{% block tab_files_selected -%}selected{% endblock -%} + +{% block subheader -%} + +{% endblock -%} + {% block content %} - +
{{ dir.path }}
+
+ + + + + + - {% for file in files -%} - - - - - + + + + {% endfor -%} +
FileID Type Mode Size
{{file.name}}{{file.id}}{{file.kind}} ({{file.is_binary}}){{file.mode}}{{file.size}}{{file.name}}{% if file.kind == "dir" -%}/{% endif -%}{{file.kind}}{{file.mode | mask(mask="0xfff") | oct}}{{file.size}}
{% endblock content %} diff --git a/templates/file.html b/templates/file.html index 26de15b..023d364 100644 --- a/templates/file.html +++ b/templates/file.html @@ -4,10 +4,15 @@ {% endblock html_head_extra %} +{% block tab_files_selected -%}selected{% endblock -%} + +{% block subheader -%} + +{% endblock -%} {% block content %} -{{file.path}} ({{file.name}}) [{{file.id}}]
--------
+
+
{{ file.path }}
{% if file.contents_safe -%} {% if file.contents_preformatted -%}
{{file.contents | safe }}
@@ -17,4 +22,5 @@ {%- else -%}
{{file.contents}}
{%- endif -%} +
{% endblock content %} diff --git a/templates/files.html b/templates/files.html new file mode 100644 index 0000000..d155880 --- /dev/null +++ b/templates/files.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} + +{% block tab_files_selected -%}selected{% endblock -%} + +{% block content %} + + + + + + + + + + + + + + + {% for file in root_files -%} + + + + + + + {% endfor -%} +
FileTypeModeSize
{{file.name}}{% if file.kind == "dir" -%}/{% endif -%}{{file.kind}}{{file.mode | mask(mask="0xfff") | oct}}{{file.size}}
+{% endblock content %} diff --git a/templates/footer.html b/templates/footer.html index 9d302a7..7493bdb 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -1,2 +1,3 @@ + diff --git a/templates/header.html b/templates/header.html index 16e9ddf..bf761ea 100644 --- a/templates/header.html +++ b/templates/header.html @@ -1,3 +1,13 @@ -Site: {{site_name | default(value="Itsy-Gitsy") }}
-Description: {{site_description | default(value="A collection of Git repositories")}}
-
+ diff --git a/templates/history.html b/templates/history.html index 5b950cd..e61ae59 100644 --- a/templates/history.html +++ b/templates/history.html @@ -1,27 +1,40 @@ {% extends "base.html" %} +{% block tab_history_selected -%}selected{% endblock -%} + {% block content %} - + +
+ + + + + + + + - + - - + + {% for entry in history -%} - {% if loop.index0 < 250 -%} - - - - - - - - -{% endif -%} + + + + + + + + {% endfor -%}
Commit IDCommit Message Author DateDiffRefsDiffRefs
{{entry.short_hash}}{{entry.summary}}{{entry.author.name}}{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}{{entry.stats.files}} (+{{entry.stats.additions}}/-{{entry.stats.deletions}}){%- for ref in entry.alt_refs -%}{%- if loop.index0 > 0 -%},  {%- endif -%}{{ref}}{%- endfor -%}
{{entry.short_hash}}{{entry.summary}}{{entry.author.name}}{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}{{entry.stats.files}} (+{{entry.stats.additions}}/-{{entry.stats.deletions}}){%- for ref in entry.alt_refs -%}{%- if loop.index0 < 3 -%}{{ref}}{%- endif -%}{%- endfor -%}{% if entry.alt_refs | length > 3 -%}...{% endif -%}
-{% if page.prev_page %}PREV{% endif %}       CUR       {%if page.next_page %}NEXT{% endif %}
+ {% endblock content %} diff --git a/templates/repos.html b/templates/repos.html index 70b1eb6..84e7769 100644 --- a/templates/repos.html +++ b/templates/repos.html @@ -1,7 +1,26 @@ {% extends "base.html" %} {% block content %} -{% for repo in repos | sort(attribute="name") -%} -{{ repo.name }} ({{repo.metadata.website}}) [{{repo.metadata.attributes | get(key="status", default="unknown")}}] ({{ts_to_date(ts=repo.history[0].ts_utc, tz=repo.history[0].ts_offset)}})
+ + + + + + + + + + + + + + {% for repo in repos | sort(attribute="name") -%} + + + + + + {% endfor -%} +
RepositoryDescriptionWebsiteLast Updated
{{ repo.name }}{{repo.metadata.description}}{% if repo.metadata.website -%}link{% endif -%}{{ts_to_date(ts=repo.history[0].ts_utc, tz=repo.history[0].ts_offset)}}
{% endblock content %} diff --git a/templates/style.css b/templates/style.css new file mode 100644 index 0000000..aa541f6 --- /dev/null +++ b/templates/style.css @@ -0,0 +1,339 @@ +:root { + --greyblue: #dee2ea; + --greyblue: #60738c; + --greypink: #e0deea; + --greypink: #c0d2dd; + --greypink: #dbdcdd; + --offwhite: #f4f4f4; + --offerwhite: #e9e9e9; + --deepred: #770000; + --deepblue: #3002e8; + --nearwhite: #fafafa; + --nearblack: #222222; + --borderverylight: #ddd; + --borderlight: #bbb; + --borderdark: #888; +} +body { + height: 100%; + font-family: monospace,monospace; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + line-height: 1.5; + background-color: var(--nearwhite); + color: var(--nearblack); +} +body { + margin: 0; + min-height: 100%; +} +div.banner { + width: 95%; + max-width: 100rem; + color: var(--offwhite); + background-color: var(--greyblue); + border-radius: 0 0 30px 30px; + font-family: sans-serif; + text-align: center; + margin: 0 auto 0 auto; + margin-bottom: 1rem; + padding-bottom: 0.5rem; +} +div.breadcrumbs { + background-color: var(--greypink); + font-weight: bold; + padding: 0.5em; + border-radius: 10px 10px 0 0; +} +div.breadcrumbs a { + color: var(--nearblack); + text-decoration: none; +} +div.breadcrumbs span.site-title { + font-size: 1rem; +} +div.breadcrumbs span.repo-name { + font-size: 1.5rem; +} +div.site-title { + letter-spacing: .1em; + font-size: 2.5rem; + font-weight: bold; +} +div.site-description { + min-height: 1.5em; +} +a { + word-wrap: break-word; + background-color: transparent; + color: var(--deepblue); + transition: opacity .1s; +} +a:hover { + opacity: 0.5; +} +a.disabled { + pointer-events: none; + color: var(--nearblack); +} +div.main { + width: 95%; + max-width: 100rem; + margin: 0 auto 0 auto; +} +div.content { + padding: 1em 0 1em 0; +} +table { + width: 100%; +} +table.tabs { + padding: 0 0 0 0; + margin: 0 auto 0 auto; + background-color: var(--offwhite); + border-radius: 0 0 3px 3px; + border-bottom: solid 3px var(--borderlight); + border-spacing: 0; +} +table.tabs td.tab { + text-align: center; + min-width: 8em; + border-right: solid 1px var(--borderdark); +} +table.tabs td.padding { + width: 100%; +} +table.tabs a { + color: var(--deepred); + text-decoration: none; + letter-spacing: .1em; + font-weight: bold; +} +table.tabs td.selected { + background-color: var(--greyblue); + background-color: #ede5de; + background-color: var(--greypink); +} +table.summary-table, table.repo-list { + width: 100%; + max-width: 100%; + background-color: var(--offwhite); + border-radius: 8px; +} +table.summary-table th, table.repo-list th { + text-align: left; + padding-left: 0.3em; +} +table.summary-table tr:nth-child(even), table.repo-list tr:nth-child(even) { + background-color: var(--offerwhite); +} +table.repo-list td { + padding: 0.5em 0.3em 0.5em 0.3em; +} +table.summary-table td, table.repo-list td { + word-break: break-all; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + padding-left: 0.3em; +} +table.repo-list col.repo { + width: 12rem; +} +table.repo-list td.description { + max-width: 40em; +} +table.repo-list col.description { + width: 30rem; +} +table.repo-list col.website { + width: 7em; + max-width: 7em; +} +table.repo-list col.updated { + width: 10em; + max-width: 10em; +} +table.summary-table col.oid { + width: 7em; + max-width: 7em; +} +table.summary-table col.date { + width: 9em; + max-width: 9em; +} +table.summary-table col.diff { + width: 9em; + max-width: 9em; +} +table.summary-table col.msg { + width: 30rem; +} +table.summary-table col.refs { + width: 25rem; +} +table.summary-table col.branch { + width: 30em; +} +table.summary-table col.tag { + width: 30em; +} +table.summary-table col.type { + width: 7em; + max-width: 7em; +} +table.summary-table col.mode { + width: 7em; + max-width: 7em; +} +table.summary-table col.size { + width: 7em; + max-width: 7em; +} +table.summary-table td.msg { + max-width: 10em; +} +table.summary-table td.refs { + font-size: 0.8rem; +} +table.summary-table span.ref { + color: var(--offwhite); + background-color: var(--greyblue); + border-radius: 10px; + margin-right: 1em; + padding: 0 0.5em 0 0.5em; +} +table.summary-table td.sans { + font-family: sans-serif; +} +div.summary-header { + color: var(--offwhite); + letter-spacing: 0.05em; + background-color: var(--greyblue); + font-size: 1.4rem; + font-weight: bold; + text-align: center; + text-transform: uppercase; + margin-top: 2rem; + border-bottom: solid 1px var(--borderdark); + border-radius: 10px 10px 0 0; +} +div.summary-header.commit { + margin-top: 0rem; +} +div.full-header { + color: var(--offwhite); + letter-spacing: 0.05em; + background-color: var(--greyblue); + font-size: 1.4rem; + font-weight: bold; + text-align: center; + text-transform: uppercase; + margin-top: 0rem; + border-bottom: solid 1px var(--borderdark); + border-radius: 10px 10px 0 0; +} +div.nocap-header { + color: var(--offwhite); + letter-spacing: 0.05em; + background-color: var(--greyblue); + font-size: 1.4rem; + font-weight: bold; + text-align: center; + margin-top: 0rem; + border-bottom: solid 1px var(--borderdark); + border-radius: 10px 10px 0 0; +} +hr { + border-color: var(--borderverylight); +} +div.footer { + margin-top: 1em; + padding-bottom: 2em; + text-align: center; + font-size: 0.9rem; +} +nav.paginate { + text-align: center; + margin-top: 2em; +} +nav.paginate span.paginate { + margin: 0 5em 0 5em; +} +nav.paginate a.disabled { + text-decoration: none; + color: var(--borderlight); +} +div.file-contents { + background-color: var(--offwhite); + font-size: 1rem; + overflow: visible; +} +div.commit-page, div.branch-page, div.tag-page { + background-color: var(--offwhite); + font-size: 1rem; + overflow: visible; +} +table.commit-header, table.branch-header, table.tag-header { + width: 100%; + background-color: var(--offerwhite); + background-color: var(--greypink); + border-radius: 10px 10px 0 0; + padding: 0.5em; + border-bottom: solid 2px var(--borderlight); +} +table.commit-header td.field, table.branch-header td.field, table.tag-header td.field { + width: 10em; + font-weight: bold; +} +div.commit-message { + padding: 1em 0.5em 2em 0.5em; + border-bottom: solid 2px var(--borderlight); +} +div.branch-message, div.tag-message { + padding: 1em 0.5em 2em 0.5em; +} +div.commit-diff { + padding: 0.5em; +} +div.commit-diff-header { + font-weight: bold; +} +div.commit span.hunk-header { + font-weight: bold; +} +div.commit-diff-header pre, div.branch-page pre, div.tag-page pre { + padding: 0; + margin: 0; +} +div.commit-page span.add { + color: #00aa00; +} +div.commit-page span.del { + color: #bb0000; +} +@media screen and (max-width:50em) { + body, table, div { + font-size: 0.8rem; + } + div.footer { + font-size: 0.7rem; + } + col.nosmall, td.nosmall, th.nosmall { + display: none; + visibility: hidden; + } + table.tabs td.tab { + min-width: 0em; + padding: 0 0.3em 0 0.3em; + } + div.file-contents { + font-size: 0.7rem; + } + div.breadcrumbs span.site-title { + font-size: 0.7rem; + } + div.breadcrumbs span.repo-name { + font-size: 0.9rem; + } +} diff --git a/templates/subheader.html b/templates/subheader.html new file mode 100644 index 0000000..b7d0936 --- /dev/null +++ b/templates/subheader.html @@ -0,0 +1 @@ + diff --git a/templates/summary.html b/templates/summary.html index e016439..429581a 100644 --- a/templates/summary.html +++ b/templates/summary.html @@ -1,90 +1,118 @@ {% extends "base.html" %} +{% block tab_summary_selected -%}selected{% endblock -%} + {% block content %} -Commit history
-All branches
-All tags
-
- +
Recent history
+
+ + + + + + + + - + - - + + {% for entry in history -%} {% if loop.index0 < 10 -%} - - - - - - - - + + + + + + + + {% endif -%} {% endfor -%}
Commit IDCommit Message Author DateDiffRefsDiffRefs
{{entry.short_hash}}{{entry.summary}}{{entry.author.name}}{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}{{entry.stats.files}} (+{{entry.stats.additions}}/-{{entry.stats.deletions}}){%- for ref in entry.alt_refs -%}{%- if loop.index0 > 0 -%},  {%- endif -%}{{ref}}{%- endfor -%}
{{entry.short_hash}}{{entry.summary}}{{entry.author.name}}{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}{{entry.stats.files}} (+{{entry.stats.additions}}/-{{entry.stats.deletions}}){%- for ref in entry.alt_refs -%}{%- if loop.index0 < 3 -%}{{ref}}{%- endif -%}{%- endfor -%}{% if entry.alt_refs | length > 3 -%}...{% endif -%}
- +
Recent branches
+
+ + + + + + + - - + + - {% for entry in branches -%} + {% for entry in branches | sort(attribute="ts_utc") | reverse -%} {% if loop.index0 < 10 -%} - - + + {% endif -%} {% endfor -%}
BranchCommit IDMessageCommitMessage Author Date
{{entry.ref_name}} {{entry.short_hash}}{{entry.summary}}{{entry.author.name}}{{entry.summary}}{{entry.author.name}} {{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}
- +
Recent tags
+
+ + + + + + + - - + + - {% for entry in tags -%} + {% for entry in tags | sort(attribute="ts_utc") | reverse -%} {% if loop.index0 < 10 -%} - - + + {% endif -%} {% endfor -%}
TagCommit IDMessageCommitMessage Author Date
{{entry.ref_name}} {{entry.short_hash}}{{entry.summary}}{{entry.author.name}}{{entry.summary}}{{entry.author.name}} {{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}
- +
File tree
+
+ + + + + + - - - - + + + {% for file in root_files -%} - - - - - + + + + {% endfor -%}
FileIDTypeModeSizeTypeModeSize
{{file.name}}{{file.id}}{{file.kind}} ({{file.is_binary}}){{file.mode}}{{file.size}}{{file.name}}{% if file.kind == "dir" -%}/{% endif -%}{{file.kind}}{{file.mode | mask(mask="0xfff") | oct}}{{file.size}}
diff --git a/templates/tag.html b/templates/tag.html index c21f6b9..5178118 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -1,15 +1,16 @@ {% extends "base.html" %} +{% block tab_tags_selected -%}selected{% endblock -%} + {% block content %} -branch: {{tag.ref_name}}
-hash: {{tag.full_hash}} ({{tag.short_hash}})
-author: {{tag.author.name}}
-committer: {{tag.committer.name}}
-date: {{ts_to_date(ts=tag.ts_utc, tz=tag.ts_offset)}}
-summary: {{tag.summary}}
-
{{tag.message}}
-
-commit: {%- if commit -%}{{commit.full_hash}} -
{{commit.message}}
-{%-else-%}{{tag.tagged_id}}{%-endif-%}
+
+ + + + + + +
tag:{{tag.ref_name}}
hash:{{tag.full_hash}}
tagged commit:{% if tag.tagged_id -%}{% if tag.tagged_id in commits -%}{{tag.tagged_id}}{% else -%}{{tag.tagged_id}}{% endif -%}{% endif -%}
author:{{tag.author.name}} <{{tag.author.email}}>
date:{{ts_to_git_timestamp(ts=tag.ts_utc, tz=tag.ts_offset)}}
+
{{tag.message}}
+
{% endblock content %} diff --git a/templates/tags.html b/templates/tags.html index f846bcb..b959d1a 100644 --- a/templates/tags.html +++ b/templates/tags.html @@ -1,11 +1,21 @@ {% extends "base.html" %} +{% block tab_tags_selected -%}selected{% endblock -%} + {% block content %} - + +
+ + + + + + + - - + + @@ -13,11 +23,15 @@ - - + + {% endfor -%}
TagCommit IDMessageCommitMessage Author Date
{{entry.ref_name}} {{entry.short_hash}}{{entry.summary}}{{entry.author.name}}{{entry.summary}}{{entry.author.name}} {{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}
-{% if page.prev_page %}PREV{% endif %}       CUR       {%if page.next_page %}NEXT{% endif %}
+ {% endblock content %}