2025-06-01 12:25:33 -04:00
( text "{% extends \"root.html\" %} {% block head %}" )
( title
( text "My communities - {{ config.name }}" ) )
( text "{% endblock %} {% block body %} {{ macros::nav(selected=\"communities\") }}" )
( main
2025-08-03 23:24:57 -04:00
( "class" "flex flex_col gap_2" )
2025-06-01 12:25:33 -04:00
( text "{% if user -%}" )
( div
2025-08-03 23:24:57 -04:00
( "class" "card_nest" )
2025-06-01 12:25:33 -04:00
( div
( "class" "card small" )
( b
( text "{{ text \"communities:label.create_new\" }}" ) ) )
( form
2025-08-03 23:24:57 -04:00
( "class" "card flex flex_col gap_2" )
2025-06-01 12:25:33 -04:00
( "onsubmit" "create_community_from_form(event)" )
( div
2025-08-03 23:24:57 -04:00
( "class" "flex flex_col gap_1" )
2025-06-01 12:25:33 -04:00
( label
( "for" "title" )
( text "{{ text \"communities:label.name\" }}" ) )
( input
( "type" "text" )
( "name" "title" )
( "id" "title" )
( "placeholder" "name" )
( "required" "" )
( "minlength" "2" )
( "maxlength" "32" ) ) )
2025-08-03 23:24:57 -04:00
( label
( "for" "is_forum" )
( "class" "flex items_center gap_2" )
( input
( "type" "checkbox" )
( "id" "is_forum" )
( "name" "is_forum" )
( "class" "w_content" ) )
( span
( text "Is forum" ) ) )
2025-06-01 12:25:33 -04:00
( button
( text "{{ text \"communities:action.create\" }}" ) ) ) )
( text "{% if list|length >= 4 -%} {{ components::supporter_ad(body=\"Become a supporter to create up to 10 communities!\") }} {%- endif %} {%- endif %}" )
( div
2025-08-03 23:24:57 -04:00
( "class" "card_nest w_full" )
2025-06-01 12:25:33 -04:00
( div
2025-08-03 23:24:57 -04:00
( "class" "card small flex items_center justify_between gap_2" )
2025-06-01 12:25:33 -04:00
( div
2025-08-03 23:24:57 -04:00
( "class" "flex items_center gap_2" )
2025-06-01 12:25:33 -04:00
( text "{{ icon \"award\" }}" )
( span
( text "{{ text \"communities:label.my_communities\" }}" ) ) )
2025-06-10 22:12:22 -04:00
( div
2025-08-03 23:24:57 -04:00
( "class" "flex items_center gap_2" )
2025-06-10 22:12:22 -04:00
( a
( "href" "/forges" )
2025-06-12 13:53:23 -04:00
( "class" "button lowered small" )
2025-06-10 22:12:22 -04:00
( text "{{ icon \"anvil\" }}" )
( span
( "class" "desktop" )
( text "{{ text \"forge:label.my_forges\" }}" ) ) )
( a
( "href" "/communities/search" )
2025-06-12 13:53:23 -04:00
( "class" "button lowered small" )
2025-06-10 22:12:22 -04:00
( text "{{ icon \"search\" }}" )
( span
( "class" "desktop" )
( text "{{ text \"communities:label.join_new\" }}" ) ) ) ) )
2025-06-01 12:25:33 -04:00
( div
2025-08-03 23:24:57 -04:00
( "class" "card flex flex_col gap_2" )
2025-06-01 12:25:33 -04:00
( text "{% for item in list %} {{ components::community_listing_card(community=item) }} {% endfor %}" ) ) )
( div
2025-08-03 23:24:57 -04:00
( "class" "card_nest w_full" )
2025-06-01 12:25:33 -04:00
( div
2025-08-03 23:24:57 -04:00
( "class" "card small flex items_center gap_2" )
2025-06-01 12:25:33 -04:00
( text "{{ icon \"trending-up\" }}" )
( span
( text "{{ text \"communities:label.popular_communities\" }}" ) ) )
( div
2025-08-03 23:24:57 -04:00
( "class" "card flex flex_col gap_2" )
2025-06-01 12:25:33 -04:00
( text "{% for item in popular_list %} {{ components::community_listing_card(community=item) }} {% endfor %}" ) ) ) )
( script
( text " async function create_community_from_form ( e ) {
e.preventDefault ( ) ;
await trigger ( \"atto::debounce\", [\"communities::create\"] ) ;
fetch ( \"/api/v1/communities\", {
method: \"POST\",
headers: {
\"Content-Type\": \"application/json\",
},
body: JSON.stringify ( {
title: e.target.title.value,
2025-08-03 23:24:57 -04:00
forum: e.target.is_forum.checked,
2025-06-01 12:25:33 -04:00
} ) ,
} )
. then ( ( res ) => res.json ( ) )
. then ( ( res ) => {
trigger ( \"atto::toast\", [
res.ok ? \"success\" : \"error\",
res.message,
] ) ;
if ( res.ok ) {
2025-06-14 14:45:52 -04:00
e.target.reset ( ) ;
2025-06-01 12:25:33 -04:00
setTimeout ( ( ) => {
window.location.href = ` /community/${res.payload} ` ;
}, 100 ) ;
}
} ) ;
} " ) )
( text "{% endblock %}" )