home ยป zplus/freepost.git
ID: a92764793b81191dcec57fc1e68499b0522472cb
26 lines โ€” 1K โ€” View raw


{% extends 'layout.html' %}

{# Set variables for base layour #}
{% set active_page = "communities" %}
{% set title = 'List of communities' %}

{% block content %}

    {% for community in communities|sort(attribute="name")|sort(attribute="members_count", reverse=True) %}
        <p>
            <div><a href="{{ url('community', cmty=community['name']) }}" title="{{ community['members_count'] }} members">{{ community["name"] }} ({{ community['members_count'] }} ๐Ÿ‘ค)</a></div>
            <div>{{ community["description"] }}</div>
        </p>
    {% endfor %}

    <br /><br />

    {% if user %}
    {# onkeydown="" prevents submitting the form by pressing Enter (user must click submit button) #}
    <form action="{{ url('communities') }}" method="post" onkeydown="return event.key != 'Enter';">
        <input type="text" class="form-control form-control-inline" name="community_name" placeholder="community name" required minlength="3" maxlength="100" pattern="[^\s]+" />
        <input type="submit" class="button button_info" value="Create new community" />
    </form>
    {% endif %}

{% endblock %}