Use & as author separator

And set properly the separators on other fields
This commit is contained in:
Las Zenow 2021-05-01 11:36:07 +00:00
parent 867c19f97c
commit 7665eae762
8 changed files with 61 additions and 13 deletions

View file

@ -90,8 +90,8 @@ func InitTemplate(assetsPath string) *Template {
return &t
}
func stringsJoin(strs []string) string {
return strings.Join(strs, ", ")
func stringsJoin(strs []string, sep string) string {
return strings.Join(strs, sep)
}
func bookFileName(book database.Book) string {

View file

@ -47,7 +47,12 @@ function closeAlert() {
<dl class="row">
{{if .Authors}}
<dt class="col-sm-3 text-sm-end">Authors</dt>
<dd class="col-sm-9 text-start">{{range .Authors}}<a href="/search/?q=author:{{.}}">{{.}}</a>, {{end}}</dd>
<dd class="col-sm-9 text-start">
{{range $i, $author := .Authors}}
{{if $i}}&amp;{{end}}
<a href="/search/?q=author:{{$author}}">{{$author}}</a>
{{end}}
</dd>
{{end}}
{{if .Publisher}}
<dt class="col-sm-3 text-sm-end">Publisher</dt>
@ -55,7 +60,12 @@ function closeAlert() {
{{end}}
{{if .Tags}}
<dt class="col-sm-3 text-sm-end">Tags</dt>
<dd class="col-sm-9 text-start">{{range .Tags}}<a href="/search/?q=tag:{{.}}">{{.}}</a>, {{end}}</dd>
<dd class="col-sm-9 text-start">
{{range $i, $tag := .Tags}}
{{if $i}},{{end}}
<a href="/search/?q=tag:{{$tag}}">{{$tag}}</a>
{{end}}
</dd>
{{end}}
{{if .Isbn}}
<dt class="col-sm-3 text-sm-end">ISBN</dt>

View file

@ -14,7 +14,12 @@
<span class="text-muted">{{if .Publisher}}{{.Publisher}}{{end}}</span>
</p>
<div class="card-text row">
<p class="col-9">{{range .Authors}}{{.}}, {{end}}</p>
<p class="col-9">
{{range $i, $author := .Authors}}
{{if $i}}<span class="text-muted">&amp;</span>{{end}}
{{$author}}</a>
{{end}}
</p>
<div class="col-3">
<div class="btn-group d-flex justify-content-end">
<a href="{{download_url .}}" class="btn btn-dark btn-sm">

View file

@ -57,7 +57,7 @@
<label class="col-form-label" for="tags">Tags</label>
</div>
<div class="col-sm-10">
<input class="form-control" type="text" id="tags" value="{{range .Tags}}{{.}},{{end}}" name="tags" placeholder="Add tag and hit enter">
<input class="form-control" type="text" id="tags" value="{{strings_join .Tags ","}}" name="tags" placeholder="Add tag and hit enter">
</div>
</div>
<br />

View file

@ -36,7 +36,7 @@
<span class="text-muted">{{if .Publisher}}{{.Publisher}}{{end}}</span>
</p>
<div class="card-text row">
<p class="col-9">{{range .Authors}}{{.}}, {{end}}</p>
<p class="col-9">{{strings_join .Authors "& "}}</p>
<div class="col-3">
<div class="btn-group d-flex justify-content-end">
<a href="/list/{{$listID}}/remove/{{.ID}}" class="btn btn-danger">

View file

@ -44,9 +44,20 @@
</p>
<div class="card-text row">
<p class="col-md-8">
{{if .Authors}}<strong>Authors:</strong> {{range .Authors}}<a href="/search/?q=author:{{.}}">{{.}}</a>, {{end}}<br />{{end}}
{{if .Authors}}<strong>Authors:</strong>
{{range $i, $author := .Authors}}
{{if $i}}&amp;{{end}}
<a href="/search/?q=author:{{$author}}">{{$author}}</a>
{{end}}
<br />{{end}}
{{if .Publisher}}<strong>Publisher:</strong> <a href="/search/?q=publisher:{{.Publisher}}">{{.Publisher}}</a><br />{{end}}
{{if .Tags}}<strong>Tags:</strong> {{range .Tags}}<a href="/search/?q=tag:{{.}}">{{.}}</a>, {{end}}<br />{{end}}
{{if .Tags}}<strong>Tags:</strong>
{{range $i, $tag := .Tags}}
{{if $i}},{{end}}
<a href="/search/?q=tag:{{$tag}}">{{$tag}}</a>
{{end}}
<br />{{end}}
{{if .Isbn}}<strong>ISBN:</strong> {{.Isbn}}<br />{{end}}
{{if .Date}}<strong>Date:</strong> {{.Date}}<br />{{end}}
{{if .Lang}}<strong>Lang:</strong> <a href="/search/?q=lang:{{.Lang}}">{{.Lang}}</a> <br />{{end}}

View file

@ -57,9 +57,20 @@
</p>
<div class="card-text row">
<p class="col-md-8">
{{if .Authors}}<strong>Authors:</strong> {{range .Authors}}<a href="/search/?q=author:{{.}}">{{.}}</a>, {{end}} <!--<small>({{$authorFound}})</small>--><br />{{end}}
{{if .Authors}}<strong>Authors:</strong>
{{range $i, $author := .Authors}}
{{if $i}}&amp;{{end}}
<a href="/search/?q=author:{{$author}}">{{$author}}</a>
{{end}}
<!--<small>({{$authorFound}})</small>--><br />{{end}}
{{if .Publisher}}<strong>Publisher:</strong> <a href="/search/?q=publisher:{{.Publisher}}">{{.Publisher}}</a><br />{{end}}
{{if .Tags}}<strong>Tags:</strong> {{range .Tags}}<a href="/search/?q=tag:{{.}}">{{.}}</a>, {{end}}<br />{{end}}
{{if .Tags}}<strong>Tags:</strong>
{{range $i, $tag := .Tags}}
{{if $i}},{{end}}
<a href="/search/?q=tag:{{$tag}}">{{$tag}}</a>
{{end}}
<br />{{end}}
{{if .Isbn}}<strong>ISBN:</strong> {{.Isbn}}<br />{{end}}
{{if .Date}}<strong>Date:</strong> {{.Date}}<br />{{end}}
{{if .Lang}}<strong>Lang:</strong> <a href="/search/?q=lang:{{.Lang}}">{{.Lang}}</a> <br />{{end}}

View file

@ -38,9 +38,20 @@
</p>
<div class="card-text row">
<p class="col-md-8">
{{if .Authors}}<strong>Authors:</strong> {{range .Authors}}<a href="/search/?q=author:{{.}}">{{.}}</a>, {{end}}<br />{{end}}
{{if .Authors}}<strong>Authors:</strong>
{{range $i, $author := .Authors}}
{{if $i}}&amp;{{end}}
<a href="/search/?q=author:{{$author}}">{{$author}}</a>
{{end}}
<br />{{end}}
{{if .Publisher}}<strong>Publisher:</strong> <a href="/search/?q=publisher:{{.Publisher}}">{{.Publisher}}</a><br />{{end}}
{{if .Tags}}<strong>Tags:</strong> {{range .Tags}}<a href="/search/?q=tag:{{.}}">{{.}}</a>, {{end}}<br />{{end}}
{{if .Tags}}<strong>Tags:</strong>
{{range $i, $tag := .Tags}}
{{if $i}},{{end}}
<a href="/search/?q=tag:{{$tag}}">{{$tag}}</a>
{{end}}
<br />{{end}}
{{if .Isbn}}<strong>ISBN:</strong> {{.Isbn}}<br />{{end}}
{{if .Date}}<strong>Date:</strong> {{.Date}}<br />{{end}}
{{if .Lang}}<strong>Lang:</strong> <a href="/search/?q=lang:{{.Lang}}">{{.Lang}}</a> <br />{{end}}