librapi/templates/home.html.tpl
2025-01-07 11:53:14 +01:00

48 lines
1.6 KiB
Smarty

{{ define "content" }}
<h3>A simple API to store, search and download books, articles, etc...</h3>
<div>No extra JS, CSS or fancy stuff. You click, you search, you found, you're happy.</div>
<form action="/home" method="post" enctype="multipart/form-data">
<div class="main-container">
<div class="form-item">
<div class="form-container">
<h4>Search</h4>
</div>
<div class="form-container">
<input type="text" name="search" value="{{.Search.Value}}" />
</div>
{{ if .Search.Err }}
<div class="error">{{.Search.Err}}</div>
{{ end }}
</div>
<div class="form-item">
<div class="form-container">
<button id="submit" type="submit">Search</button>
</div>
</div>
</div>
</form>
{{ if ne (errStr .Error) "" }}
<div class="error">{{.Error | errStr}}</div>
{{ end }}
<table>
<tr>
<th>Name</th>
<th>Description</th>
<th>Editor</th>
<th>Authors</th>
<th>Year</th>
</tr>
{{range .Results}}
<tr>
<td><div style="margin: 10px; word-wrap: break-word; width: 300px;">{{.Name}}</div></td>
<td><div style="margin: 10px; word-wrap: break-word; width: 300px;">{{.Description | noDesc}}</div></td>
<td style="text-align: center;"><div style="margin: 10px;">{{.Editor}}</div></td>
<td style="text-align: center; word-wrap: break-word; width: 300px;"><div style="margin: 10px;">{{.Authors | join }}</div></td>
<td><div style="margin: 20px;">{{.Year}}</div></td>
<td><div style="margin: 20px;"><a target="_blank" href="{{.Path | bookUrl}}">Download</a></div></td>
</tr>
{{ end }}
</table>
</ul>
{{ end }}