Skip to content
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

Added a user application list template instead of using the default one (T174682) #77

Merged
merged 2 commits into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ <h4>
{% endif %}
Filter by partner: <a href="?Partner={{ app.partner.pk|urlencode|safe }}">{{ app.partner }}</a>
</div>
{% ifequal app.editor.user.pk user.pk %}
<div class="col-xs-8 col-xs-offset-4 col-sm-4 col-sm-offset-0">
<strong>{% trans "Has your account expired?" %}</strong> <br />
{% if app.is_renewable %}
<a class="btn btn-default btn-sm" href="{% url 'applications:renew' app.pk %}">{% trans "Request renewal" %}</a>
{% else %}
<em>{% trans "Unfortunately renewals are not available right now or you have already requested a renewal." %}</em>
{% endif %}
</div>
{% endifequal %}
{% if not forloop.last %}
<div class="col-sm-10 col-sm-offset-2 col-xs-12">
<hr />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{% load i18n %}
{% load l10n %}

{% for app in object_list %}
<div class="row">
<div class="col-xs-4 col-sm-2">
<span class="label label{{ app.get_bootstrap_class }} pull-right">
{% if app.parent %}
Renewal -
{% endif %}
{{ app.get_status_display }}
</span>
</div>
<div class="col-xs-8 col-sm-6">
<h4>
<a href="{{ app.get_absolute_url }}">
{{ app.partner }}
</a>
</h4>
{% if app.get_version_count > 1 %} {# first version is original submission, not later review #}
{% if app.get_latest_reviewer %}
{% comment %} Translators: On the page listing applications, this shows next to an application which was previously reviewed. Don't translate {{ reviewer }} or {{ review_date }}. {% endcomment %}
{% blocktrans trimmed with reviewer=app.get_latest_reviewer review_date=app.get_latest_review_date|localize %}
Last reviewed by {{ reviewer }} on {{ review_date }}
{% endblocktrans %}
{% else %}
{% comment %} Translators: On the page listing applications, this shows next to an application which was previously reviewed. Don't translate {{ review_date }}. {% endcomment %}
{% blocktrans trimmed with review_date=app.get_latest_review_date|localize %}
Last reviewed on {{ review_date }}
{% endblocktrans %}
{% endif %}
{% else %}
{% comment %} Translators: On the page listing applications, this shows next to an application which has not yet been reviewed. {% endcomment %}
{% trans 'Not yet reviewed.' %}
{% endif %}
<br />
</div>
{% ifequal app.editor.user.pk user.pk %}
{% if app.status == app.SENT %}
<div class="col-xs-8 col-xs-offset-4 col-sm-4 col-sm-offset-0">
<strong>{% trans "Has your account expired?" %}</strong> <br />
{% if app.is_renewable %}
<a class="btn btn-default btn-sm" href="{% url 'applications:renew' app.pk %}">{% trans "Request renewal" %}</a>
{% else %}
<em>{% trans "Unfortunately renewals are not available right now or you have already requested a renewal." %}</em>
{% endif %}
</div>
{% endif %}
{% endifequal %}
{% if not forloop.last %}
<div class="col-sm-10 col-sm-offset-2 col-xs-12">
<hr />
</div>
{% endif %}
</div>
{% empty %}
{% trans 'No applications right now.' %}
{% endfor %}
2 changes: 1 addition & 1 deletion TWLight/users/templates/users/editor_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h2>{% trans 'Editor application history' %}</h2>
</a>
</p>

{% include 'applications/application_list_include.html' %}
{% include 'applications/application_list_user_include.html' %}

{% comment %} Translators: This is the heading for user information on profile and application pages. {% endcomment %}
<h2>{% trans 'Editor data' %}</h2>
Expand Down
8 changes: 4 additions & 4 deletions TWLight/users/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ def test_editor_page_has_application_history(self):
set([app1, app2, app3, app4]))
content = response.render().content

self.assertIn(app1.__str__(), content)
self.assertIn(app2.__str__(), content)
self.assertIn(app3.__str__(), content)
self.assertIn(app4.__str__(), content)
self.assertIn(app1.partner.company_name, content)
self.assertIn(app2.partner.company_name, content)
self.assertIn(app3.partner.company_name, content)
self.assertIn(app4.partner.company_name, content)

# We can't use assertTemplateUsed with RequestFactory (only with
# Client), and testing that the rendered content is equal to an
Expand Down