#5010 Fix forms' glitches.
Merged 3 years ago by pingou. Opened 3 years ago by mzch.
mzch/pagure master  into  master

Fix forms' glitches.
Koichi MATSUMOTO • 3 years ago  
file modified
+25 -47
@@ -136,8 +136,7 @@ 

      """ Form to edit the description of a project. """

  

      description = wtforms.StringField(

-         'Description <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Description", [wtforms.validators.DataRequired()],

      )

      url = wtforms.StringField(

          "URL",
@@ -169,7 +168,7 @@ 

  class ProjectForm(ProjectFormSimplified):

      """ Form to create or edit project. """

  

-     name = wtforms.StringField('Project name <span class="error">*</span>')

+     name = wtforms.StringField("Project name")

      mirrored_from = wtforms.StringField(

          "Mirror from URL",

          [
@@ -251,13 +250,9 @@ 

  class IssueFormSimplied(PagureForm):

      """ Form to create or edit an issue. """

  

-     title = wtforms.StringField(

-         'Title<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

-     )

+     title = wtforms.StringField("Title", [wtforms.validators.DataRequired()],)

      issue_content = wtforms.TextAreaField(

-         'Content<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Content", [wtforms.validators.DataRequired()],

      )

      private = wtforms.BooleanField(

          "Private", [wtforms.validators.optional()], false_values=FALSE_VALUES
@@ -316,10 +311,7 @@ 

  class RequestPullForm(PagureForm):

      """ Form to create a pull request. """

  

-     title = wtforms.StringField(

-         'Title<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

-     )

+     title = wtforms.StringField("Title", [wtforms.validators.DataRequired()],)

      initial_comment = wtforms.TextAreaField(

          "Initial Comment", [wtforms.validators.Optional()]

      )
@@ -334,19 +326,17 @@ 

      """ Form to create a remote pull request. """

  

      git_repo = wtforms.StringField(

-         'Git repo address<span class="error">*</span>',

+         "Git repo address",

          [

              wtforms.validators.DataRequired(),

              wtforms.validators.Regexp(urlpattern, flags=re.IGNORECASE),

          ],

      )

      branch_from = wtforms.StringField(

-         'Git branch<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Git branch", [wtforms.validators.DataRequired()],

      )

      branch_to = wtforms.StringField(

-         'Git branch to merge in<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Git branch to merge in", [wtforms.validators.DataRequired()],

      )

  

  
@@ -554,8 +544,7 @@ 

      requestid = wtforms.HiddenField("requestid")

      tree_id = wtforms.HiddenField("treeid")

      comment = wtforms.TextAreaField(

-         'Comment<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Comment", [wtforms.validators.DataRequired()],

      )

  

  
@@ -605,7 +594,7 @@ 

      """ Form to add a SSH key to a user. """

  

      ssh_key = wtforms.StringField(

-         'SSH Key <span class="error">*</span>',

+         "SSH Key",

          [wtforms.validators.DataRequired()]

          # TODO: Add an ssh key validator?

      )
@@ -625,16 +614,13 @@ 

      """ Form to add a user to a project. """

  

      user = wtforms.StringField(

-         'Username <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Username", [wtforms.validators.DataRequired()],

      )

      access = wtforms.StringField(

-         'Access Level <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Access Level", [wtforms.validators.DataRequired()],

      )

      branches = wtforms.StringField(

-         'Git branches <span class="error">*</span>',

-         [wtforms.validators.Optional()],

+         "Git branches", [wtforms.validators.Optional()],

      )

  

  
@@ -642,8 +628,7 @@ 

      """ Form to add a user to a pagure group. """

  

      user = wtforms.StringField(

-         'Username <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Username", [wtforms.validators.DataRequired()],

      )

  

  
@@ -651,8 +636,7 @@ 

      """ Form to assign an user to an issue. """

  

      assignee = wtforms.StringField(

-         'Assignee <span class="error">*</span>',

-         [wtforms.validators.Optional()],

+         "Assignee", [wtforms.validators.Optional()],

      )

  

  
@@ -660,19 +644,17 @@ 

      """ Form to add a group to a project. """

  

      group = wtforms.StringField(

-         'Group <span class="error">*</span>',

+         "Group",

          [

              wtforms.validators.DataRequired(),

              wtforms.validators.Regexp(STRICT_REGEX, flags=re.IGNORECASE),

          ],

      )

      access = wtforms.StringField(

-         'Access Level <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Access Level", [wtforms.validators.DataRequired()],

      )

      branches = wtforms.StringField(

-         'Git branches <span class="error">*</span>',

-         [wtforms.validators.Optional()],

+         "Git branches", [wtforms.validators.Optional()],

      )

  

  
@@ -691,8 +673,7 @@ 

          choices=[("user", "User"), ("group", "Group")],

      )

      name = wtforms.StringField(

-         'User- or Groupname <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "User- or Groupname", [wtforms.validators.DataRequired()],

      )

      acl = wtforms.SelectField(

          "ACL type",
@@ -773,7 +754,7 @@ 

      """ Form to ask for a password change. """

  

      group_name = wtforms.StringField(

-         'Group name  <span class="error">*</span>',

+         "Group name",

          [

              wtforms.validators.DataRequired(),

              wtforms.validators.Length(max=255),
@@ -866,8 +847,7 @@ 

      """

  

      update_comment = wtforms.TextAreaField(

-         'Comment<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Comment ", [wtforms.validators.DataRequired()],

      )

  

  
@@ -890,8 +870,7 @@ 

      """

  

      report_name = wtforms.TextAreaField(

-         'Report name<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Report name", [wtforms.validators.DataRequired()],

      )

  

  
@@ -900,12 +879,12 @@ 

      """

  

      issue_notifs = wtforms.TextAreaField(

-         'Public issue notification<span class="error">*</span>',

+         "Public issue notification",

          [wtforms.validators.optional(), MultipleEmail()],

      )

  

      pr_notifs = wtforms.TextAreaField(

-         'Public PR notification<span class="error">*</span>',

+         "Public PR notification",

          [wtforms.validators.optional(), MultipleEmail()],

      )

  
@@ -953,8 +932,7 @@ 

      """ Form to create a new git tag. """

  

      tagname = wtforms.StringField(

-         'Name of the tag<span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Name of the tag", [wtforms.validators.DataRequired()],

      )

      commit_hash = wtforms.StringField(

          "Hash of the commit to tag", [wtforms.validators.DataRequired()]

file modified
+12 -23
@@ -43,8 +43,7 @@ 

      """ Form to ask for a password change. """

  

      username = wtforms.StringField(

-         'username  <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "username", [wtforms.validators.DataRequired()],

      )

  

  
@@ -52,12 +51,10 @@ 

      """ Form to reset one's password in the local database. """

  

      password = wtforms.PasswordField(

-         'Password  <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Password", [wtforms.validators.DataRequired()],

      )

      confirm_password = wtforms.PasswordField(

-         'Confirm password  <span class="error">*</span>',

-         [wtforms.validators.DataRequired(), same_password],

+         "Confirm password", [wtforms.validators.DataRequired(), same_password],

      )

  

  
@@ -65,12 +62,10 @@ 

      """ Form to login via the local database. """

  

      username = wtforms.StringField(

-         'username  <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "username", [wtforms.validators.DataRequired()],

      )

      password = wtforms.PasswordField(

-         'Password  <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Password", [wtforms.validators.DataRequired()],

      )

  

  
@@ -78,23 +73,20 @@ 

      """ Form to add a new user to the local database. """

  

      user = wtforms.StringField(

-         'username  <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "username", [wtforms.validators.DataRequired()],

      )

      fullname = wtforms.StringField(

          "Full name", [wtforms.validators.Optional()]

      )

      email_address = wtforms.StringField(

-         'Email address  <span class="error">*</span>',

+         "Email address",

          [wtforms.validators.DataRequired(), wtforms.validators.Email()],

      )

      password = wtforms.PasswordField(

-         'Password  <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Password", [wtforms.validators.DataRequired()],

      )

      confirm_password = wtforms.PasswordField(

-         'Confirm password  <span class="error">*</span>',

-         [wtforms.validators.DataRequired(), same_password],

+         "Confirm password", [wtforms.validators.DataRequired(), same_password],

      )

  

  
@@ -102,14 +94,11 @@ 

      """ Form to reset one's password in the local database. """

  

      old_password = wtforms.PasswordField(

-         'Old Password  <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Old Password", [wtforms.validators.DataRequired()],

      )

      password = wtforms.PasswordField(

-         'Password  <span class="error">*</span>',

-         [wtforms.validators.DataRequired()],

+         "Password", [wtforms.validators.DataRequired()],

      )

      confirm_password = wtforms.PasswordField(

-         'Confirm password  <span class="error">*</span>',

-         [wtforms.validators.DataRequired(), same_password],

+         "Confirm password", [wtforms.validators.DataRequired(), same_password],

      )

@@ -31,7 +31,7 @@ 

          {% endif %}

      {% else %}

        <div>

-         <strong>{{ field.label }}</strong>

+         <strong>{{ field.label }} {% if field.errors %} <span class="error">*</span> {% endif %}</strong>

        {% if rightlink %}

        <div class="float-right"><a href="{{rightlink['url']}}">{{rightlink['text']}}</a>

        {% endif %}

@@ -2645,7 +2645,7 @@ 

              output_text = output.get_data(as_text=True)

              self.assertIn(

                  '<strong><label for="mirrored_from">Mirror from URL'

-                 "</label></strong>",

+                 "</label> </strong>",

                  output_text,

              )

  
@@ -2683,7 +2683,7 @@ 

              output_text = output.get_data(as_text=True)

              self.assertNotIn(

                  '<strong><label for="mirrored_from">Mirror from URL'

-                 "</label></strong>",

+                 "</label> </strong>",

                  output_text,

              )

  

@@ -197,7 +197,7 @@ 

              )

              self.assertIn(

                  '<strong><label for="description">Description'

-                 "</label></strong>",

+                 "</label> </strong>",

                  output.get_data(as_text=True),

              )

  
@@ -228,7 +228,7 @@ 

              )

              self.assertIn(

                  '<strong><label for="description">Description'

-                 "</label></strong>",

+                 "</label> </strong>",

                  output.get_data(as_text=True),

              )