Skip to content
Snippets Groups Projects
Verified Commit 6a7084e3 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

feat: improve pagination and uploading

parent 5531e3b6
No related branches found
No related tags found
No related merge requests found
Pipeline #2723 passed
......@@ -58,14 +58,16 @@ element.addEventListener("change", () => {
});
image_container.classList.remove("uploading");
if (response.ok) {
image_link.href = "/" + json.id + ".png";
image.src = "/" + json.id + ".png";
const data = await response.json();
image_link.href = "/" + data.id + ".png";
image.src = "/" + data.id + ".png";
} else {
const data = await response.json();
const image_error = document.createElement("div");
image_error.classList.add("alert", "error");
image_error.innerText = JSON.stringify(json.errors);
image_error.innerText = JSON.stringify(data.errors);
image_container.insertBefore(image_error, image_description);
console.log(json);
console.log(data);
}
});
reader.readAsDataURL(file);
......
......@@ -26,14 +26,17 @@
<ul class="pagination">
<li class="page">
{{- if lt 0 .Previous -}}
<a class="button" href="/me/images/{{- .Previous -}}">Previous page</a>
<a class="button" href="/me/images/1">First</a>
<a class="button" href="/me/images/{{- .Previous -}}">Previous</a>
{{- else -}}
<a class="button" aria-disabled="true">Previous page</a>
<a class="button" aria-disabled="true">First</a>
<a class="button" aria-disabled="true">Previous</a>
{{- end -}}
</li>
<li class="page current">Page {{ .Current }}</li>
<li class="page">
<a class="button" href="/me/images/{{- .Next -}}">Next page</a>
<a class="button" href="/me/images/{{- .Next -}}">Next</a>
<a class="button" aria-disabled="true">Last</a>
</li>
</ul>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment