aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.go8
-rw-r--r--tmpl/index.tmpl15
2 files changed, 12 insertions, 11 deletions
diff --git a/index.go b/index.go
index 9b53b6c..353e637 100644
--- a/index.go
+++ b/index.go
@@ -93,7 +93,11 @@ func handle_index(w http.ResponseWriter, req *http.Request) {
},
)
if err != nil {
- log.Println(err)
- return
+ w.Header().Set("Content-Type", "text/plain; charset=utf-8")
+ w.WriteHeader(500)
+ w.Write([]byte(fmt.Sprintf(
+ "Error\nUnexpected template error.\n%s\n",
+ err,
+ )))
}
}
diff --git a/tmpl/index.tmpl b/tmpl/index.tmpl
index 366edd1..7fa8190 100644
--- a/tmpl/index.tmpl
+++ b/tmpl/index.tmpl
@@ -68,25 +68,22 @@
<tr>
<th colspan=3>Your Works</th>
</tr>
- {{- /* TODO: It's better to use a caption but it's too hard to get the formatting right */ -}}
<tr>
<th class="min" scope="col">ID</th>
<th class="min" scope="col">Flags</th>
<th scope="col">Title</th>
</tr>
- {{- /*
- {% for w in wyours %}
+ {{- range .works }}
<tr>
- <th scope="row" class="min">{{ w.id }}</th>
- <td class="min flags">{%if w.public%}<abbr title="Public">P</abbr>{%else%}<abbr title="Private">x</abbr>{%endif%}{%if w.active%}<abbr title="Active">!</abbr>{%else%}<abbr title="Inactive">-</abbr>{%endif%}{%if w.anonymous%}<abbr title="Anonymous">*</abbr>{%else%}<abbr title="Non-anonymous"</abbr>@</abbr>{%endif%}</td>
- <td><a href="{{ url_for(".work", id=w.id) }}">{{ w.title }}</a></td>
+ <th scope="row" class="min">{{ .id }}</th>
+ <td class="min flags">{{- if .public -}}<abbr title="Public">P</abbr>{{- else -}}<abbr title="Private">x</abbr>{{- end -}}{{- if .active -}}<abbr title="Active">!</abbr>{{- else -}}<abbr title="Inactive">-</abbr>{{- end -}}{{- if .anonymous -}}<abbr title="Anonymous">*</abbr>{{- else -}}<abbr title="Non-anonymous">@</abbr>{{- end -}}</td>
+ <td><a href="./works/{{- .id -}}">{{- .title -}}</a></td>
</tr>
- {% endfor %}
- */ -}}
+ {{ end -}}
<tr>
<th colspan="3">
<div class="flex-justify">
- <a class="btn-primary btn" href="{{- /* url_for(".new") */ -}}">New</a>
+ <a class="btn-primary btn" href="./works/new">New</a>
</div>
</th>
</tr>