Merge pull request 'Instance about pages' (#139) from rscmbbng/pyfedi:main into main

Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/139
This commit is contained in:
rimu 2024-04-01 21:42:13 +00:00
commit df3f2fe2b8
3 changed files with 43 additions and 0 deletions

View file

@ -229,6 +229,23 @@ def list_subscribed_communities():
def donate(): def donate():
return render_template('donate.html') return render_template('donate.html')
@bp.route('/about')
def about_page():
users = User.query.filter_by(ap_id=None, deleted=False, banned=False).all()
user_amount = len(users)
# Todo, figure out how to filter the user list with the list of user_role user_id == 4
#admins = users.filter()
# Todo, figure out how to filter the user list with the list of user_role user_id == 4
#staff = users.filter()
domains_amount = len(Domain.query.filter_by(banned=False).all())
community_amount = len(Community.query.all())
instance = Instance.query.filter_by(id=1).first()
return render_template('about.html', user_amount=user_amount, domains_amount=domains_amount, community_amount=community_amount, instance=instance)#, admins=admins)
@bp.route('/privacy') @bp.route('/privacy')
def privacy(): def privacy():

24
app/templates/about.html Normal file
View file

@ -0,0 +1,24 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
{% block app_content %}
<div class="row">
<div class="col-12 col-md-8 position-relative main_pane">
<h1>{{ _('About %(site_name)s', site_name=g.site.name) }}</h1>
<p> {{g.site.name}} is a <a href="https://join.piefed.social/">pyfedi</a> instance created on {{instance.created_at}}. It is home to <a href="/people">{{user_amount}} users</a>, <a href="/communities/local"> {{community_amount}} communities</a> who discussed <a href="/domains">{{domains_amount}} domains</a>. This instance is administerred and staffed by $PLACEHOLDER_ADMINS and $PLACEHOLDER_STAFF.</p>
<h2>Contact</h2>
<p>Placeholder Admin email</p>
<h2> About Us </h2>
<p> {{g.site.description | safe}} </p>
<p> {{g.site.sidebar}} </p>
{% if g.site.legal_information %}
<h2> Legal Information </h2>
<p> {{g.site.legal_information}} </p>
<p> <a href="/privacy"> Our Privacy Policy </a> </p>
{% endif %}
</div>
{% endblock %}

View file

@ -157,12 +157,14 @@
<li><a class="dropdown-item{% if active_child == 'list_communities' %} active{% endif %}" href="/topics">{{ _('Browse by topic') }}</a></li> <li><a class="dropdown-item{% if active_child == 'list_communities' %} active{% endif %}" href="/topics">{{ _('Browse by topic') }}</a></li>
<li><a class="dropdown-item{% if active_child == 'list_topics' %} active{% endif %}" href="/communities">{{ _('All communities') }}</a></li> <li><a class="dropdown-item{% if active_child == 'list_topics' %} active{% endif %}" href="/communities">{{ _('All communities') }}</a></li>
{% if moderating_communities %} {% if moderating_communities %}
<li><hr class="dropdown-divider"></li>
<li><h6 class="dropdown-header">{{ _('Moderating') }}</h6></li> <li><h6 class="dropdown-header">{{ _('Moderating') }}</h6></li>
{% for community_menu_item in moderating_communities %} {% for community_menu_item in moderating_communities %}
<li class="pl-2"><a class="dropdown-item{% if community and community.id == community_menu_item.id%} active{% endif %}" href="/c/{{ community_menu_item.link() }}">{{ community_menu_item.title }}</a></li> <li class="pl-2"><a class="dropdown-item{% if community and community.id == community_menu_item.id%} active{% endif %}" href="/c/{{ community_menu_item.link() }}">{{ community_menu_item.title }}</a></li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if joined_communities %} {% if joined_communities %}
<li><hr class="dropdown-divider"></li>
<li><h6 class="dropdown-header">{{ _('Joined communities') }}</h6></li> <li><h6 class="dropdown-header">{{ _('Joined communities') }}</h6></li>
{% for community_menu_item in joined_communities %} {% for community_menu_item in joined_communities %}
<li class="pl-2"><a class="dropdown-item{% if community and community.id == community_menu_item.id%} active{% endif %}" href="/c/{{ community_menu_item.link() }}">{{ community_menu_item.title }}</a></li> <li class="pl-2"><a class="dropdown-item{% if community and community.id == community_menu_item.id%} active{% endif %}" href="/c/{{ community_menu_item.link() }}">{{ community_menu_item.title }}</a></li>