mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
form tweaks for accessibility
plus admin topic editing
This commit is contained in:
parent
a17e3273bf
commit
510176dea3
4 changed files with 11 additions and 8 deletions
|
@ -90,6 +90,7 @@ class EditCommunityForm(FlaskForm):
|
|||
|
||||
class EditTopicForm(FlaskForm):
|
||||
name = StringField(_l('Name'), validators=[DataRequired()])
|
||||
machine_name = StringField(_l('Url'), validators=[DataRequired()])
|
||||
add_community = SelectField(_l('Community to add'), coerce=int, validators=[Optional()])
|
||||
submit = SubmitField(_l('Save'))
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ def admin_topic_add():
|
|||
form = EditTopicForm()
|
||||
form.add_community.choices = communities_for_form()
|
||||
if form.validate_on_submit():
|
||||
topic = Topic(name=form.name.data, num_communities=0)
|
||||
topic = Topic(name=form.name.data, machine_name=form.machine_name.data, num_communities=0)
|
||||
db.session.add(topic)
|
||||
db.session.commit()
|
||||
if form.add_community.data:
|
||||
|
@ -369,6 +369,7 @@ def admin_topic_edit(topic_id):
|
|||
if form.validate_on_submit():
|
||||
topic.name = form.name.data
|
||||
topic.num_communities = topic.communities.count() + 1
|
||||
topic.machine_name = form.machine_name.data
|
||||
if form.add_community.data:
|
||||
community = Community.query.get(form.add_community.data)
|
||||
community.topic_id = topic.id
|
||||
|
@ -377,6 +378,7 @@ def admin_topic_edit(topic_id):
|
|||
return redirect(url_for('admin.admin_topics'))
|
||||
else:
|
||||
form.name.data = topic.name
|
||||
form.machine_name.data = topic.machine_name
|
||||
return render_template('admin/edit_topic.html', title=_('Edit topic'), form=form, topic=topic,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id())
|
||||
|
|
|
@ -6,17 +6,17 @@ from app.models import User, Community
|
|||
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
user_name = StringField(_l('User name'), validators=[DataRequired()])
|
||||
user_name = StringField(_l('User name'), validators=[DataRequired()], render_kw={'autofocus': True, 'autocomplete': 'username'})
|
||||
password = PasswordField(_l('Password'), validators=[DataRequired()])
|
||||
low_bandwidth_mode = BooleanField(_l('Low bandwidth mode'))
|
||||
submit = SubmitField(_l('Log In'))
|
||||
|
||||
|
||||
class RegistrationForm(FlaskForm):
|
||||
user_name = StringField(_l('User name'), validators=[DataRequired()])
|
||||
user_name = StringField(_l('User name'), validators=[DataRequired()], render_kw={'autofocus': True, 'autocomplete': 'username'})
|
||||
email = HiddenField(_l('Email'))
|
||||
real_email = StringField(_l('Email'), validators=[DataRequired(), Email(), Length(min=5, max=255)])
|
||||
password = PasswordField(_l('Password'), validators=[DataRequired(), Length(min=8, max=50)])
|
||||
real_email = StringField(_l('Email'), validators=[DataRequired(), Email(), Length(min=5, max=255)], render_kw={'autocomplete': 'email'})
|
||||
password = PasswordField(_l('Password'), validators=[DataRequired(), Length(min=8, max=50)], render_kw={'autocomplete': 'new-password'})
|
||||
password2 = PasswordField(
|
||||
_l('Repeat password'), validators=[DataRequired(),
|
||||
EqualTo('password')])
|
||||
|
@ -62,12 +62,12 @@ class RegistrationForm(FlaskForm):
|
|||
|
||||
|
||||
class ResetPasswordRequestForm(FlaskForm):
|
||||
email = StringField(_l('Email'), validators=[DataRequired(), Email()])
|
||||
email = StringField(_l('Email'), validators=[DataRequired(), Email()], render_kw={'autofocus': True})
|
||||
submit = SubmitField(_l('Request password reset'))
|
||||
|
||||
|
||||
class ResetPasswordForm(FlaskForm):
|
||||
password = PasswordField(_l('Password'), validators=[DataRequired()])
|
||||
password = PasswordField(_l('Password'), validators=[DataRequired()], render_kw={'autofocus': True})
|
||||
password2 = PasswordField(
|
||||
_l('Repeat password'), validators=[DataRequired(),
|
||||
EqualTo('password')])
|
||||
|
|
|
@ -37,7 +37,7 @@ class AddLocalCommunity(FlaskForm):
|
|||
|
||||
|
||||
class SearchRemoteCommunity(FlaskForm):
|
||||
address = StringField(_l('Community address'), render_kw={'placeholder': 'e.g. !name@server'}, validators=[DataRequired()])
|
||||
address = StringField(_l('Community address'), render_kw={'placeholder': 'e.g. !name@server', 'autofocus': True}, validators=[DataRequired()])
|
||||
submit = SubmitField(_l('Search'))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue