Show links to source files
This commit is contained in:
parent
a358491a87
commit
84c24dc1c7
|
@ -19,7 +19,7 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr><td>{{ unit.source }}</td><td colspan="2">{{ form.target }}</td></tr>
|
<tr><td>{{ unit.source }}</td><td colspan="2">{{ form.target }}</td></tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr><td>{{ unit.location }}</td></tr>
|
<tr><td>{{ unit.get_location_links }}</td></tr>
|
||||||
<tr><td></td><td>
|
<tr><td></td><td>
|
||||||
<input type="submit" value="{% trans "Save" %}" />
|
<input type="submit" value="{% trans "Save" %}" />
|
||||||
<a href="{{ unit.translation.get_translate_url }}?type={{ type }}&oldpos={{ unit.position }}">{% trans "Skip" %}</a>
|
<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 django.conf import settings
|
||||||
from lang.models import Language
|
from lang.models import Language
|
||||||
from django.utils.translation import ugettext_lazy, ugettext as _
|
from django.utils.translation import ugettext_lazy, ugettext as _
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
@ -363,3 +364,13 @@ class Unit(models.Model):
|
||||||
else:
|
else:
|
||||||
del kwargs['backend']
|
del kwargs['backend']
|
||||||
super(Unit, self).save(*args, **kwargs)
|
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