Show links to source files
This commit is contained in:
parent
a358491a87
commit
84c24dc1c7
|
@ -19,7 +19,7 @@
|
|||
{% else %}
|
||||
<tr><td>{{ unit.source }}</td><td colspan="2">{{ form.target }}</td></tr>
|
||||
{% endif %}
|
||||
<tr><td>{{ unit.location }}</td></tr>
|
||||
<tr><td>{{ unit.get_location_links }}</td></tr>
|
||||
<tr><td></td><td>
|
||||
<input type="submit" value="{% trans "Save" %}" />
|
||||
<a href="{{ unit.translation.get_translate_url }}?type={{ type }}&oldpos={{ unit.position }}">{% trans "Skip" %}</a>
|
||||
|
|
|
@ -3,6 +3,7 @@ from django.db.models import Q
|
|||
from django.conf import settings
|
||||
from lang.models import Language
|
||||
from django.utils.translation import ugettext_lazy, ugettext as _
|
||||
from django.utils.safestring import mark_safe
|
||||
from glob import glob
|
||||
import os
|
||||
import os.path
|
||||
|
@ -363,3 +364,13 @@ class Unit(models.Model):
|
|||
else:
|
||||
del kwargs['backend']
|
||||
super(Unit, self).save(*args, **kwargs)
|
||||
|
||||
def get_location_links(self):
|
||||
ret = []
|
||||
for location in self.location.split(','):
|
||||
location = location.strip()
|
||||
filename, line = location.split(':')
|
||||
link = 'https://github.com/phpmyadmin/phpmyadmin/blob/master/%s#L%s' % (filename, line)
|
||||
ret.append('<a href="%s">%s</a>' % (link, location))
|
||||
return mark_safe('\n'.join(ret))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user