mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
instance contact email interface, forms and display on about page
This commit is contained in:
parent
a4f0899e68
commit
2bf9b4a8c8
4 changed files with 8 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
from flask_wtf import FlaskForm
|
||||
from flask_wtf.file import FileRequired, FileAllowed
|
||||
from sqlalchemy import func
|
||||
from wtforms import StringField, PasswordField, SubmitField, HiddenField, BooleanField, TextAreaField, SelectField, \
|
||||
from wtforms import StringField, PasswordField, SubmitField, EmailField, HiddenField, BooleanField, TextAreaField, SelectField, \
|
||||
FileField, IntegerField
|
||||
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo, Length, Optional
|
||||
from flask_babel import _, lazy_gettext as _l
|
||||
|
@ -17,6 +17,7 @@ class SiteProfileForm(FlaskForm):
|
|||
])
|
||||
sidebar = TextAreaField(_l('Sidebar'))
|
||||
legal_information = TextAreaField(_l('Legal information'))
|
||||
contact_email = EmailField(_l('General instance contact email address'), validators=[Email(), DataRequired(), Length(min=5, max=255)])
|
||||
submit = SubmitField(_l('Save'))
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ def admin_site():
|
|||
site.sidebar = form.sidebar.data
|
||||
site.legal_information = form.legal_information.data
|
||||
site.updated = utcnow()
|
||||
site.contact_email = form.contact_email.data
|
||||
if site.id is None:
|
||||
db.session.add(site)
|
||||
db.session.commit()
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
<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>
|
||||
<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>
|
||||
<h2>Contact</h2>
|
||||
<p>$PLACEHOLDER_EMAIL</p>
|
||||
<p>{{g.site.contact_email | safe }}</p>
|
||||
<h2> About Us </h2>
|
||||
<p> {{g.site.description | safe}} </p>
|
||||
<p> {{g.site.sidebar}} </p>
|
||||
<p> {{g.site.description | safe }} </p>
|
||||
<p> {{g.site.sidebar | safe }} </p>
|
||||
{% if g.site.legal_information %}
|
||||
<h2> Legal Information </h2>
|
||||
<p> {{g.site.legal_information}} </p>
|
||||
<p> {{g.site.legal_information | safe }} </p>
|
||||
<p> <a href="/privacy"> Our Privacy Policy </a> </p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<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) }}
|
||||
{{ render_field(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue