1
0
Fork 0
mirror of https://git.42l.fr/neil/sncf.git synced 2024-05-02 22:13:10 +02:00

implement access your forms button, fixes #30

This commit is contained in:
neil 2021-04-13 00:03:02 +02:00
parent 0d38e2f2d4
commit 9fecf9ace9
2 changed files with 17 additions and 9 deletions

View file

@ -144,6 +144,10 @@ body, html {
transition: all .25s ease-in-out; transition: all .25s ease-in-out;
} }
.ncstyle-button:not(:last-child) {
margin-right: 1rem;
}
.margin-bottom { .margin-bottom {
margin-bottom: 1rem; margin-bottom: 1rem;
} }

View file

@ -13,14 +13,14 @@
<script> <script>
/* junk javascript with basic spambot protection features. /* junk javascript with basic spambot protection features.
Drunk indentation is vim's fault. Drunk indentation is vim's fault.
unsatisifed? Please make a PR. : ) */ unsatisifed? Please make a PR. : ) */
window.onload = function() { window.onload = function() {
// retrieved from server-side template // retrieved from server-side template
let csrf_token = "{{ csrf_token }}"; let csrf_token = "{{ csrf_token }}";
document.getElementById('new_link_button').addEventListener('click', function () { document.getElementById('new_link_button').addEventListener('click', function () {
new_link(csrf_token); new_link(csrf_token);
}); });
} }
function new_link(csrf) { function new_link(csrf) {
document.getElementById("csrf_token").value = csrf; document.getElementById("csrf_token").value = csrf;
@ -48,9 +48,13 @@
<noscript> <noscript>
<a class="ncstyle-button margin-bottom">{{ "index_nojs"|tr(lang) }}</a> <a class="ncstyle-button margin-bottom">{{ "index_nojs"|tr(lang) }}</a>
</noscript> </noscript>
{% if sncf_admin_token.is_some() %}
<a href="{{ sncf_admin_token.as_ref().unwrap() }}" class="ncstyle-button margin-bottom">{{ "index_continueform_button"|tr(lang) }}</a>
{% endif %}
<form id="new_link" action="/link" method="post"> <form id="new_link" action="/link" method="post">
<input id="csrf_token" name="csrf_token" type="text" class="hidden"> <input id="csrf_token" name="csrf_token" type="text" class="hidden">
<a id="new_link_button" class="click jsonly ncstyle-button margin-bottom">{{ "index_createform_button"|tr(lang) }}</a> </form> <a id="new_link_button" class="click jsonly ncstyle-button margin-bottom">{{ "index_createform_button"|tr(lang) }}</a>
</form>
<div id="loading_ring" class="hidden lds-ring"><div></div><div></div><div></div><div></div></div> <div id="loading_ring" class="hidden lds-ring"><div></div><div></div><div></div><div></div></div>
</div> </div>
<a class="scroll-down-link scroll-down-arrow"></a> <a class="scroll-down-link scroll-down-arrow"></a>