mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
Merge pull request 'Adding another longer text field for site profile + changes and bugfixes to about page' (#166) from rscmbbng/pyfedi:main into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/166
This commit is contained in:
commit
20e5ed50cc
6 changed files with 53 additions and 4 deletions
|
@ -10,14 +10,15 @@ from app.models import Community, User
|
|||
|
||||
|
||||
class SiteProfileForm(FlaskForm):
|
||||
name = StringField(_l('Name'))
|
||||
name = StringField(_l('Site Name'))
|
||||
description = StringField(_l('Tagline'))
|
||||
icon = FileField(_('Icon'), validators=[
|
||||
FileAllowed(['jpg', 'jpeg', 'png', 'webp'], 'Images only!')
|
||||
])
|
||||
sidebar = TextAreaField(_l('Sidebar'))
|
||||
about = TextAreaField(_l('About'))
|
||||
legal_information = TextAreaField(_l('Legal information'))
|
||||
contact_email = EmailField(_l('General instance contact email address'), validators=[Email(), DataRequired(), Length(min=5, max=255)])
|
||||
contact_email = EmailField(_l('General instance contact email address'), validators=[DataRequired(), Length(min=5, max=255)])
|
||||
submit = SubmitField(_l('Save'))
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ def admin_site():
|
|||
site = Site()
|
||||
if form.validate_on_submit():
|
||||
site.name = form.name.data
|
||||
site.description = form.description.data
|
||||
site.description = form.description.data #tagline
|
||||
site.about = form.about.data
|
||||
site.sidebar = form.sidebar.data
|
||||
site.legal_information = form.legal_information.data
|
||||
site.updated = utcnow()
|
||||
|
@ -56,8 +57,10 @@ def admin_site():
|
|||
elif request.method == 'GET':
|
||||
form.name.data = site.name
|
||||
form.description.data = site.description
|
||||
form.about.data = site.about
|
||||
form.sidebar.data = site.sidebar
|
||||
form.legal_information.data = site.legal_information
|
||||
form.contact_email.data = site.contact_email
|
||||
return render_template('admin/site.html', title=_('Site profile'), form=form,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id()),
|
||||
|
|
|
@ -1332,6 +1332,7 @@ class Site(db.Model):
|
|||
log_activitypub_json = db.Column(db.Boolean, default=False)
|
||||
default_theme = db.Column(db.String(20), default='')
|
||||
contact_email = db.Column(db.String(255), default='')
|
||||
about = db.Column(db.Text, default='')
|
||||
|
||||
@staticmethod
|
||||
def admins() -> List[User]:
|
||||
|
|
|
@ -11,12 +11,18 @@
|
|||
<p> {{g.site.name}} is a <a href="https://join.piefed.social/">pyfedi</a> instance created on {{instance.created_at.strftime('%d-%m-%Y')}}. It is home to <a href="/people">{{user_amount}} users</a> (of which {{mau}} active in the last month). In the <a href="/communities/local"> {{community_amount}} communities</a> we discussed <a href="/domains">{{domains_amount}} domains</a> and made {{posts_amount}} posts.</p>
|
||||
<h2> Team </h2>
|
||||
<p>This instance is administerred by {% for admin in admins %}<a href="/u/{{ admin.user_name }}">{{ admin.user_name }}</a>{{ ", " if not loop.last }}{% endfor %}.</p>
|
||||
{% if staff %}
|
||||
<p>It is moderated by {% for s in staff %}<a href="/u/{{ s.user_name }}">{{ s.user_name }}</a>{{ ", " if not loop.last }}{% endfor %}.</p>
|
||||
{% endif %}
|
||||
<h2>Contact</h2>
|
||||
<p>{{g.site.contact_email | safe }}</p>
|
||||
<h2> About Us </h2>
|
||||
<p> {{g.site.description | safe }} </p>
|
||||
{% if g.site.about %}
|
||||
<p> {{g.site.about | safe }} </p>
|
||||
{% elif g.site.sidebar %}
|
||||
<p> {{g.site.sidebar | safe }} </p>
|
||||
{% endif %}
|
||||
{% if g.site.legal_information %}
|
||||
<h2> Legal Information </h2>
|
||||
<p> {{g.site.legal_information | safe }} </p>
|
||||
|
|
|
@ -13,11 +13,17 @@
|
|||
<h1>{{ _('Site profile') }}</h1>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{{ form.csrf_token() }}
|
||||
<p>{{ _('Configure the flair the instance, by giving it a name, ashort slogan, basic info for the sidebar and a logo. This information appears in link previews in social media.') }}</p>
|
||||
{{ render_field(form.name) }}
|
||||
{{ render_field(form.description) }}
|
||||
{{ render_field(form.icon) }}
|
||||
{{ render_field(form.sidebar) }}
|
||||
<p class="small field_hint">HTML is allowed in this field.</p>
|
||||
{{ render_field(form.icon) }}
|
||||
|
||||
<h2>{{ _('About this instance') }}</h2>
|
||||
<p>{{ _('Provide a more extensive description of the instance, set a contact address and provide legal information. This information appears on the <a href="/about">about</a> page.') }}</p>
|
||||
{{ render_field(form.about) }}
|
||||
<p class="small field_hint">HTML is allowed in this field.</p>
|
||||
{{ render_field(form.legal_information) }}
|
||||
<p class="small field_hint">HTML is allowed in this field.</p>
|
||||
{{ render_field(form.contact_email) }}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
"""long instance about field
|
||||
|
||||
Revision ID: 46c170499e71
|
||||
Revises: 7aee4cb7db24
|
||||
Create Date: 2024-04-22 18:28:51.826149
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '46c170499e71'
|
||||
down_revision = '7aee4cb7db24'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('site', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('about', sa.Text(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('site', schema=None) as batch_op:
|
||||
batch_op.drop_column('about')
|
||||
|
||||
# ### end Alembic commands ###
|
Loading…
Add table
Reference in a new issue