Commit 92a5a6c3 authored by Michal Čihař's avatar Michal Čihař

Add copying of text to translation

parent 0820b908
......@@ -27,6 +27,10 @@
<td class="translatetext">{{ unit.source|fmttranslation }}</td>
</tr>
<tr>
<td></td>
<td><a href="#" id="copy-text">{% trans "Copy" %}</td>
</tr>
<tr>
<th>{% if unit.is_plural %}{% trans "Translations" %}{% else %}{% trans "Translation" %}{% endif %}</th>
<td class="translator">
{{ form.checksum }}
......
......@@ -71,3 +71,7 @@ td.translator textarea {
td.suggestions table {
width: 100%
}
#copy-text {
width: 20px;
height: 20px;
}
......@@ -5,4 +5,10 @@ $(document).ready(function(){
$('.sug-accept').button({text: false, icons: { primary: "ui-icon-check" }});
$('.sug-delete').button({text: false, icons: { primary: "ui-icon-close" }});
$('#id_target').change(function f() {$('#id_fuzzy').attr('checked', false);}).focus();
$('#copy-text').button({text: false, icons: { primary: "ui-icon-arrowthick-1-s" }}).click(function f() {
$.get("/js/get/" + $('#id_checksum').attr('value') + '/', function(data) {
$('#id_target').text(data);
});
return false;
});
});
......@@ -157,3 +157,10 @@ def translate(request, project, subproject, lang):
'type': rqtype,
'form': form,
}))
def get_string(request, checksum):
units = Unit.objects.filter(checksum = checksum)
if units.count() == 0:
return HttpResponse('')
return HttpResponse(units[0].get_source_plurals()[0])
......@@ -10,6 +10,8 @@ urlpatterns = patterns('',
url(r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/translate/$', 'trans.views.translate'),
url(r'^projects/(?P<project>[^/]*)/(?P<subproject>[^/]*)/(?P<lang>[^/]*)/download/$', 'trans.views.download_translation'),
url(r'^js/get/(?P<checksum>[^/]*)/$', 'trans.views.get_string'),
# Admin interface
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
......
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