Skip to content

Commit 831e52d

Browse files
committed
Make autobuild i18n request POST rather than GET
1 parent c6a7701 commit 831e52d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Doc/tools/static/autobuildi18n.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Trigger translation autobuild
2+
$(document).ready(function() {
3+
$('.autobuildi18n').click(function() {
4+
var $this = $(this);
5+
var pagename = $this.data('pagename');
6+
console.log('Send request to update page: ' + pagename);
7+
$.post(
8+
'/_build/update/',
9+
{'source_path': pagename}
10+
).done(function(data) {
11+
console.log('Page (' + pagename + ') update complete');
12+
console.log(data);
13+
}).fail(function(data) {
14+
console.log('Page (' + pagename +') update failed');
15+
console.log(data);
16+
});
17+
});
18+
});

Doc/tools/templates/layout.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<link rel="shortcut icon" type="image/png" href="{{ pathto('_static/py.png', 1) }}" />
1919
{% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/gotooriginal.js', 1) }}"></script>{% endif %}
2020
{% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
21+
{% if autobuildi18n %}<script type="text/javascript" src="{{ pathto('_static/autobuildi18n.js', 1) }}"></script>{% endif %}
2122
{% if versionswitcher is defined and not embedded %}<script type="text/javascript" src="{{ pathto('_static/version_switch.js', 1) }}"></script>{% endif %}
2223
{% if pagename == 'whatsnew/changelog' %}
2324
<script type="text/javascript">
@@ -102,7 +103,7 @@ <h3>{{ _('This Page') }}</h3>
102103
<li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
103104
rel="nofollow">Show Source</a></li>
104105
{%- if autobuildi18n %}
105-
<li><a href="/_build/update/?source_path={{ pagename|replace('/', '--')|replace('.', '_') }}">Update Translation</a></li>
106+
<li><a class="autobuildi18n" data-pagename="{{ pagename }}" href="#">Update Translation</a></li>
106107
{%- endif %}
107108
</ul>
108109
{%- endif %}

0 commit comments

Comments
 (0)