Skip to content

Commit 599c81d

Browse files
committed
Fixed download button and quick email not working, updated readme
1 parent 853afb1 commit 599c81d

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Diff for: README.md

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ Binaries for Windows 64 bit, Linux 32 and 64 bits for both X86 and ARM (Raspberr
2727
### Building from source
2828
Coreander's only requirement is Go 1.21.
2929

30+
When cloning Coreander's repository, use Git's `--recurse-submodules` flag to also retrieve `foliate-js` contents as well, which is required for the reader component:
31+
32+
```
33+
git clone [email protected]:svera/coreander.git --recurse-submodules
34+
```
35+
3036
There are two possibilities for building Coreander from source:
3137
* If you have [Mage](https://magefile.org) installed in your system, just type `mage install` from the source code folder.
3238
* Otherwise, a simple `go build` or `go install` will do, although no version information will be added to the executable.

Diff for: internal/webserver/embedded/views/partials/actions.html

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<div class="d-grid gap-2 mx-auto d-md-flex justify-content-md-center actions mb-3">
22
{{if eq .Document.Format "EPUB"}}
33
<div class="btn-group mb-1 flex-md-fill" role="group" aria-label="Button group with nested dropdown">
4-
<button href="/documents/{{.Document.Slug}}/download" class="btn btn-sm btn-outline-secondary w-100" download title='{{t .Lang "Download"}}'>
4+
<a href="/documents/{{.Document.Slug}}/download" class="btn btn-sm btn-outline-secondary w-100" download title='{{t .Lang "Download"}}'>
55
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cloud-download" viewBox="0 0 16 16">
66
<path d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"/>
77
<path d="M7.646 15.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 14.293V5.5a.5.5 0 0 0-1 0v8.793l-2.146-2.147a.5.5 0 0 0-.708.708l3 3z"/>
88
</svg>
99
&nbsp;
1010
<span class='badge text-bg-{{if eq .Document.Format "EPUB"}}primary{{else}}danger{{end}}'>{{.Document.Format}}</span>
11-
</button>
11+
</a>
1212
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"></button>
1313
<ul class="dropdown-menu dropdown-menu-end">
1414
<li>
@@ -24,14 +24,14 @@
2424
</ul>
2525
</div>
2626
{{else}}
27-
<button href="/documents/{{.Document.Slug}}/download" class="btn btn-sm btn-outline-secondary mb-1 flex-md-fill" download title='{{t .Lang "Download"}}'>
27+
<a href="/documents/{{.Document.Slug}}/download" class="btn btn-sm btn-outline-secondary mb-1 flex-md-fill" download title='{{t .Lang "Download"}}'>
2828
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cloud-download" viewBox="0 0 16 16">
2929
<path d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"/>
3030
<path d="M7.646 15.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 14.293V5.5a.5.5 0 0 0-1 0v8.793l-2.146-2.147a.5.5 0 0 0-.708.708l3 3z"/>
3131
</svg>
3232
&nbsp;
3333
<span class='badge text-bg-danger'>{{.Document.Format}}</span>
34-
</button>
34+
</a>
3535
{{end}}
3636

3737
{{if .EmailSendingConfigured}}
@@ -40,14 +40,15 @@
4040
{{if .Session}}{{$sendToEmail = .Session.SendToEmail}}{{end}}
4141
{{if not $sendToEmail}}{{$disabled = true}}{{end}}
4242
<div class="btn-group mb-1 flex-md-fill" role="group" aria-label="Button group with nested dropdown">
43-
<button hx-post="/documents/{{.Document.Slug}}/send" hx-swap="none" hx-include="[name='email'], [name='slug']" hx-indicator="#hx-spinner-{{.Document.Slug}}" class="btn btn-sm btn-outline-secondary w-100" {{if $disabled}}disabled{{end}} {{if $sendToEmail}}title='{{t .Lang "Send to %s" $sendToEmail}}'{{end}} data-error-message='{{t .Lang "There was an error sending %s to ${email}, please try again later" .Document.Title}}' data-success-message='{{t .Lang "%s sent to ${email}" .Document.Title}}'>
43+
<button hx-post="/documents/{{.Document.Slug}}/send" hx-swap="none" hx-include="[id='quick-email-{{.Document.Slug}}'], [id='slug-{{.Document.Slug}}']" hx-indicator="#hx-spinner-{{.Document.Slug}}" class="btn btn-sm btn-outline-secondary w-100" {{if $disabled}}disabled{{end}} {{if $sendToEmail}}title='{{t .Lang "Send to %s" $sendToEmail}}'{{end}} data-error-message='{{t .Lang "There was an error sending %s to ${email}, please try again later" .Document.Title}}' data-success-message='{{t .Lang "%s sent to ${email}" .Document.Title}}'>
4444
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope-fill" viewBox="0 0 16 16">
4545
<path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555ZM0 4.697v7.104l5.803-3.558L0 4.697ZM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757Zm3.436-.586L16 11.801V4.697l-5.803 3.546Z"/>
4646
</svg>
4747
<span id="hx-spinner-{{.Document.Slug}}" class="spinner-border spinner-border-sm htmx-indicator" aria-hidden="true"></span>
4848
</button>
49-
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
50-
</button>
49+
<input type="hidden" name="email" id="quick-email-{{.Document.Slug}}" value="{{$sendToEmail}}" />
50+
<input type="hidden" name="slug" id="slug-{{.Document.Slug}}" value="{{.Document.Slug}}" />
51+
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false"></button>
5152
<ul class="dropdown-menu dropdown-menu-end p-3">
5253
<li>
5354
<form hx-post="/documents/{{.Document.Slug}}/send" hx-swap="none" hx-indicator="#hx-spinner-{{.Document.Slug}}" data-error-message='{{t .Lang "There was an error sending %s to ${email}, please try again later" .Document.Title }}' data-success-message='{{t .Lang "%s sent to ${email}" .Document.Title }}' class="send-email mt-3">

0 commit comments

Comments
 (0)