diff options
author | Sayamindu Dasgupta <sayamindu@gmail.com> | 2010-01-08 22:45:33 (GMT) |
---|---|---|
committer | Sayamindu Dasgupta <sayamindu@gmail.com> | 2010-01-08 22:45:33 (GMT) |
commit | b7dbad4e48e8c6779e05a56cae5a83b3c3bfec40 (patch) | |
tree | d01cad2a5add30a52cc8fd581adb0dc7e0260286 /Pootle-2.0.0 | |
parent | 1790e434a8a1e32132443ad5868598cb3a619c4e (diff) |
Show a commit status column for PO files
Diffstat (limited to 'Pootle-2.0.0')
4 files changed, 44 insertions, 0 deletions
diff --git a/Pootle-2.0.0/html/style.css b/Pootle-2.0.0/html/style.css index fda9338..924a8b2 100644 --- a/Pootle-2.0.0/html/style.css +++ b/Pootle-2.0.0/html/style.css @@ -1159,6 +1159,12 @@ td.stats-words padding-right: 10px; } +td.stats-image +{ + text-align: left; + padding-left: 35px; +} + img.error { vertical-align: middle; diff --git a/Pootle-2.0.0/local_apps/pootle_app/templates/language/item_summary.html b/Pootle-2.0.0/local_apps/pootle_app/templates/language/item_summary.html index 1c6a469..722820b 100644 --- a/Pootle-2.0.0/local_apps/pootle_app/templates/language/item_summary.html +++ b/Pootle-2.0.0/local_apps/pootle_app/templates/language/item_summary.html @@ -34,5 +34,13 @@ </ul> </td> <td class="stats-words">{{ item.data.totalsourcewords }}</td> +<td class="stats-image"> +{% if item.isfile %} +<div class="sortkey">{% if not item.needscommit %} {{ "0" }} {% else %} {{ "1" }} {% endif %}</div> +<img src="{% if not item.needscommit %} {{ "images/tick.png"|m }} {% else %} {{ "images/cross.png"|m }} {% endif %}" title="{% if not item.needscommit %} {% trans "File committed and pushed to upstream" %} {% else %} {% trans "File needs to committed." %} {% endif %}"/> +{% else %} + +{% endif %} +</td> {% endif %} {% endblock itemstats %} diff --git a/Pootle-2.0.0/local_apps/pootle_app/templates/language/tp_overview.html b/Pootle-2.0.0/local_apps/pootle_app/templates/language/tp_overview.html index df965aa..97c814c 100644 --- a/Pootle-2.0.0/local_apps/pootle_app/templates/language/tp_overview.html +++ b/Pootle-2.0.0/local_apps/pootle_app/templates/language/tp_overview.html @@ -26,6 +26,7 @@ <th class="stats">{{ stats_headings.progress }}</th> <th class="stats sorttable_numeric">{{ stats_headings.summary }}</th> <th class="stats">{{ stats_headings.totalwords }}</th> + <th class="stats">{% trans "Commit Status" %}</th> </tr> </thead> <tbody class="stats"> diff --git a/Pootle-2.0.0/local_apps/pootle_app/views/language/item_dict.py b/Pootle-2.0.0/local_apps/pootle_app/views/language/item_dict.py index bb46167..5f72841 100644 --- a/Pootle-2.0.0/local_apps/pootle_app/views/language/item_dict.py +++ b/Pootle-2.0.0/local_apps/pootle_app/views/language/item_dict.py @@ -29,6 +29,9 @@ from pootle_app.models.permissions import check_permission from pootle_store.models import Store from pootle_app.views.language import dispatch +from pootle_store.util import absolute_real_path + +import os, subprocess ################################################################################ def get_item_summary(request, quick_stats, path_obj): @@ -298,4 +301,30 @@ def make_store_item(request, store, links_required=None): item.update({ 'icon': 'file', 'isfile': True }) + item.update({ + 'needscommit' : get_commit_status(absolute_real_path(store.real_path)) }) return item + +def get_commit_status(path): + ''' Returns True if a commit needs to be made ''' + #FIXME: This should be made a part of the translate-toolkit + directory = os.path.realpath(path) + gitdir = None + while directory != '/': + directory = os.path.dirname(directory) + gitdir = os.path.join(directory, '.git') + if os.path.exists(gitdir): + cmd = ['git', 'diff', '--shortstat', path] + proc = subprocess.Popen(args = cmd, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + stdin = subprocess.PIPE, + cwd = directory) + (gitoutput, giterror) = proc.communicate() + if len(gitoutput) > 0: + return True + else: + return False + + return False # Doesn't seem to be a git repo, so return False + |