Commit 555072fb authored by Claude Paroz's avatar Claude Paroz

Display hide/show modules in translator profile (refs #674607)

parent 8c475807
......@@ -827,7 +827,7 @@ img.screenshot {
border: 0;
}
p#show, p#hide {
div#hide-show {
text-align: right;
float:right;
}
......
......@@ -2,10 +2,10 @@
// This function shows or hides all modules in a release that are
// 100% translated
// ***
function showHideCompleted() {
function showHideCompleted(target) {
var regex = /complete$/i;
var tbls = document.getElementsByName("stats-table");
var tbls = document.getElementsByName(target);
for (var tb=0; tb < tbls.length; tb++) {
var translations = tbls[tb].getElementsByTagName("tr");
......
......@@ -61,7 +61,7 @@ class PersonDetailView(DetailView):
'pageSection': "teams",
'all_languages': all_languages,
'on_own_page': self.request.user.is_authenticated() and self.object.username == self.request.user.username,
'states': states,
'states': [(s, s.stats) for s in states],
})
return context
......
......@@ -22,13 +22,15 @@ $(document).ready(function()
<h2>{% trans "All modules" %} - <a href="{{ language.get_team_url }}">{{ language.get_name }}</a></h2>
<p id="hide">
<a href="#" onclick="return showHideCompleted();">{% trans "Hide completed modules" %}</a>
</p>
<p id="show" style="display:none">
<a href="#" onclick="return showHideCompleted();">{% trans "Show completed modules" %}</a>
</p>
<div id="hide-show">
<p id="hide">
<a href="#" onclick="return showHideCompleted('stats-table');">{% trans "Hide completed modules" %}</a>
</p>
<p id="show" style="display:none">
<a href="#" onclick="return showHideCompleted('stats-table');">{% trans "Show completed modules" %}</a>
</p>
</div>
<h3>{{ stats_title }}</h3>
{% with stats as modstats %}
......
......@@ -26,13 +26,15 @@ $(document).ready(function()
<p><i>{% trans "The modules of this release are not part of the GNOME Git repository. Please check each module's web page to see where to send translations." %}</i></p>
{% endif %}
<p id="hide">
<a href="#" onclick="return showHideCompleted();">{% trans "Hide completed modules" %}</a>
</p>
<p id="show" style="display:none">
<a href="#" onclick="return showHideCompleted();">{% trans "Show completed modules" %}</a>
</p>
<div id="hide-show">
<p id="hide">
<a href="#" onclick="return showHideCompleted('stats-table');">{% trans "Hide completed modules" %}</a>
</p>
<p id="show" style="display:none">
<a href="#" onclick="return showHideCompleted('stats-table');">{% trans "Show completed modules" %}</a>
</p>
</div>
<h3>{{ stats_title }}</h3>
{% with stats as modstats %}
......
......@@ -43,11 +43,7 @@
{% for dom in doms %}
{% with dom.0 as domname and dom.1 as stat %}
{% if stat and not stat.is_fake %}
{% if stat.tr_percentage == 100 %}
<tr id="{{ modname }}-{{ stat.domain.id }}-complete">
{% else %}
<tr>
{% endif %}
<tr id="{{ modname }}-{{ stat.domain.id }}{% if stat.tr_percentage == 100 %}-complete{% endif %}">
<td class="leftcell">
{% if language %}
<a href="{% url 'vertimus_by_names' modname branch stat.domain.name language.locale %}">{{ stat.module_description }}
......
......@@ -48,18 +48,28 @@ $(document).ready(function()
{% include "people/person_team_membership.html" %}
{% if states %}
<div id="hide-show">
<p id="hide">
<a href="#" onclick="return showHideCompleted('working_on');">{% trans "Hide completed modules" %}</a>
</p>
<p id="show" style="display:none">
<a href="#" onclick="return showHideCompleted('working_on');">{% trans "Show completed modules" %}</a>
</p>
</div>
<h2>{% trans "Current activity" %}</h2>
<table class="stats" id="working_on">
<table class="stats" id="working_on" name="working_on">
<thead><tr>
<th>{% trans "Date" %}</th><th>{% trans "Module" %}</th><th></th><th>{% trans "State" %}</th>
</tr></thead>
<tbody>
{% for state in states %}
<tr>
{% for state, stats in states %}
<tr id="{{ state.id }}{% if stats.tr_percentage == 100 %}-complete{% endif %}">
<td><span style="display: none;">{{ state.updated|date:"c" }}</span>{{ state.updated|naturalday:"DATE_FORMAT" }}</td>
<td><a href="{{ state.get_absolute_url }}">{{ state.branch.module.get_description }} - {{ state.branch.name }} - {{ state.domain.get_description }} - {{ state.language.get_name }}</a></td>
<td><div class="graph">{{ state.stats|vis_stats }}</div></td>
<td><div class="graph">{{ stats|vis_stats }}</div></td>
<td>{{ state.description }}</td>
</tr>
{% endfor %}
......
......@@ -85,7 +85,10 @@ class State(models.Model):
@property
def stats(self):
return Statistics.objects.get(branch=self.branch, domain=self.domain, language=self.language)
try:
return Statistics.objects.get(branch=self.branch, domain=self.domain, language=self.language)
except Statistics.DoesNotExist:
return None
def change_state(self, state_class, person=None):
self.name = state_class.name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment