diff --git a/alembic/versions/6addaed6008e_add_description_for_tags.py b/alembic/versions/6addaed6008e_add_description_for_tags.py index 14411bc..47b0070 100644 --- a/alembic/versions/6addaed6008e_add_description_for_tags.py +++ b/alembic/versions/6addaed6008e_add_description_for_tags.py @@ -15,7 +15,7 @@ import sqlalchemy as sa def upgrade(): - ''' Add the column notification to the table pull_request_comments. + ''' Add the column tag_description to the table tags_colored. ''' op.add_column( 'tags_colored', @@ -23,4 +23,6 @@ def upgrade(): ) def downgrade(): + ''' Remove column tag_description from the table tags_colored. + ''' op.drop_column('tags_colored', 'tag_description') diff --git a/pagure/forms.py b/pagure/forms.py index bb57357..579e047 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -228,7 +228,7 @@ class RemoteRequestPullForm(RequestPullForm): class DeleteIssueTagForm(PagureForm): ''' Form to remove a tag to from a project. ''' tag = wtforms.TextField( - 'tag', + 'Tag', [ wtforms.validators.Optional(), wtforms.validators.Regexp(TAGS_REGEX, flags=re.IGNORECASE), @@ -240,11 +240,11 @@ class DeleteIssueTagForm(PagureForm): class AddIssueTagForm(DeleteIssueTagForm): ''' Form to add a tag to a project. ''' tag_description = wtforms.TextField( - 'tag_description', + 'Tag Description', [wtforms.validators.Optional()], ) tag_color = wtforms.TextField( - 'tag_color', + 'Tag Color', [wtforms.validators.Required()], ) diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 09b95f9..d28b2af 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -754,14 +754,15 @@ def edit_issue_tags( old_tag_color = old_tag.tag_color # check for change - no_change_in_tag = old_tag.tag == new_tag and \ - old_tag_description == new_tag_description and \ - old_tag_color == new_tag_color + no_change_in_tag = old_tag.tag == new_tag \ + and old_tag_description == new_tag_description \ + and old_tag_color == new_tag_color if no_change_in_tag: raise pagure.exceptions.PagureException( - 'No change. Old tag "%s(%s)[%s]" is the same as new tag "%s(%s)[%s]"' - % (old_tag, old_tag_description, old_tag_color, new_tag, - new_tag_description, new_tag_color)) + 'No change. Old tag "%s(%s)[%s]" is the same as ' + 'new tag "%s(%s)[%s]"' % ( + old_tag, old_tag_description, old_tag_color, new_tag, + new_tag_description, new_tag_color)) elif old_tag.tag != new_tag: # Check if new tag already exists existing_tag = get_tag(session, new_tag, project.id) diff --git a/pagure/templates/_formhelper.html b/pagure/templates/_formhelper.html index 117b6f7..ae5da5b 100644 --- a/pagure/templates/_formhelper.html +++ b/pagure/templates/_formhelper.html @@ -12,9 +12,7 @@ {% endmacro %} -{% macro render_bootstrap_field(field, field_label, field_description="", formclass="") %} - {% if field_label is not defined %} {% set field_label = field.label %} {% endif %} - +{% macro render_bootstrap_field(field, field_description="", formclass="") %}
{% set formclasses = "form-control"%} {% if field.errors %} {% set formclasses = formclasses + " form-control-error" %} {% endif %} @@ -25,14 +23,14 @@
{% if field_description %} {{ field_description }} {% endif %} {% else %} - {{ field_label }} + {{ field.label }} {{ field(class_=formclasses)|safe }}
{% if field_description %} diff --git a/pagure/templates/edit_tag.html b/pagure/templates/edit_tag.html index f7e61e7..5789cfa 100644 --- a/pagure/templates/edit_tag.html +++ b/pagure/templates/edit_tag.html @@ -22,13 +22,13 @@ tag=tagname, namespace=repo.namespace) }}" > {{ form.csrf_token }} - {{ render_bootstrap_field(form.tag, field_label="Tag") }} - {{ render_bootstrap_field(form.tag_description, field_label="Tag Description") }} + {{ render_bootstrap_field(form.tag) }} + {{ render_bootstrap_field(form.tag_description) }}
{% set formclasses = "form-control c-select"%} {% if form.tag_color.errors %} {% set formclasses = formclasses + " form-control-error" %} {% endif %} - Tag Color + {{ form.tag_color.label }} diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 56120fa..a2ba336 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -159,7 +159,9 @@

{% for tag in issue.tags %} -