Skip to content

Commit

Permalink
Prepare data for unit creation time rendering (issue evernote/pootle#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
ta2-1 authored and unho committed Apr 22, 2014
1 parent 748a451 commit ce8ebee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
12 changes: 12 additions & 0 deletions pootle/apps/pootle_store/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,18 @@ def timeline(request, unit):
import locale
from pootle_store.fields import to_python

if unit.creation_time:
try:
# Under Windows, the "nl_langinfo" method is not available
time_str = unit.creation_time.strftime(locale.nl_langinfo(locale.D_T_FMT))
except NameError:
time_str = unit.creation_time

context['created'] = {
'datetime': unit.creation_time,
'datetime_str': time_str,
}

for key, values in groupby(timeline, key=lambda x: x.creation_time):
# Under Windows, the "nl_langinfo" method is not available
try:
Expand Down
13 changes: 9 additions & 4 deletions pootle/templates/editor/units/xhr_timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@
datetime="{{ entry_group.datetime.isoformat }}">&nbsp;</time>
</div>
</div>
{% empty %}
<div class="extra-item-content">
{% trans "No results." %}
</div>
{% endfor %}
<div class="extra-item-block">
<div class="extra-item-content">
{% trans "Created." %}
</div>
{% if created %}
<time class="extra-item-meta js-relative-date" title="{{ created.datetime_str}}"
datetime="{{ created.datetime.isoformat }}">&nbsp;</time>
{% endif %}
</div>
</div>
</div>

0 comments on commit ce8ebee

Please sign in to comment.