From 8899073543efaf1e450f3ef69fd81873b252c35b Mon Sep 17 00:00:00 2001 From: Koichi MATSUMOTO Date: Oct 09 2020 15:10:46 +0000 Subject: Fix forms' glitches. --- diff --git a/pagure/forms.py b/pagure/forms.py index 366d8ae..7e30115 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -136,8 +136,7 @@ class ProjectFormSimplified(PagureForm): """ Form to edit the description of a project. """ description = wtforms.StringField( - 'Description *', - [wtforms.validators.DataRequired()], + "Description", [wtforms.validators.DataRequired()], ) url = wtforms.StringField( "URL", @@ -169,7 +168,7 @@ class ProjectFormSimplified(PagureForm): class ProjectForm(ProjectFormSimplified): """ Form to create or edit project. """ - name = wtforms.StringField('Project name *') + name = wtforms.StringField("Project name") mirrored_from = wtforms.StringField( "Mirror from URL", [ @@ -251,13 +250,9 @@ class ProjectForm(ProjectFormSimplified): class IssueFormSimplied(PagureForm): """ Form to create or edit an issue. """ - title = wtforms.StringField( - 'Title*', - [wtforms.validators.DataRequired()], - ) + title = wtforms.StringField("Title", [wtforms.validators.DataRequired()],) issue_content = wtforms.TextAreaField( - 'Content*', - [wtforms.validators.DataRequired()], + "Content", [wtforms.validators.DataRequired()], ) private = wtforms.BooleanField( "Private", [wtforms.validators.optional()], false_values=FALSE_VALUES @@ -316,10 +311,7 @@ class IssueForm(IssueFormSimplied): class RequestPullForm(PagureForm): """ Form to create a pull request. """ - title = wtforms.StringField( - 'Title*', - [wtforms.validators.DataRequired()], - ) + title = wtforms.StringField("Title", [wtforms.validators.DataRequired()],) initial_comment = wtforms.TextAreaField( "Initial Comment", [wtforms.validators.Optional()] ) @@ -334,19 +326,17 @@ class RemoteRequestPullForm(RequestPullForm): """ Form to create a remote pull request. """ git_repo = wtforms.StringField( - 'Git repo address*', + "Git repo address", [ wtforms.validators.DataRequired(), wtforms.validators.Regexp(urlpattern, flags=re.IGNORECASE), ], ) branch_from = wtforms.StringField( - 'Git branch*', - [wtforms.validators.DataRequired()], + "Git branch", [wtforms.validators.DataRequired()], ) branch_to = wtforms.StringField( - 'Git branch to merge in*', - [wtforms.validators.DataRequired()], + "Git branch to merge in", [wtforms.validators.DataRequired()], ) @@ -554,8 +544,7 @@ class AddPullRequestCommentForm(PagureForm): requestid = wtforms.HiddenField("requestid") tree_id = wtforms.HiddenField("treeid") comment = wtforms.TextAreaField( - 'Comment*', - [wtforms.validators.DataRequired()], + "Comment", [wtforms.validators.DataRequired()], ) @@ -605,7 +594,7 @@ class AddSSHKeyForm(PagureForm): """ Form to add a SSH key to a user. """ ssh_key = wtforms.StringField( - 'SSH Key *', + "SSH Key", [wtforms.validators.DataRequired()] # TODO: Add an ssh key validator? ) @@ -625,16 +614,13 @@ class AddUserForm(PagureForm): """ Form to add a user to a project. """ user = wtforms.StringField( - 'Username *', - [wtforms.validators.DataRequired()], + "Username", [wtforms.validators.DataRequired()], ) access = wtforms.StringField( - 'Access Level *', - [wtforms.validators.DataRequired()], + "Access Level", [wtforms.validators.DataRequired()], ) branches = wtforms.StringField( - 'Git branches *', - [wtforms.validators.Optional()], + "Git branches", [wtforms.validators.Optional()], ) @@ -642,8 +628,7 @@ class AddUserToGroupForm(PagureForm): """ Form to add a user to a pagure group. """ user = wtforms.StringField( - 'Username *', - [wtforms.validators.DataRequired()], + "Username", [wtforms.validators.DataRequired()], ) @@ -651,8 +636,7 @@ class AssignIssueForm(PagureForm): """ Form to assign an user to an issue. """ assignee = wtforms.StringField( - 'Assignee *', - [wtforms.validators.Optional()], + "Assignee", [wtforms.validators.Optional()], ) @@ -660,19 +644,17 @@ class AddGroupForm(PagureForm): """ Form to add a group to a project. """ group = wtforms.StringField( - 'Group *', + "Group", [ wtforms.validators.DataRequired(), wtforms.validators.Regexp(STRICT_REGEX, flags=re.IGNORECASE), ], ) access = wtforms.StringField( - 'Access Level *', - [wtforms.validators.DataRequired()], + "Access Level", [wtforms.validators.DataRequired()], ) branches = wtforms.StringField( - 'Git branches *', - [wtforms.validators.Optional()], + "Git branches", [wtforms.validators.Optional()], ) @@ -691,8 +673,7 @@ class ModifyACLForm(PagureForm): choices=[("user", "User"), ("group", "Group")], ) name = wtforms.StringField( - 'User- or Groupname *', - [wtforms.validators.DataRequired()], + "User- or Groupname", [wtforms.validators.DataRequired()], ) acl = wtforms.SelectField( "ACL type", @@ -773,7 +754,7 @@ class NewGroupForm(EditGroupForm): """ Form to ask for a password change. """ group_name = wtforms.StringField( - 'Group name *', + "Group name", [ wtforms.validators.DataRequired(), wtforms.validators.Length(max=255), @@ -866,8 +847,7 @@ class EditCommentForm(PagureForm): """ update_comment = wtforms.TextAreaField( - 'Comment*', - [wtforms.validators.DataRequired()], + "Comment ", [wtforms.validators.DataRequired()], ) @@ -890,8 +870,7 @@ class AddReportForm(PagureForm): """ report_name = wtforms.TextAreaField( - 'Report name*', - [wtforms.validators.DataRequired()], + "Report name", [wtforms.validators.DataRequired()], ) @@ -900,12 +879,12 @@ class PublicNotificationForm(PagureForm): """ issue_notifs = wtforms.TextAreaField( - 'Public issue notification*', + "Public issue notification", [wtforms.validators.optional(), MultipleEmail()], ) pr_notifs = wtforms.TextAreaField( - 'Public PR notification*', + "Public PR notification", [wtforms.validators.optional(), MultipleEmail()], ) @@ -953,8 +932,7 @@ class AddGitTagForm(PagureForm): """ Form to create a new git tag. """ tagname = wtforms.StringField( - 'Name of the tag*', - [wtforms.validators.DataRequired()], + "Name of the tag", [wtforms.validators.DataRequired()], ) commit_hash = wtforms.StringField( "Hash of the commit to tag", [wtforms.validators.DataRequired()] diff --git a/pagure/login_forms.py b/pagure/login_forms.py index 2cd8d5c..420cc3b 100644 --- a/pagure/login_forms.py +++ b/pagure/login_forms.py @@ -43,8 +43,7 @@ class LostPasswordForm(FlaskForm): """ Form to ask for a password change. """ username = wtforms.StringField( - 'username *', - [wtforms.validators.DataRequired()], + "username", [wtforms.validators.DataRequired()], ) @@ -52,12 +51,10 @@ class ResetPasswordForm(FlaskForm): """ Form to reset one's password in the local database. """ password = wtforms.PasswordField( - 'Password *', - [wtforms.validators.DataRequired()], + "Password", [wtforms.validators.DataRequired()], ) confirm_password = wtforms.PasswordField( - 'Confirm password *', - [wtforms.validators.DataRequired(), same_password], + "Confirm password", [wtforms.validators.DataRequired(), same_password], ) @@ -65,12 +62,10 @@ class LoginForm(FlaskForm): """ Form to login via the local database. """ username = wtforms.StringField( - 'username *', - [wtforms.validators.DataRequired()], + "username", [wtforms.validators.DataRequired()], ) password = wtforms.PasswordField( - 'Password *', - [wtforms.validators.DataRequired()], + "Password", [wtforms.validators.DataRequired()], ) @@ -78,23 +73,20 @@ class NewUserForm(FlaskForm): """ Form to add a new user to the local database. """ user = wtforms.StringField( - 'username *', - [wtforms.validators.DataRequired()], + "username", [wtforms.validators.DataRequired()], ) fullname = wtforms.StringField( "Full name", [wtforms.validators.Optional()] ) email_address = wtforms.StringField( - 'Email address *', + "Email address", [wtforms.validators.DataRequired(), wtforms.validators.Email()], ) password = wtforms.PasswordField( - 'Password *', - [wtforms.validators.DataRequired()], + "Password", [wtforms.validators.DataRequired()], ) confirm_password = wtforms.PasswordField( - 'Confirm password *', - [wtforms.validators.DataRequired(), same_password], + "Confirm password", [wtforms.validators.DataRequired(), same_password], ) @@ -102,14 +94,11 @@ class ChangePasswordForm(FlaskForm): """ Form to reset one's password in the local database. """ old_password = wtforms.PasswordField( - 'Old Password *', - [wtforms.validators.DataRequired()], + "Old Password", [wtforms.validators.DataRequired()], ) password = wtforms.PasswordField( - 'Password *', - [wtforms.validators.DataRequired()], + "Password", [wtforms.validators.DataRequired()], ) confirm_password = wtforms.PasswordField( - 'Confirm password *', - [wtforms.validators.DataRequired(), same_password], + "Confirm password", [wtforms.validators.DataRequired(), same_password], ) diff --git a/pagure/templates/_formhelper.html b/pagure/templates/_formhelper.html index 714211d..67edd26 100644 --- a/pagure/templates/_formhelper.html +++ b/pagure/templates/_formhelper.html @@ -31,7 +31,7 @@ {% endif %} {% else %}
- {{ field.label }} + {{ field.label }} {% if field.errors %} * {% endif %} {% if rightlink %}
{{rightlink['text']}} {% endif %} diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py index cc2f8a4..b0fb0d6 100644 --- a/tests/test_pagure_flask_ui_app.py +++ b/tests/test_pagure_flask_ui_app.py @@ -2645,7 +2645,7 @@ class PagureFlaskAppNewProjecttests(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertIn( '", + " ", output_text, ) @@ -2683,7 +2683,7 @@ class PagureFlaskAppNewProjecttests(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertNotIn( '", + " ", output_text, ) diff --git a/tests/test_pagure_flask_ui_groups.py b/tests/test_pagure_flask_ui_groups.py index f73845f..d1b18a1 100644 --- a/tests/test_pagure_flask_ui_groups.py +++ b/tests/test_pagure_flask_ui_groups.py @@ -197,7 +197,7 @@ class PagureFlaskGroupstests(tests.Modeltests): ) self.assertIn( '", + " ", output.get_data(as_text=True), ) @@ -228,7 +228,7 @@ class PagureFlaskGroupstests(tests.Modeltests): ) self.assertIn( '", + " ", output.get_data(as_text=True), )