Cleanup of tests to push into live system

This commit is contained in:
Inga Kirschnick 2023-01-12 09:25:58 +01:00
parent 632aab258b
commit f1b9680764
6 changed files with 25 additions and 20 deletions

View File

@ -1,6 +1,6 @@
<ul class="sidenav sidenav-fixed" id="sidenav">
<li>
<div class="user-view">
<div class="user-view" style="padding-top: 8px;">
<div class="background primary-color"></div>
<div class="row">
<div class="col s2">
@ -20,7 +20,7 @@
<li><a href="{{ url_for('main.dashboard') }}"><i class="material-icons">dashboard</i>Dashboard</a></li>
<li><a href="{{ url_for('main.dashboard', _anchor='corpora') }}" style="padding-left: 47px;"><i class="nopaque-icons">I</i>My Corpora</a></li>
<li><a href="{{ url_for('main.dashboard', _anchor='jobs') }}" style="padding-left: 47px;"><i class="nopaque-icons">J</i>My Jobs</a></li>
<li><a href="{{ url_for('main.dashboard', _anchor='social') }}" style="padding-left: 47px;"><i class="material-icons">groups</i>Social</a></li>
{# <li><a href="{{ url_for('main.dashboard', _anchor='social') }}" style="padding-left: 47px;"><i class="material-icons">groups</i>Social</a></li> #}
<li><a href="{{ url_for('contributions.contributions') }}"><i class="material-icons">new_label</i>Contribute</a></li>
<li><div class="divider"></div></li>
<li><a class="subheader">Processes & Services</a></li>

View File

@ -42,7 +42,7 @@
</div>
</div>
</div>
<div class="col s12" id="social">
{# <div class="col s12" id="social">
<h3>Social</h3>
<div class="card">
<div class="card-content">
@ -57,16 +57,10 @@
<p>Find public corpora</p>
</div>
</div>
</div>
</div> #}
<div class="fixed-action-btn direction-top active" style="bottom:45px; right:24px;">
<a id="news-feature-discovery" class="waves-effect waves-light btn btn-floating"><i class="material-icons">mail</i></a>
</div>
<div class="tap-target" data-target="news-feature-discovery" style="background-color:#1A5C89">
<div class="tap-target-content">
<h5>Title</h5>
<p>A bunch of text</p>
</div>
</div>
</div>
</div>
{% endblock page_content %}
@ -122,10 +116,10 @@
</div>
{% endblock modals %}
{% block scripts %}
{# {% block scripts %}
{{ super() }}
<script>
let publicUserList = new PublicUserList(document.querySelector('.public-user-list'));
publicUserList.add({{ users|tojson }});
</script>
{% endblock scripts %}
{% endblock scripts %} #}

View File

@ -83,7 +83,7 @@
</div>
</div>
<div class="col s10">
{{ wtf.render_field(edit_public_profile_information_form.avatar, accept='image/jpeg, image/png, image/gif', placeholder='Choose an image file', id='avatar-upload', data_action='disable') }}
{{ wtf.render_field(edit_public_profile_information_form.avatar, accept='image/jpeg, image/png, image/gif', placeholder='Choose an image file', id='avatar-upload') }}
</div>
</div>
</div>

View File

@ -91,7 +91,7 @@
</div>
</div>
</div>
<div class="row">
{# <div class="row">
<div class="col s6">
<div class="card">
<div class="card-content">
@ -103,11 +103,11 @@
<div class="card">
<div class="card-content">
<h4>Public corpora</h4>
{# <div class="public-corpora-list" data-user-id="{{ user.hashid }}"></div> #}
<div class="public-corpora-list" data-user-id="{{ user.hashid }}"></div>
</div>
</div>
</div>
</div>
</div> #}
</div>
{% endblock page_content %}

View File

@ -8,23 +8,24 @@ from wtforms import (
ValidationError
)
from wtforms.validators import (
InputRequired,
DataRequired,
Email,
Length,
Regexp
)
from app.models import User
from app.auth import USERNAME_REGEX
from app.wtf_validators import FileSizeLimit
class EditProfileSettingsForm(FlaskForm):
email = StringField(
'E-Mail',
validators=[InputRequired(), Length(max=254), Email()]
validators=[DataRequired(), Length(max=254), Email()]
)
username = StringField(
'Username',
validators=[
InputRequired(),
DataRequired(),
Length(max=64),
Regexp(
USERNAME_REGEX,
@ -53,7 +54,8 @@ class EditProfileSettingsForm(FlaskForm):
class EditPublicProfileInformationForm(FlaskForm):
avatar = FileField(
'Image File'
'Image File',
[FileSizeLimit(max_size_in_mb=2)]
)
full_name = StringField(
'Full name',

9
app/wtf_validators.py Normal file
View File

@ -0,0 +1,9 @@
from wtforms.validators import ValidationError
def FileSizeLimit(max_size_in_mb):
max_bytes = max_size_in_mb*1024*1024
def file_length_check(form, field):
if len(field.data.read()) > max_bytes:
raise ValidationError(f"File size must be less than {max_size_in_mb}MB")
field.data.seek(0)
return file_length_check