2025-03-29 00:26:56 -04:00
|
|
|
{% import "macros.html" as macros %} {% import "components.html" as components
|
|
|
|
%} {% extends "root.html" %} {% block head %}
|
|
|
|
<title>{{ community.context.display_name }} - {{ config.name }}</title>
|
|
|
|
{% endblock %} {% block body %} {{ macros::nav() }}
|
|
|
|
<article>
|
|
|
|
<div class="content_container">
|
|
|
|
<div class="w-full flex gap-4 flex-collapse">
|
|
|
|
<div
|
|
|
|
class="lhs flex flex-col gap-2 sm:w-full"
|
|
|
|
style="min-width: 20rem"
|
|
|
|
>
|
|
|
|
<div class="card-nest w-full">
|
|
|
|
<div class="card flex gap-2" id="community_avatar_and_name">
|
|
|
|
{{
|
|
|
|
components::community_avatar(id=community.id,size="72px")
|
|
|
|
}}
|
|
|
|
<div class="flex flex-col">
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
<h3 id="title" class="title">
|
|
|
|
{% if community.context.display_name %}
|
|
|
|
{{ community.context.display_name }}
|
|
|
|
{% else %}
|
|
|
|
{{ community.username }}
|
|
|
|
{% endif %}
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<span class="fade">{{ community.title }}</span>
|
2025-03-29 22:27:57 -04:00
|
|
|
|
|
|
|
{% if user %}
|
|
|
|
<div
|
|
|
|
class="flex gap-1 reactions_box"
|
|
|
|
hook="check_reactions"
|
|
|
|
hook-arg:id="{{ community.id }}"
|
|
|
|
>
|
|
|
|
{{ components::likes(id=community.id,
|
|
|
|
asset_type="Community", likes=community.likes,
|
|
|
|
dislikes=community.dislikes) }}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2025-03-29 00:26:56 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if user %}
|
|
|
|
<div class="card flex" id="join_or_leave">
|
|
|
|
{% if not is_owner %} {% if not is_member %}
|
|
|
|
<button class="primary">
|
|
|
|
{{ icon "circle-plus" }}
|
|
|
|
<span>{{ text "communities:action.join" }}</span>
|
|
|
|
</button>
|
|
|
|
{% else %}
|
|
|
|
<button class="camo red">
|
|
|
|
{{ icon "circle-minus" }}
|
|
|
|
<span>{{ text "communities:action.leave" }}</span>
|
|
|
|
</button>
|
|
|
|
{% endif %} {% else %}
|
2025-03-29 22:27:57 -04:00
|
|
|
<button
|
|
|
|
href="/community/{{ community.title }}"
|
2025-03-29 00:26:56 -04:00
|
|
|
class="button primary"
|
2025-03-29 22:27:57 -04:00
|
|
|
onclick="document.getElementById('manage').showModal()"
|
2025-03-29 00:26:56 -04:00
|
|
|
>
|
|
|
|
{{ icon "settings" }}
|
|
|
|
<span
|
|
|
|
>{{ text "communities:action.configure" }}</span
|
|
|
|
>
|
2025-03-29 22:27:57 -04:00
|
|
|
</button>
|
|
|
|
|
|
|
|
<dialog id="manage">
|
|
|
|
<div class="inner">
|
|
|
|
<div
|
|
|
|
id="manage_fields"
|
|
|
|
class="flex flex-col gap-2"
|
|
|
|
></div>
|
|
|
|
|
|
|
|
<hr class="margin" />
|
|
|
|
|
|
|
|
<button
|
|
|
|
onclick="document.getElementById('manage').close(); save_context()"
|
|
|
|
>
|
|
|
|
{{ icon "check" }}
|
|
|
|
<span
|
|
|
|
>{{ text "dialog:action.save_and_close"
|
|
|
|
}}</span
|
|
|
|
>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</dialog>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
setTimeout(() => {
|
|
|
|
const ui = ns("ui");
|
|
|
|
const settings = JSON.parse(
|
|
|
|
"{{ community_context_serde|safe }}",
|
|
|
|
);
|
|
|
|
|
|
|
|
ui.generate_settings_ui(
|
|
|
|
document.getElementById("manage_fields"),
|
|
|
|
[
|
|
|
|
[
|
|
|
|
["display_name", "Title"],
|
|
|
|
"{{ community.context.display_name }}",
|
|
|
|
"input",
|
|
|
|
],
|
|
|
|
[
|
|
|
|
["description", "Description"],
|
|
|
|
"{{ community.context.description }}",
|
|
|
|
"textarea",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
window.save_context = () => {
|
|
|
|
fetch(
|
|
|
|
`/api/v1/communities/{{ community.id }}/context`,
|
|
|
|
{
|
|
|
|
method: "POST",
|
|
|
|
headers: {
|
|
|
|
"Content-Type":
|
|
|
|
"application/json",
|
|
|
|
},
|
|
|
|
body: JSON.stringify({
|
|
|
|
context: settings,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
)
|
|
|
|
.then((res) => res.json())
|
|
|
|
.then((res) => {
|
|
|
|
trigger("atto::toast", [
|
|
|
|
res.ok ? "success" : "error",
|
|
|
|
res.message,
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}, 250);
|
|
|
|
</script>
|
2025-03-29 00:26:56 -04:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card-nest flex flex-col">
|
|
|
|
<div id="bio" class="card small">
|
2025-03-29 22:27:57 -04:00
|
|
|
{{ community.context.description|markdown|safe }}
|
2025-03-29 00:26:56 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card flex flex-col gap-2">
|
|
|
|
<div class="w-full flex justify-between items-center">
|
|
|
|
<span class="notification chip">ID</span>
|
|
|
|
<button
|
|
|
|
title="Copy"
|
|
|
|
onclick="trigger('atto::copy_text', [{{ community.id }}])"
|
|
|
|
class="camo small"
|
|
|
|
>
|
|
|
|
{{ icon "copy" }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="w-full flex justify-between items-center">
|
|
|
|
<span class="notification chip">Created</span>
|
|
|
|
<span class="date">{{ community.created }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="rhs w-full">{% block content %}{% endblock %}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
{% endblock %}
|