From 408aed03d3454330120475ca53838a2f4fe28ea3 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Sat, 8 Jun 2024 20:34:37 +0200
Subject: feat: display results in a table, showing details on click
---
frontend/templates/blocks/options.gotmpl | 75 +++++++----------------
frontend/templates/blocks/packages.gotmpl | 99 +++++++++----------------------
frontend/templates/blocks/results.gotmpl | 28 ++++-----
frontend/templates/blocks/search.gotmpl | 11 +++-
4 files changed, 71 insertions(+), 142 deletions(-)
(limited to 'frontend/templates')
diff --git a/frontend/templates/blocks/options.gotmpl b/frontend/templates/blocks/options.gotmpl
index de31696..5a08bae 100644
--- a/frontend/templates/blocks/options.gotmpl
+++ b/frontend/templates/blocks/options.gotmpl
@@ -1,54 +1,25 @@
{{- define "hits" }}
- {{- range . }}
- {{- with .Data }}
-
-
- {{ .Name }}
-
- {{ markdown .Description }}
-
- {{- with .Type }}
- - Type
- {{ . }}
- {{- end }}
- {{- with .Default }}
- {{- if or .Text .Markdown }}
- - Default
- -
- {{- if .Markdown }}
- {{ markdown .Markdown }}
- {{- else }}
-
{{ .Text }}
- {{- end }}
-
- {{- end }}
- {{- end }}
- {{- with .Example }}
- {{- if or .Text .Markdown }}
- - Example
- -
- {{- if .Markdown }}
- {{ markdown .Markdown }}
- {{- else }}
-
{{ .Text }}
- {{- end }}
-
- {{- end }}
- {{- end }}
- {{- with .RelatedPackages }}
- - Related Packages
- - {{ . }}
- {{- end }}
- {{- with .Declarations }}
- - Declared
- {{- range . }}
- -
- {{ .Name }}
-
- {{- end }}
- {{- end }}
-
-
- {{- end }}
- {{- end }}
+
+
+
+ Title |
+ Description |
+
+
+
+ {{- range . }}
+ {{- with .Data }}
+
+
+ {{ .Name }}
+ |
+
+ {{ markdown (firstSentence .Description) }}
+
+ |
+
+ {{- end }}
+ {{- end }}
+
+
{{- end }}
diff --git a/frontend/templates/blocks/packages.gotmpl b/frontend/templates/blocks/packages.gotmpl
index 90ba0b2..cce97a0 100644
--- a/frontend/templates/blocks/packages.gotmpl
+++ b/frontend/templates/blocks/packages.gotmpl
@@ -1,75 +1,30 @@
{{- define "hits" }}
- {{- range . }}
- {{- with .Data }}
-
-
-
- {{- if .Broken }}
- {{ .Attribute }}
- {{- else }}
- {{ .Attribute }}
- {{- end }}
-
-
- {{- if .LongDescription }}
- {{ markdown .LongDescription }}
- {{- else }}
- {{ .Description }}
- {{- end }}
-
- {{- with .MainProgram }}
- - Main Program
- -
-
{{ . }}
-
- {{- end }}
- {{- with .Homepages }}
- - Homepage
- -
- {{- range . }}
- {{ . }}
- {{- end }}
-
- {{- end }}
- {{- with .Version }}
- - Version
- - {{ . }}
- {{- end }}
- {{- with .Licenses }}
- - License
- -
- {{- range . }}
- {{- if .URL }}
- {{ or .FullName .Name }}
- {{- else }}
- {{ or .FullName .Name }}
- {{- end }}
- {{- with .AppendixURL }}
- Appendix
- {{- end }}
+
+
+
+ Attribute |
+ Name |
+ Description |
+
+
+
+ {{- range . }}
+ {{- with .Data }}
+
+
+ {{- with .Attribute }}
+ {{ . }}
{{- end }}
-
- {{- end }}
- {{- with .Maintainers }}
- - Maintainer{{ if gt (len .) 1 }}s{{ end }}
- -
- {{- range . }}
- {{- if .Github }}
- {{ .Name }}
- {{- else }}
- {{ .Name }}
- {{- end }}
- {{- end }}
-
- {{- end }}
- {{- with .Definition }}
- - Defined
- -
- Source
-
- {{- end }}
-
-
- {{- end }}
- {{- end }}
+ |
+
+ {{ .Name }}
+ |
+
+ {{ .Description }}
+ |
+
+ {{- end }}
+ {{- end }}
+
+
{{- end }}
diff --git a/frontend/templates/blocks/results.gotmpl b/frontend/templates/blocks/results.gotmpl
index c375156..ef6e1f1 100644
--- a/frontend/templates/blocks/results.gotmpl
+++ b/frontend/templates/blocks/results.gotmpl
@@ -1,21 +1,19 @@
{{- define "results" }}
{{- with .Results }}
{{- if gt .Total 0 }}
-
- {{ block "hits" .Hits }}
- {{ end }}
-
-
+ {{ block "hits" .Hits }}
+ {{ end }}
+
{{- else }}
Nothing found
{{- end }}
diff --git a/frontend/templates/blocks/search.gotmpl b/frontend/templates/blocks/search.gotmpl
index 9320376..93ae545 100644
--- a/frontend/templates/blocks/search.gotmpl
+++ b/frontend/templates/blocks/search.gotmpl
@@ -16,9 +16,14 @@
- {{- if .Results }}
- {{ block "results" . }}{{ end }}
- {{- end }}
+
+ {{- if .Results }}
+ {{ block "results" . }}{{ end }}
+ {{- end }}
+
+
{{- end }}
{{- define "head" }}
--
cgit 1.4.1