From e347064abe3ce4c90fbad23d36e5d61a149e2389 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 14 Feb 2025 08:48:07 +0800 Subject: http_*: Refactor to reduce duplication --- templates/repo_index.html.tmpl | 6 +++--- templates/repo_log.html.tmpl | 2 +- templates/repo_raw_dir.html.tmpl | 6 +++--- templates/repo_tree_dir.html.tmpl | 6 +++--- templates/repo_tree_file.html.tmpl | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'templates') diff --git a/templates/repo_index.html.tmpl b/templates/repo_index.html.tmpl index f6615d7..7faea1e 100644 --- a/templates/repo_index.html.tmpl +++ b/templates/repo_index.html.tmpl @@ -37,7 +37,7 @@ - + @@ -60,11 +60,11 @@
- + - {{- $ref := .ref }} + {{- $ref := .ref_name }} {{- range .files }} diff --git a/templates/repo_log.html.tmpl b/templates/repo_log.html.tmpl index 0ad6f39..88b978d 100644 --- a/templates/repo_log.html.tmpl +++ b/templates/repo_log.html.tmpl @@ -11,7 +11,7 @@
{{ .Mode }}
- + diff --git a/templates/repo_raw_dir.html.tmpl b/templates/repo_raw_dir.html.tmpl index dc1a5b6..d306bbf 100644 --- a/templates/repo_raw_dir.html.tmpl +++ b/templates/repo_raw_dir.html.tmpl @@ -12,18 +12,18 @@ {{- $path_spec := .path_spec }} - {{- $ref := .ref }} + {{- $ref := .ref_name }} {{- $ref_type := .ref_type }} {{- range .files }} - + {{- end }} diff --git a/templates/repo_tree_dir.html.tmpl b/templates/repo_tree_dir.html.tmpl index 5e56dc9..34559da 100644 --- a/templates/repo_tree_dir.html.tmpl +++ b/templates/repo_tree_dir.html.tmpl @@ -12,18 +12,18 @@ {{- $path_spec := .path_spec }} - {{- $ref := .ref }} + {{- $ref := .ref_name }} {{- $ref_type := .ref_type }} {{- range .files }} - + {{- end }} diff --git a/templates/repo_tree_file.html.tmpl b/templates/repo_tree_file.html.tmpl index 0bf9164..8eacd28 100644 --- a/templates/repo_tree_file.html.tmpl +++ b/templates/repo_tree_file.html.tmpl @@ -10,7 +10,7 @@ {{ template "header" . }}

- /{{ .path_spec }} (raw) + /{{ .path_spec }} (raw)

{{ .file_contents }}
-- cgit v1.2.3
Commits on {{ .ref }}Commits on {{ .ref_name }}
ID
- (Raw) /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref }} on {{ .ref }}{{ end }} + (Raw) /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref_name }} on {{ .ref_name }}{{ end }}
{{ .Mode }}{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ .Name }}{{ if not .Is_file }}/{{ end }} {{ .Size }}
- /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref }} on {{ .ref }}{{ end }} + /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref_name }} on {{ .ref_name }}{{ end }}
{{ .Mode }}{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ .Name }}{{ if not .Is_file }}/{{ end }} {{ .Size }}