-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try and get folks to put more tags. #3350
Conversation
39b8f83
to
91c6387
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at the small changes that I am suggesting.
<h3>{% trans "Tags" %}</h3> | ||
<p> | ||
{% if project.tags.count %} | ||
{% for tag in project.tags.all %} | ||
<a href="{% url "projects_tag_detail" tag.slug %}">{{ tag.name }}</a>{% if forloop.last %}{% else %}, {% endif %} | ||
{% empty %} | ||
<span class="quiet">{% trans "No tags" %}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition won't be met since it has to be 0 on project.tags.count
to have an empty list. I think you can remove the empty block.
{% for tag in project.tags.all %} | ||
<a href="{% url "projects_tag_detail" tag.slug %}">{{ tag.name }}</a>{% if forloop.last %}{% else %}, {% endif %} | ||
{% empty %} | ||
<span class="quiet">{% trans "No tags" %}</span> | ||
{% endfor %} | ||
</p> | ||
{% else %} | ||
Project has no tags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trans is missing
{% else %} | ||
Project has no tags. | ||
{% if request.user|is_admin:project %} | ||
Add some in your <a href="{% url 'projects_edit' project.slug %}">project settings</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trans is missing
!m @humitos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Just two comments to consider.
{% trans "Project has no tags." %} | ||
{% if request.user|is_admin:project %} | ||
|
||
{% url 'projects_edit' project.slug as edit_url %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember this exactly but, can we just use the url
tag like this to create a local variable? don't we need the with
tag for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<span class="quiet">{% trans "No tags" %}</span> | ||
{% endfor %} | ||
|
||
{% if project.tags.count %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that we are using .count
in some places where we don't need the number but we want to know the existence. So, maybe it's better to use .exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah yea, old habit!
No description provided.