Removed the last inline scripts.

This commit is contained in:
Jan Böhmer 2022-08-03 21:31:35 +02:00
parent 1c7c3bf2c5
commit 3ee8b26ddf
4 changed files with 20 additions and 2 deletions

View file

@ -0,0 +1,8 @@
import {Controller} from "@hotwired/stimulus";
export default class extends Controller
{
download(event) {
this.element.href = document.getElementById('pdf_preview').data
}
}

View file

@ -0,0 +1,10 @@
import {Controller} from "@hotwired/stimulus";
export default class extends Controller
{
connect() {
this.element.onclick = function() {
window.u2fauth.register();
}
}
}

View file

@ -99,7 +99,7 @@
{% if pdf_data %}
<div class="row">
<div class="col-sm-9 offset-sm-3">
<a data-turbo="false" class="btn btn-secondary" href="#" onclick="this.href = document.getElementById('pdf_preview').data" download="{{ filename ?? '' }}">
<a data-turbo="false" class="btn btn-secondary" href="#" {{ stimulus_controller('pages/label_download_btn')}} {{ stimulus_action('pages/label_download_btn', 'download')}} download="{{ filename ?? '' }}">
{% trans %}label_generator.download{% endtrans %}
</a>
</div>

View file

@ -16,7 +16,7 @@
<input type="text" class="form-control " name="keyName" id="keyName" placeholder="{{ 'r_u2f_two_factor.name'|trans }}"/>
</div>
<div class="col-3">
<button type="button" class="btn btn-success" onclick="u2fauth.register()">{% trans %}tfa_u2f.add_key.add_button{% endtrans %}</button>
<button type="button" class="btn btn-success" {{ stimulus_controller('pages/u2f_register') }}>{% trans %}tfa_u2f.add_key.add_button{% endtrans %}</button>
</div>
</div>
<div id="u2fpressbutton" style="display: none;" class="text-center h4">{{ 'r_u2f_two_factor.pressbutton'|trans }}</div>