Skip to content

Commit

Permalink
Use formated numbers in tables and stats
Browse files Browse the repository at this point in the history
humanize.intcomma turns 1000 into 1,000 as required
  • Loading branch information
dwaynebailey committed Nov 29, 2016
1 parent a89fb8b commit a610644
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions pootle/templates/browser/_actions.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{% load i18n %}
{% load i18n humanize %}
{% if stats.total %}
<ul>
{% if stats.critical %}
<li id="js-action-fix-critical">
{% if url_action_fixcritical %}
<a class="fix-errors" href="{{ url_action_fixcritical }}">
<span class="caption">{% trans 'Fix critical errors' %}</span>
<span class="counter">{{ stats.critical }}</span>
<span class="counter">{{ stats.critical|intcomma }}</span>
</a>
{% else %}
<span class="fix-errors">
<span class="caption">{% trans 'Critical errors' %}</span>
<span class="counter">{{ stats.critical }}</span>
<span class="counter">{{ stats.critical|intcomma }}</span>
</span>
{% endif %}
</li>
Expand All @@ -21,12 +21,12 @@
{% if url_action_review %}
<a class="review-suggestions" href="{{ url_action_review }}">
<span class="caption">{% trans 'Review suggestions' %}</span>
<span class="counter">{{ stats.suggestions }}</span>
<span class="counter">{{ stats.suggestions|intcomma }}</span>
</a>
{% else %}
<span class="review-suggestions">
<span class="caption">{% trans 'Suggestions' %}</span>
<span class="counter">{{ stats.suggestions }}</span>
<span class="counter">{{ stats.suggestions|intcomma }}</span>
</span>
{% endif %}
</li>
Expand All @@ -36,12 +36,12 @@
{% if url_action_continue %}
<a class="continue-translation" href="{{ url_action_continue }}">
<span class="caption">{% trans 'Continue translation' %}</span>
<span class="counter">{{ stats.incomplete }}</span>
<span class="counter">{{ stats.incomplete|intcomma }}</span>
</a>
{% else %}
<span class="continue-translation">
<span class="caption">{% trans 'Incomplete' %}</span>
<span class="counter">{{ stats.incomplete }}</span>
<span class="counter">{{ stats.incomplete|intcomma }}</span>
</span>
{% endif %}
</li>
Expand All @@ -51,12 +51,12 @@
{% if url_action_view_all %}
<a class="translation-complete"{% if url_action_view_all %} href="{{ url_action_view_all }}"{% endif %}>
<span class="caption">{% trans 'View all' %}</span>
<span class="counter">{{ stats.total }}</span>
<span class="counter">{{ stats.total|intcomma }}</span>
</a>
{% else %}
<span class="translation-complete">
<span class="caption">{% trans 'All' %}</span>
<span class="counter">{{ stats.total }}</span>
<span class="counter">{{ stats.total|intcomma }}</span>
</span>
{% endif %}
</li>
Expand Down
18 changes: 9 additions & 9 deletions pootle/templates/browser/_table.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n locale cache %}
{% load common_tags profile_tags %}
{% load common_tags profile_tags humanize %}

{% get_current_language as LANGUAGE_CODE %}

Expand Down Expand Up @@ -67,39 +67,39 @@
{% if 'critical' in table.fields %}
<td id="critical-{{ item.code|cssid }}" class="stats-number critical{% if not item.stats.critical %} zero{% endif %}">
{% if can_translate and item.stats.critical %}
<a class="stats-data non-zero" href="{{ item.href_translate }}#filter=checks&category=critical{% if item.sort %}&sort={{ item.sort }}{% endif %}">{{ item.stats.critical }}</a>
<a class="stats-data non-zero" href="{{ item.href_translate }}#filter=checks&category=critical{% if item.sort %}&sort={{ item.sort }}{% endif %}">{{ item.stats.critical|intcomma }}</a>
{% else %}
<span class="{% if item.stats.critical %}stats-data non-zero{% else %}zero muted{% endif %}">{{ item.stats.critical }}</span>
<span class="{% if item.stats.critical %}stats-data non-zero{% else %}zero muted{% endif %}">{{ item.stats.critical|intcomma }}</span>
{% endif %}
</td>
{% endif %}

{% if 'suggestions' in table.fields %}
<td id="suggestions-{{ item.code|cssid }}" class="stats-number suggestions{% if not item.stats.suggestions %} zero{% endif %}">
{% if can_translate and item.stats.suggestions %}
<a class="stats-data non-zero" href="{{ item.href_translate }}#filter=suggestions{% if item.sort %}&sort={{ item.sort }}{% endif %}">{{ item.stats.suggestions }}</a>
<a class="stats-data non-zero" href="{{ item.href_translate }}#filter=suggestions{% if item.sort %}&sort={{ item.sort }}{% endif %}">{{ item.stats.suggestions|intcomma }}</a>
{% else %}
<span class="{% if item.stats.suggestions %}stats-data non-zero{% else %}zero muted{% endif %}">{{ item.stats.suggestions }}</span>
<span class="{% if item.stats.suggestions %}stats-data non-zero{% else %}zero muted{% endif %}">{{ item.stats.suggestions|intcomma }}</span>
{% endif %}
</td>
{% endif %}

{% if 'need-translation' in table.fields %}
<td id="need-translation-{{ item.code|cssid }}" class="stats-number need-translation{% if not item.stats.incomplete %} zero{% endif %}">
{% if can_translate and item.stats.incomplete %}
<a class="stats-data non-zero" href="{{ item.href_translate }}#filter=incomplete{% if item.sort %}&sort={{ item.sort }}{% endif %}">{{ item.stats.incomplete }}</a>
<a class="stats-data non-zero" href="{{ item.href_translate }}#filter=incomplete{% if item.sort %}&sort={{ item.sort }}{% endif %}">{{ item.stats.incomplete|intcomma }}</a>
{% else %}
<span class="{% if item.stats.incomplete %}stats-data non-zero{% else %}zero muted{% endif %}">{{ item.stats.incomplete }}</span>
<span class="{% if item.stats.incomplete %}stats-data non-zero{% else %}zero muted{% endif %}">{{ item.stats.incomplete|intcomma }}</span>
{% endif %}
</td>
{% endif %}

{% if 'total' in table.fields %}
<td id="total-words-{{ item.code|cssid }}" class="stats-number total not-inited">
{% if can_translate %}
<a class="stats-data non-zero" href="{{ item.href_translate }}{% if item.sort %}#sort={{ item.sort }}{% endif %}">{{ item.stats.total }}</a>
<a class="stats-data non-zero" href="{{ item.href_translate }}{% if item.sort %}#sort={{ item.sort }}{% endif %}">{{ item.stats.total|intcomma }}</a>
{% else %}
<span class="stats-data non-zero">{{ item.stats.total }}</span>
<span class="stats-data non-zero">{{ item.stats.total|intcomma }}</span>
{% endif %}
</td>
{% endif %}
Expand Down
10 changes: 5 additions & 5 deletions pootle/templates/browser/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends browser_extends %}

{% load core assets cleanhtml i18n locale common_tags profile_tags %}
{% load core assets cleanhtml i18n locale common_tags profile_tags humanize %}

{% get_current_language as LANGUAGE_CODE %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
Expand Down Expand Up @@ -32,9 +32,9 @@ <h3 class="top">{% trans "Translation Statistics" %}</h3>
<td id="stats-name">{{ item.title }}</td>
<td class="stats-number">
{% if can_translate_stats %}
<a href="{{ item.url }}" class="stats-data">{{ item.count }}</a>
<a href="{{ item.url }}" class="stats-data">{{ item.count|intcomma }}</a>
{% else %}
<span class="stats-data">{{ item.count }}</span>
<span class="stats-data">{{ item.count|intcomma }}</span>
{% endif %}
</td>
<td class="stats-percentage"><span>{{ item.percent }}</span>%</td>
Expand All @@ -54,10 +54,10 @@ <h3>{% trans "Failing Checks" %}</h3>
<td class="check-name">
<a class="check-data" href="{{ check.url }}">{{ check.title }}</a>
</td>
<td class="check-count"><a class="check-data" href="{{ check.url }}">{{ check.count }}</a></td>
<td class="check-count"><a class="check-data" href="{{ check.url }}">{{ check.count|intcomma }}</a></td>
{% else %}
<td class="check-name"><span class="check-data">{{ check.title }}</span></td>
<td class="check-count"><span class="check-data">{{ check.count }}</span></td>
<td class="check-count"><span class="check-data">{{ check.count|intcomma }}</span></td>
{% endif %}
</tr>
{% endfor %}
Expand Down

0 comments on commit a610644

Please sign in to comment.