add: profiles ui, communities ui, posts ui
This commit is contained in:
parent
00abbc8fa2
commit
eecf357325
36 changed files with 1460 additions and 147 deletions
|
@ -1,13 +1,18 @@
|
|||
{% import "macros.html" as macros %} {% extends "root.html" %} {% block head %}
|
||||
{% import "macros.html" as macros %} {% import "components.html" as components
|
||||
%} {% extends "root.html" %} {% block head %}
|
||||
<title>My communities - {{ config.name }}</title>
|
||||
{% endblock %} {% block body %} {{ macros::nav(selected="communities") }}
|
||||
<main class="flex flex-col gap-2">
|
||||
{% if user %}
|
||||
<div class="card-nest">
|
||||
<div class="card">
|
||||
<div class="card small">
|
||||
<b>{{ text "communities:label.create_new" }}</b>
|
||||
</div>
|
||||
|
||||
<form class="card flex flex-col gap-2">
|
||||
<form
|
||||
class="card flex flex-col gap-2"
|
||||
onsubmit="create_community_from_form(event)"
|
||||
>
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="">{{ text "communities:label.name" }}</label>
|
||||
<input
|
||||
|
@ -26,5 +31,35 @@
|
|||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %} {% for item in list %} {{
|
||||
components::community_listing_card(community=item) }} {% endfor %}
|
||||
</main>
|
||||
|
||||
<script>
|
||||
function create_community_from_form(e) {
|
||||
e.preventDefault();
|
||||
fetch("/api/v1/communities", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: e.target.title.value,
|
||||
}),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger("atto::toast", [
|
||||
res.ok ? "success" : "error",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
if (res.ok) {
|
||||
setTimeout(() => {
|
||||
window.location.href = `/community/${res.payload}`;
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue